Skip to content

Commit 91c157f

Browse files
committed
fix editText rounded background when scrolling
1 parent aef6dd5 commit 91c157f

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

extensions/shared/library/src/main/java/app/revanced/extension/shared/Utils.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,15 @@ public static Pair<Dialog, LinearLayout> createCustomDialog(
810810
// Create content container (message/EditText) inside a ScrollView.
811811
ScrollView contentScrollView = new ScrollView(context);
812812
contentScrollView.setVerticalScrollBarEnabled(false); // Disable the vertical scrollbar.
813+
contentScrollView.setOverScrollMode(View.OVER_SCROLL_NEVER);
814+
if (editText != null) {
815+
ShapeDrawable scrollViewBackground = new ShapeDrawable(new RoundRectShape(
816+
createCornerRadii(10), null, null));
817+
scrollViewBackground.getPaint().setColor(getEditTextBackground());
818+
contentScrollView.setPadding(dip8, dip8, dip8, dip8);
819+
contentScrollView.setBackground(scrollViewBackground);
820+
contentScrollView.setClipToOutline(true);
821+
}
813822
LinearLayout contentContainer = new LinearLayout(context);
814823
contentContainer.setOrientation(LinearLayout.VERTICAL);
815824
LinearLayout.LayoutParams contentParams = new LinearLayout.LayoutParams(
@@ -847,13 +856,8 @@ public static Pair<Dialog, LinearLayout> createCustomDialog(
847856
}
848857
// Style the EditText to match the dialog theme.
849858
editText.setTextColor(getAppForegroundColor());
850-
editText.setBackgroundColor(isDarkModeEnabled() ? Color.BLACK : Color.WHITE);
851-
editText.setPadding(dip8, dip8, dip8, dip8);
852-
ShapeDrawable editTextBackground = new ShapeDrawable(new RoundRectShape(
853-
createCornerRadii(10), null, null));
854-
editTextBackground.getPaint().setColor(getEditTextBackground()); // Background color for EditText.
855-
editText.setBackground(editTextBackground);
856-
859+
editText.setBackgroundColor(Color.TRANSPARENT);
860+
editText.setPadding(0, 0, 0, 0);
857861
LinearLayout.LayoutParams editTextParams = new LinearLayout.LayoutParams(
858862
LinearLayout.LayoutParams.MATCH_PARENT,
859863
LinearLayout.LayoutParams.WRAP_CONTENT

extensions/shared/library/src/main/java/app/revanced/extension/shared/settings/preference/ColorPickerPreference.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ protected void showDialog(Bundle state) {
298298
// Horizontal layout for preview and EditText.
299299
LinearLayout inputLayout = new LinearLayout(context);
300300
inputLayout.setOrientation(LinearLayout.HORIZONTAL);
301-
inputLayout.setPadding(0, 0, 0, dipToPixels(10));
302301

303302
dialogColorPreview = new TextView(context);
304303
LinearLayout.LayoutParams previewParams = new LinearLayout.LayoutParams(

extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategoryListPreference.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ protected void showDialog(Bundle state) {
8888
// Create the main layout for the dialog content.
8989
LinearLayout contentLayout = new LinearLayout(context);
9090
contentLayout.setOrientation(LinearLayout.VERTICAL);
91-
final int dip10 = dipToPixels(10);
92-
contentLayout.setPadding(0, 0, 0, dip10);
9391

9492
// Add behavior selection radio buttons.
9593
RadioGroup radioGroup = new RadioGroup(context);
@@ -103,7 +101,7 @@ protected void showDialog(Bundle state) {
103101
radioGroup.addView(radioButton);
104102
}
105103
radioGroup.setOnCheckedChangeListener((group, checkedId) -> selectedDialogEntryIndex = checkedId);
106-
radioGroup.setPadding(dip10, 0, 0, 0);
104+
radioGroup.setPadding(dipToPixels(10), 0, 0, 0);
107105
contentLayout.addView(radioGroup);
108106

109107
// Inflate the color picker view.
@@ -131,7 +129,7 @@ protected void showDialog(Bundle state) {
131129
gridParams = new GridLayout.LayoutParams();
132130
gridParams.rowSpec = GridLayout.spec(0); // First row.
133131
gridParams.columnSpec = GridLayout.spec(1); // Second column.
134-
gridParams.setMargins(0, 0, dip10, 0);
132+
gridParams.setMargins(0, 0, dipToPixels(10), 0);
135133
dialogColorDotView = new TextView(context);
136134
dialogColorDotView.setLayoutParams(gridParams);
137135
gridLayout.addView(dialogColorDotView);

0 commit comments

Comments
 (0)