Display a toast to notify user that Preset APN setting cannot be viewed
When KEY_HIDE_PRESET_APN_DETAILS_BOOL is set to true, Preset APN setting is hidden. When user taps Preset APN, a toast should be shown to inform that user cannot view the APN. Test: manual - check Preset APN setting details are hidden Bug: 115453290 Depends-On: I8a5c6f92f876d349b304acf89b4ffab86ff3f24b Change-Id: I0078b3492ae87a4297f24871b8bea1579e6a79af
This commit is contained in:
committed by
Youming Ye
parent
8f516adef7
commit
4d044ced6d
@@ -29,6 +29,7 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
@@ -53,6 +54,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) {
|
||||
@@ -112,6 +114,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);
|
||||
@@ -131,4 +138,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