Merge "Fix issue that read-only apns can be edited" am: e871464053 am: 6b0237ebfb

am: 502ad46dc1

Change-Id: I6bd527b0fb0b63393d5ddf8414257f543a532805
This commit is contained in:
Youming Ye
2018-11-08 17:47:59 -08:00
committed by android-build-merger
2 changed files with 12 additions and 31 deletions

View File

@@ -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);
}
}