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

Commit 872cb0b2 authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "Migrate CellDataPreference to switchPreferenceCompatStyle" into main

parents 4e806989 17d3c1d8
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -26,11 +26,10 @@ import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.Checkable;
import android.widget.CompoundButton;

import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.PreferenceViewHolder;

import com.android.settings.R;
@@ -51,12 +50,10 @@ public class CellDataPreference extends CustomDialogPreferenceCompat
    public int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    public boolean mChecked;
    public boolean mMultiSimDialog;
    private MobileDataEnabledListener mDataStateListener;
    private final MobileDataEnabledListener mDataStateListener;

    public CellDataPreference(Context context, AttributeSet attrs) {
        super(context, attrs, TypedArrayUtils.getAttr(context,
                androidx.preference.R.attr.switchPreferenceStyle,
                android.R.attr.switchPreferenceStyle));
        super(context, attrs, androidx.preference.R.attr.switchPreferenceCompatStyle);
        mDataStateListener = new MobileDataEnabledListener(context, this);
    }

@@ -170,9 +167,10 @@ public class CellDataPreference extends CustomDialogPreferenceCompat
    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        final CompoundButton switchView =
                (CompoundButton) holder.findViewById(androidx.preference.R.id.switchWidget);
        switchView.setClickable(false);
        ((Checkable) switchView).setChecked(mChecked);
        switchView.setChecked(mChecked);
    }

    @Override