Merge "Display a toast to notify user that Preset APN setting cannot be viewed" am: a995cb334b
am: e29c62ea04
am: e5e4e4cb76
Change-Id: Ic4c41e88c28a322d54a8489844b6ef0ff041d3a1
This commit is contained in:
@@ -27,6 +27,7 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
@@ -54,6 +55,7 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke
|
||||
private static CompoundButton mCurrentChecked = null;
|
||||
private boolean mProtectFromCheckedChange = false;
|
||||
private boolean mSelectable = true;
|
||||
private boolean mHideDetails = false;
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||
@@ -113,6 +115,11 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke
|
||||
super.onClick();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
if (mHideDetails) {
|
||||
Toast.makeText(context, context.getString(
|
||||
R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
int pos = Integer.parseInt(getKey());
|
||||
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
|
||||
Intent editIntent = new Intent(Intent.ACTION_EDIT, url);
|
||||
@@ -132,4 +139,8 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke
|
||||
public void setSubId(int subId) {
|
||||
mSubId = subId;
|
||||
}
|
||||
|
||||
public void setHideDetails() {
|
||||
mHideDetails = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user