Fix bug #12978671 RTE while tapping on Access points
- revert back to a PreferenceActivity Change-Id: Ie79b46908c9d8dcf3c2b77bd0999341c7e72050e
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ContentUris;
|
||||
@@ -32,18 +31,21 @@ import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.provider.Telephony;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.PhoneConstants;
|
||||
import com.android.internal.telephony.RILConstants;
|
||||
import com.android.internal.telephony.TelephonyProperties;
|
||||
|
||||
|
||||
public class ApnEditor extends SettingsPreferenceFragment
|
||||
public class ApnEditor extends PreferenceActivity
|
||||
implements SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
@@ -146,7 +148,7 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
addPreferencesFromResource(R.xml.apn_editor);
|
||||
@@ -186,7 +188,7 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
|
||||
mRes = getResources();
|
||||
|
||||
final Intent intent = getActivity().getIntent();
|
||||
final Intent intent = getIntent();
|
||||
final String action = intent.getAction();
|
||||
|
||||
mFirstTime = icicle == null;
|
||||
@@ -206,24 +208,24 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
// original activity if they requested a result.
|
||||
if (mUri == null) {
|
||||
Log.w(TAG, "Failed to insert new telephony provider into "
|
||||
+ getActivity().getIntent().getData());
|
||||
+ getIntent().getData());
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// The new entry was created, so assume all will end well and
|
||||
// set the result to be returned.
|
||||
getActivity().setResult(Activity.RESULT_OK, (new Intent()).setAction(mUri.toString()));
|
||||
setResult(RESULT_OK, (new Intent()).setAction(mUri.toString()));
|
||||
|
||||
} else {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
mCursor = getActivity().getContentResolver().query(mUri, sProjection, null, null, null);
|
||||
mCursor = managedQuery(mUri, sProjection, null, null);
|
||||
mCursor.moveToFirst();
|
||||
|
||||
mTelephonyManager = (TelephonyManager) getSystemService(Activity.TELEPHONY_SERVICE);
|
||||
mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
|
||||
|
||||
fillUi();
|
||||
}
|
||||
@@ -439,8 +441,8 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
// If it's a new APN, then cancel will delete the new entry in onPause
|
||||
if (!mNewApn) {
|
||||
menu.add(0, MENU_DELETE, 0, R.string.menu_delete)
|
||||
@@ -450,6 +452,7 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
.setIcon(android.R.drawable.ic_menu_save);
|
||||
menu.add(0, MENU_CANCEL, 0, R.string.menu_cancel)
|
||||
.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -474,7 +477,20 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle icicle) {
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_BACK: {
|
||||
if (validateAndSave(false)) {
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle icicle) {
|
||||
super.onSaveInstanceState(icicle);
|
||||
if (validateAndSave(true)) {
|
||||
icicle.putInt(SAVED_POS, mCursor.getInt(ID_INDEX));
|
||||
@@ -582,12 +598,12 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id) {
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
|
||||
if (id == ERROR_DIALOG_ID) {
|
||||
String msg = getErrorMsg();
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
return new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.error_title)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setMessage(msg)
|
||||
@@ -597,6 +613,19 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
return super.onCreateDialog(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialog(int id, Dialog dialog) {
|
||||
super.onPrepareDialog(id, dialog);
|
||||
|
||||
if (id == ERROR_DIALOG_ID) {
|
||||
String msg = getErrorMsg();
|
||||
|
||||
if (msg != null) {
|
||||
((AlertDialog)dialog).setMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteApn() {
|
||||
getContentResolver().delete(mUri, null, null);
|
||||
finish();
|
||||
|
Reference in New Issue
Block a user