Fix toggle widget can be switched under overlapped view am: 4794b798c4 am: 1c7d1dfba6 am: a3079f6937
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/12124562
Change-Id: I35a5897033fc7bab76acec1bf92b33dfadb251f2
diff --git a/res/layout/bubble_preference.xml b/res/layout/bubble_preference.xml
index 8a64716..08f25b4 100644
--- a/res/layout/bubble_preference.xml
+++ b/res/layout/bubble_preference.xml
@@ -44,7 +44,7 @@
android:id="@+id/bubble_all_icon"
android:src="@drawable/ic_bubble_all"
android:background="@android:color/transparent"
- android:layout_gravity="center"
+ android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
@@ -53,6 +53,7 @@
android:id="@+id/bubble_all_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="2"
android:clickable="false"
@@ -75,7 +76,7 @@
android:id="@+id/bubble_selected_icon"
android:src="@drawable/ic_bubble_selected"
android:background="@android:color/transparent"
- android:layout_gravity="center"
+ android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
@@ -84,6 +85,7 @@
android:id="@+id/bubble_selected_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="2"
android:clickable="false"
@@ -106,7 +108,7 @@
android:id="@+id/bubble_none_icon"
android:src="@drawable/ic_bubble_none"
android:background="@android:color/transparent"
- android:layout_gravity="center"
+ android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
@@ -115,6 +117,7 @@
android:id="@+id/bubble_none_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="2"
android:clickable="false"
@@ -125,4 +128,4 @@
android:text="@string/bubble_app_setting_none"/>
</com.android.settings.notification.NotificationButtonRelativeLayout>
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/src/com/android/settings/notification/app/BubblePreference.java b/src/com/android/settings/notification/app/BubblePreference.java
index 7e071ff..f0046d7 100644
--- a/src/com/android/settings/notification/app/BubblePreference.java
+++ b/src/com/android/settings/notification/app/BubblePreference.java
@@ -45,8 +45,6 @@
private int mSelectedPreference;
private Context mContext;
- private Drawable mSelectedBackground;
- private Drawable mUnselectedBackground;
private ButtonViewHolder mBubbleAllButton;
private ButtonViewHolder mBubbleSelectedButton;
@@ -72,8 +70,6 @@
mHelper = new RestrictedPreferenceHelper(context, this, attrs);
mHelper.useAdminDisabledSummary(true);
mContext = context;
- mSelectedBackground = mContext.getDrawable(R.drawable.button_border_selected);
- mUnselectedBackground = mContext.getDrawable(R.drawable.button_border_unselected);
setLayoutResource(R.layout.bubble_preference);
}
@@ -167,7 +163,9 @@
}
void setSelected(Context context, boolean selected) {
- mView.setBackground(selected ? mSelectedBackground : mUnselectedBackground);
+ mView.setBackground(mContext.getDrawable(selected
+ ? R.drawable.button_border_selected
+ : R.drawable.button_border_unselected));
mView.setSelected(selected);
ColorStateList stateList = selected