Skip to content

Commit 005185e

Browse files
committed
Border for popup suggestion
1 parent ce5d708 commit 005185e

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

lib-n-ide/src/main/java/com/duy/ide/editor/theme/EditorThemeFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
6060

6161
private void loadData() {
6262
mLoadThemeTask = new LoadThemeTask(getContext());
63-
mLoadThemeTask.execute();
63+
mLoadThemeTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
6464
}
6565

6666
@Override

lib-n-ide/src/main/java/com/duy/ide/editor/theme/model/EditorTheme.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ public int hashCode() {
153153
return result;
154154
}
155155

156+
public int getDropdownBorderColor() {
157+
return getColor(Attr.DROPDOWN_BORDER);
158+
}
159+
156160
public enum ThemeAttr {
157161
SCHEME_NAME("theme.name"),
158162
TYPE("theme.type"),

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import android.annotation.SuppressLint;
44
import android.content.Context;
55
import android.graphics.Rect;
6-
import android.graphics.drawable.ColorDrawable;
6+
import android.graphics.drawable.GradientDrawable;
77
import android.os.Build;
88
import android.support.annotation.NonNull;
99
import android.support.annotation.Nullable;
@@ -22,6 +22,7 @@
2222
import com.duy.ide.editor.internal.suggestion.OnSuggestItemClickListener;
2323
import com.duy.ide.editor.internal.suggestion.SuggestionAdapter;
2424
import com.duy.ide.editor.theme.model.EditorTheme;
25+
import com.jecelyin.common.utils.SysUtils;
2526

2627
import java.util.ArrayList;
2728
import java.util.List;
@@ -80,7 +81,10 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) {
8081
}
8182

8283
private void setThemeForPopup(EditorTheme theme) {
83-
mPopup.setBackgroundDrawable(new ColorDrawable(theme.getDropdownBgColor()));
84+
GradientDrawable background = new GradientDrawable();
85+
background.setColor(theme.getDropdownBgColor());
86+
background.setStroke(SysUtils.dpToPixels(getContext(), 1), theme.getDropdownBorderColor());
87+
mPopup.setBackgroundDrawable(background);
8488
mAdapter.setTextColor(theme.getDropdownFgColor());
8589
}
8690

lib-n-ide/src/main/res-file-expoler/layout/list_item_suggest_default.xml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
android:layout_width="match_parent"
1919
android:layout_height="match_parent"
2020
android:layout_gravity="center_vertical"
21-
android:background="?android:windowBackground"
22-
android:foreground="?selectableItemBackground"
21+
android:background="?selectableItemBackground"
2322
android:gravity="center_vertical"
2423
android:minHeight="25dp"
2524
android:orientation="horizontal">
@@ -42,10 +41,8 @@
4241
android:layout_weight="1"
4342
android:ellipsize="middle"
4443
android:gravity="center|start"
45-
android:paddingBottom="4dp"
46-
android:paddingLeft="2dp"
47-
android:paddingRight="2dp"
48-
android:paddingTop="4dp"
44+
android:padding="2dp"
45+
4946
android:textColor="?android:textColorPrimary"
5047
android:typeface="monospace"
5148
tools:text="GetResultCode" />
@@ -56,8 +53,7 @@
5653
android:layout_height="wrap_content"
5754
android:gravity="center|end"
5855
android:maxEms="5"
59-
android:paddingBottom="4dp"
60-
android:paddingTop="4dp"
56+
android:padding="2dp"
6157
android:typeface="monospace"
6258
tools:text="String" />
6359

0 commit comments

Comments
 (0)