Skip to content

Commit 31912da

Browse files
committed
Add corner radius for popup suggestion
1 parent 5f9166b commit 31912da

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib-n-ide/src/main/java/com/duy/ide/editor/view/SuggestionEditor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) {
9595
private void setThemeForPopup(EditorTheme theme) {
9696
GradientDrawable background = new GradientDrawable();
9797
background.setColor(theme.getDropdownBgColor());
98+
background.setShape(GradientDrawable.RECTANGLE);
99+
background.setCornerRadius(SysUtils.dpToPixels(getContext(), 4));
98100
background.setStroke(SysUtils.dpToPixels(getContext(), 1), theme.getDropdownBorderColor());
101+
99102
mPopup.setBackgroundDrawable(background);
100103
mAdapter.setTextColor(theme.getDropdownFgColor());
101104
}

lib-n-ide/src/main/java/com/jecelyin/editor/v2/Preferences.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
5252
public static final String KEY_SCREEN_ORIENTATION = "pref_screen_orientation";
5353
public static final String KEY_KEEP_SCREEN_ON = "pref_keep_screen_on";
5454
public static final String KEY_READ_ONLY = "readonly_mode";
55-
public static final String KEY_VOLUME_MOVE = "pref_volume_move";
5655

5756
public static final int DEF_MIN_FONT_SIZE = 9;
5857
public static final int DEF_MAX_FONT_SIZE = 32;
@@ -69,7 +68,6 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
6968
private static final String KEY_HIGHLIGHT_FILE_SIZE_LIMIT = "pref_highlight_file_size_limit";
7069
private static final String KEY_REMEMBER_LAST_OPENED_FILES = "pref_remember_last_opened_files";
7170
private static final String KEY_TOOLBAR_ICONS = "pref_toolbar_icons";
72-
private static final String KEY_PREF_AUTO_CHECK_UPDATES = "pref_auto_check_updates";
7371
private static final String KEY_LAST_OPEN_PATH = "last_open_path";
7472
private static final String KEY_SHOW_HIDDEN_FILES = "show_hidden_files";
7573
private static final String KEY_FILE_SORT_TYPE = "show_file_sort";
@@ -78,10 +76,6 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
7876
private static final Object mContent = new Object();
7977
private static final int[] THEMES = new int[]{R.style.LightTheme, R.style.DarkTheme};
8078
private static Preferences instance;
81-
82-
static {
83-
}
84-
8579
private final SharedPreferences preferences;
8680

8781
private final Map<String, Object> map;
@@ -91,6 +85,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
9185

9286
public Preferences(Context context) {
9387
this.context = context;
88+
PreferenceManager.setDefaultValues(context, R.xml.preference_editor, false);
9489
preferences = PreferenceManager.getDefaultSharedPreferences(context);
9590
preferences.registerOnSharedPreferenceChangeListener(this);
9691

@@ -100,13 +95,16 @@ public Preferences(Context context) {
10095
map.put(KEY_WORD_WRAP, true);
10196
map.put(KEY_SHOW_LINE_NUMBER, true);
10297
map.put(KEY_SHOW_WHITESPACE, true);
98+
99+
map.put(context.getString(R.string.pref_auto_complete), true);
103100
map.put(KEY_AUTO_INDENT, true);
104101
map.put(KEY_AUTO_PAIR, true);
102+
105103
map.put(KEY_INSERT_SPACE_FOR_TAB, true);
106104
map.put(KEY_TAB_SIZE, 4);
107105
map.put(KEY_SYMBOL, VALUE_SYMBOL);
108106
map.put(KEY_AUTO_CAPITALIZE, false);
109-
map.put(KEY_VOLUME_MOVE, true);
107+
map.put(context.getString(R.string.pref_volume_move), true);
110108

111109
map.put(KEY_HIGHLIGHT_FILE_SIZE_LIMIT, 500);
112110
map.put(KEY_REMEMBER_LAST_OPENED_FILES, true);
@@ -388,7 +386,7 @@ public void setTerminalTheme(int index) {
388386
}
389387

390388
public boolean isUseVolumeToMove() {
391-
return preferences.getBoolean(KEY_VOLUME_MOVE, true);
389+
return preferences.getBoolean(context.getString(R.string.pref_volume_move), true);
392390
}
393391

394392
public boolean isUseAutoComplete() {

0 commit comments

Comments
 (0)