Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5de9b1e4 authored by Lyn Han's avatar Lyn Han
Browse files

Fix sketchy bubble preference button

We were re-using the same "unselected" drawable for buttons with
different heights, which causes one height to override the other,
leading to unexpected drawable overlap and height/text-line mismatch.

Instead, use separate drawable per button.

Fixes: 154087375
Test: toggle between pref buttons in every font size
Change-Id: I5db6e1eb5150a72a0d8038b0840538a0982a5f67
parent e9a33d48
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ public class BubblePreference extends Preference implements View.OnClickListener
    private int mSelectedPreference;

    private Context mContext;
    private Drawable mSelectedBackground;
    private Drawable mUnselectedBackground;

    private ButtonViewHolder mBubbleAllButton;
    private ButtonViewHolder mBubbleSelectedButton;
@@ -72,8 +70,6 @@ public class BubblePreference extends Preference implements View.OnClickListener
        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 @@ public class BubblePreference extends Preference implements View.OnClickListener
        }

        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