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

Commit 1ea5a786 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Set Default APN radio button's size to 48dp

Which is the minimum tap size.

Also set ApnPreference not selectable, since itspPrimary target and
radio button could be selectable, but entire preference itself is not
selectable.

Fix: 330812055
Fix: 330290274
Test: manual - with APNs
Change-Id: I651642e8a275932be6b8bcb365198e5dc1ad92f8
parent 8e2324d9
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -57,14 +57,19 @@

    </RelativeLayout>

    <FrameLayout
        android:id="@+id/apn_radio_button_frame"
        android:layout_width="@dimen/min_tap_target_size"
        android:layout_height="@dimen/min_tap_target_size"
        android:layout_margin="8dp">

        <RadioButton
            android:id="@+id/apn_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        android:layout_marginStart="8dip"
        android:layout_marginEnd="8dip"
        android:layout_gravity="center_vertical"
        android:focusable="true"
        android:clickable="true" />
            android:layout_gravity="center"
            android:clickable="false"
            android:focusable="false" />
    </FrameLayout>

</LinearLayout>
+24 −25
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class ApnPreference extends Preference
    private static CompoundButton sCurrentChecked = null;
    private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    private boolean mProtectFromCheckedChange = false;
    private boolean mSelectable = true;
    private boolean mDefaultSelectable = true;
    private boolean mHideDetails = false;

    /**
@@ -57,6 +57,9 @@ public class ApnPreference extends Preference
     */
    public ApnPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // Primary target and radio button could be selectable, but entire preference itself is not
        // selectable.
        setSelectable(false);
    }

    /**
@@ -80,10 +83,11 @@ public class ApnPreference extends Preference
        final RelativeLayout textArea = (RelativeLayout) view.findViewById(R.id.text_layout);
        textArea.setOnClickListener(this);

        final View widget = view.findViewById(R.id.apn_radiobutton);
        if ((widget != null) && widget instanceof RadioButton) {
            final RadioButton rb = (RadioButton) widget;
            if (mSelectable) {
        final RadioButton rb = view.itemView.requireViewById(R.id.apn_radiobutton);
        if (mDefaultSelectable) {
            view.itemView.requireViewById(R.id.apn_radio_button_frame).setOnClickListener((v) -> {
                rb.performClick();
            });
            rb.setOnCheckedChangeListener(this);

            final boolean isChecked = getKey().equals(sSelectedKey);
@@ -100,7 +104,6 @@ public class ApnPreference extends Preference
            rb.setVisibility(View.GONE);
        }
    }
    }

    /**
     * Return the preference is checked or not.
@@ -167,12 +170,8 @@ public class ApnPreference extends Preference
        }
    }

    public boolean getSelectable() {
        return mSelectable;
    }

    public void setSelectable(boolean selectable) {
        mSelectable = selectable;
    public void setDefaultSelectable(boolean defaultSelectable) {
        mDefaultSelectable = defaultSelectable;
    }

    public void setSubId(int subId) {
+3 −3
Original line number Diff line number Diff line
@@ -369,10 +369,10 @@ public class ApnSettings extends RestrictedSettingsFragment
                    pref.setSummary(apn);
                }

                final boolean selectable =
                final boolean defaultSelectable =
                        ((type == null) || type.contains(ApnSetting.TYPE_DEFAULT_STRING));
                pref.setSelectable(selectable);
                if (selectable) {
                pref.setDefaultSelectable(defaultSelectable);
                if (defaultSelectable) {
                    if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
                        pref.setChecked();
                    }