diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2014-01-17 19:17:58 -0800 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2014-02-03 16:36:46 -0800 |
commit | 263bcc8b732dbb47d3ce63904e0e05191fabbad6 (patch) | |
tree | dc8fd51052ac94e418473d378c1244cb42594665 /src/com/android/settings/ApnSettings.java | |
parent | af79ddb358ff6ed078708ce5995da9ff269f1679 (diff) | |
download | packages_apps_Settings-263bcc8b732dbb47d3ce63904e0e05191fabbad6.tar.gz packages_apps_Settings-263bcc8b732dbb47d3ce63904e0e05191fabbad6.tar.bz2 packages_apps_Settings-263bcc8b732dbb47d3ce63904e0e05191fabbad6.zip |
Use Drawer in Settings app
- get rid of PreferenceActivity as much as we can and use fragments instead
- add Drawer widget
- add Dashboard high level entry into the Drawer (but this is work in progress and would be done in another CL)
- add bypass of fragment's Header validation when launched from the Drawer but *force* validation if external
call thru an Intent
Be aware that WifiPickerActivity should remain for now a PreferenceActivity. It is used by SetupWizard and should
not trigger running the SettingsActivity's header building code. SetupWizard is a Home during the provisionnig process
and then deactivate itself as a Home but would make the Home header to appear in the Drawer (because momentarily we
would have two Home).
Also, verified that:
- the WiFi settings still work when called from SetupWizard
- when you have multiple Launchers, the Home header will appear in the list of Headers in the Drawer
Change-Id: I407a5e0fdd843ad7615d3d511c416a44e3d97c90
Diffstat (limited to 'src/com/android/settings/ApnSettings.java')
-rw-r--r-- | src/com/android/settings/ApnSettings.java | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java index 3fbb5e3ab..294d50ff1 100644 --- a/src/com/android/settings/ApnSettings.java +++ b/src/com/android/settings/ApnSettings.java @@ -33,12 +33,12 @@ import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.preference.Preference; -import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.provider.Telephony; import android.util.Log; import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.widget.Toast; @@ -49,7 +49,7 @@ import com.android.internal.telephony.TelephonyProperties; import java.util.ArrayList; -public class ApnSettings extends PreferenceActivity implements +public class ApnSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { static final String TAG = "ApnSettings"; @@ -116,7 +116,7 @@ public class ApnSettings extends PreferenceActivity implements } @Override - protected void onCreate(Bundle icicle) { + public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.apn_settings); @@ -127,10 +127,10 @@ public class ApnSettings extends PreferenceActivity implements } @Override - protected void onResume() { + public void onResume() { super.onResume(); - registerReceiver(mMobileStateReceiver, mMobileStateFilter); + getActivity().registerReceiver(mMobileStateReceiver, mMobileStateFilter); if (!mRestoreDefaultApnMode) { fillList(); @@ -140,14 +140,14 @@ public class ApnSettings extends PreferenceActivity implements } @Override - protected void onPause() { + public void onPause() { super.onPause(); - unregisterReceiver(mMobileStateReceiver); + getActivity().unregisterReceiver(mMobileStateReceiver); } @Override - protected void onDestroy() { + public void onDestroy() { super.onDestroy(); if (mRestoreDefaultApnThread != null) { @@ -178,7 +178,7 @@ public class ApnSettings extends PreferenceActivity implements String key = cursor.getString(ID_INDEX); String type = cursor.getString(TYPES_INDEX); - ApnPreference pref = new ApnPreference(this); + ApnPreference pref = new ApnPreference(getActivity()); pref.setKey(key); pref.setTitle(name); @@ -207,8 +207,8 @@ public class ApnSettings extends PreferenceActivity implements } @Override - public boolean onCreateOptionsMenu(Menu menu) { - super.onCreateOptionsMenu(menu); + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + super.onCreateOptionsMenu(menu, inflater); menu.add(0, MENU_NEW, 0, getResources().getString(R.string.menu_new)) .setIcon(android.R.drawable.ic_menu_add) @@ -216,7 +216,6 @@ public class ApnSettings extends PreferenceActivity implements menu.add(0, MENU_RESTORE, 0, getResources().getString(R.string.menu_restore)) .setIcon(android.R.drawable.ic_menu_upload); - return true; } @Override @@ -308,9 +307,9 @@ public class ApnSettings extends PreferenceActivity implements fillList(); getPreferenceScreen().setEnabled(true); mRestoreDefaultApnMode = false; - dismissDialog(DIALOG_RESTORE_DEFAULTAPN); + removeDialog(DIALOG_RESTORE_DEFAULTAPN); Toast.makeText( - ApnSettings.this, + getActivity(), getResources().getString( R.string.restore_default_apn_completed), Toast.LENGTH_LONG).show(); @@ -341,20 +340,14 @@ public class ApnSettings extends PreferenceActivity implements } @Override - protected Dialog onCreateDialog(int id) { + public Dialog onCreateDialog(int id) { if (id == DIALOG_RESTORE_DEFAULTAPN) { - ProgressDialog dialog = new ProgressDialog(this); + getPreferenceScreen().setEnabled(false); + ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setMessage(getResources().getString(R.string.restore_default_apn)); dialog.setCancelable(false); return dialog; } return null; } - - @Override - protected void onPrepareDialog(int id, Dialog dialog) { - if (id == DIALOG_RESTORE_DEFAULTAPN) { - getPreferenceScreen().setEnabled(false); - } - } } |