diff options
author | Amith Yamasani <yamasani@google.com> | 2010-08-18 13:59:28 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2010-08-18 22:59:33 -0700 |
commit | d79934731c8d33f6fc63b21c120b9ffba5d06f54 (patch) | |
tree | 2edb1cb461f5933faf26bdffc5522d9e00f9b808 /src/com/android/settings/PrivacySettings.java | |
parent | 3a9cf0363618bfadeaa5df2460fa615922bd8c75 (diff) | |
download | packages_apps_settings-d79934731c8d33f6fc63b21c120b9ffba5d06f54.zip packages_apps_settings-d79934731c8d33f6fc63b21c120b9ffba5d06f54.tar.gz packages_apps_settings-d79934731c8d33f6fc63b21c120b9ffba5d06f54.tar.bz2 |
Refactor settings top level activities to use fragments.
Added a base class SettingsPreferenceFragment from which the settings activities should
be derived so that they can behave like fragments. It contains some commonly called
utility methods and dialog conversion to DialogFragment.
Some of the top-level activities can be launched directly without the left pane.
Settings.java acts as a proxy activity that contains just that settings fragment without
the left pane.
There are still a lot of second and third level activities that need to be fragmentized.
This is just the first pass to test the 2-pane layout.
Diffstat (limited to 'src/com/android/settings/PrivacySettings.java')
-rw-r--r-- | src/com/android/settings/PrivacySettings.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java index 29deacf..826c9cf 100644 --- a/src/com/android/settings/PrivacySettings.java +++ b/src/com/android/settings/PrivacySettings.java @@ -22,23 +22,18 @@ import android.app.backup.IBackupManager; import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; -import android.content.SharedPreferences; -import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.preference.CheckBoxPreference; import android.preference.Preference; -import android.preference.PreferenceActivity; import android.preference.PreferenceScreen; import android.provider.Settings; -import android.text.method.LinkMovementMethod; -import android.widget.TextView; /** * Gesture lock pattern settings. */ -public class PrivacySettings extends PreferenceActivity implements +public class PrivacySettings extends SettingsPreferenceFragment implements DialogInterface.OnClickListener { // Vendor specific @@ -54,7 +49,7 @@ public class PrivacySettings extends PreferenceActivity implements private int mDialogType; @Override - protected void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.privacy_settings); final PreferenceScreen screen = getPreferenceScreen(); @@ -63,7 +58,8 @@ public class PrivacySettings extends PreferenceActivity implements mAutoRestore = (CheckBoxPreference) screen.findPreference(AUTO_RESTORE); // Vendor specific - if (getPackageManager().resolveContentProvider(GSETTINGS_PROVIDER, 0) == null) { + if (getActivity().getPackageManager(). + resolveContentProvider(GSETTINGS_PROVIDER, 0) == null) { screen.removePreference(findPreference(BACKUP_CATEGORY)); } updateToggles(); @@ -110,7 +106,8 @@ public class PrivacySettings extends PreferenceActivity implements mDialogType = DIALOG_ERASE_BACKUP; CharSequence msg = getResources().getText(R.string.backup_erase_dialog_message); - mConfirmDialog = new AlertDialog.Builder(this).setMessage(msg) + // TODO: DialogFragment? + mConfirmDialog = new AlertDialog.Builder(getActivity()).setMessage(msg) .setTitle(R.string.backup_erase_dialog_title) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.ok, this) |