diff --git a/src/com/android/settings/network/ApnPreference.java b/src/com/android/settings/network/ApnPreference.java index 412259bab72..a7fbb6eaa92 100755 --- a/src/com/android/settings/network/ApnPreference.java +++ b/src/com/android/settings/network/ApnPreference.java @@ -25,18 +25,15 @@ import android.telephony.SubscriptionManager; import android.util.AttributeSet; import android.util.Log; import android.view.View; -import android.view.View.OnClickListener; import android.widget.CompoundButton; import android.widget.RadioButton; -import android.widget.RelativeLayout; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; import com.android.settings.R; -public class ApnPreference extends Preference implements - CompoundButton.OnCheckedChangeListener, OnClickListener { +public class ApnPreference extends Preference implements CompoundButton.OnCheckedChangeListener { final static String TAG = "ApnPreference"; private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; @@ -82,11 +79,6 @@ public class ApnPreference extends Preference implements rb.setVisibility(View.GONE); } } - - View textLayout = view.findViewById(R.id.text_layout); - if ((textLayout != null) && textLayout instanceof RelativeLayout) { - textLayout.setOnClickListener(this); - } } public boolean isChecked() { @@ -116,16 +108,16 @@ public class ApnPreference extends Preference implements } } - public void onClick(android.view.View v) { - if ((v != null) && (R.id.text_layout == v.getId())) { - Context context = getContext(); - if (context != null) { - int pos = Integer.parseInt(getKey()); - Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos); - Intent editIntent = new Intent(Intent.ACTION_EDIT, url); - editIntent.putExtra(ApnSettings.SUB_ID, mSubId); - context.startActivity(editIntent); - } + @Override + protected void onClick() { + super.onClick(); + Context context = getContext(); + if (context != null) { + int pos = Integer.parseInt(getKey()); + Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos); + Intent editIntent = new Intent(Intent.ACTION_EDIT, url); + editIntent.putExtra(ApnSettings.SUB_ID, mSubId); + context.startActivity(editIntent); } } diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java index beeaab35c7a..a71dfaa7e16 100755 --- a/src/com/android/settings/network/ApnSettings.java +++ b/src/com/android/settings/network/ApnSettings.java @@ -21,7 +21,6 @@ import android.app.Dialog; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.ContentResolver; -import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.content.Intent; @@ -65,8 +64,7 @@ import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import java.util.ArrayList; -public class ApnSettings extends RestrictedSettingsFragment implements - Preference.OnPreferenceChangeListener { +public class ApnSettings extends RestrictedSettingsFragment { static final String TAG = "ApnSettings"; public static final String EXTRA_POSITION = "position"; @@ -313,7 +311,6 @@ public class ApnSettings extends RestrictedSettingsFragment implements pref.setTitle(name); pref.setSummary(apn); pref.setPersistent(false); - pref.setOnPreferenceChangeListener(this); pref.setSubId(subId); boolean selectable = ((type == null) || !type.equals("mms")); @@ -405,14 +402,6 @@ public class ApnSettings extends RestrictedSettingsFragment implements startActivity(intent); } - @Override - public boolean onPreferenceTreeClick(Preference preference) { - int pos = Integer.parseInt(preference.getKey()); - Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos); - startActivity(new Intent(Intent.ACTION_EDIT, url)); - return true; - } - public boolean onPreferenceChange(Preference preference, Object newValue) { Log.d(TAG, "onPreferenceChange(): Preference - " + preference + ", newValue - " + newValue + ", newValue type - "