summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2011-01-13 11:01:15 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-13 11:01:15 -0800
commitd4f337dcdff1720679cd2b8ae077bdd1604e7b00 (patch)
tree7ab1bc10c585a83f558838da69fb7bf6bcac3b50 /src
parent2a7520567058444bd1e22b601eae3f92b9929455 (diff)
parent70bc797a926abdf14bc0d34d9b49a066663fbca7 (diff)
downloadpackages_apps_Settings-d4f337dcdff1720679cd2b8ae077bdd1604e7b00.zip
packages_apps_Settings-d4f337dcdff1720679cd2b8ae077bdd1604e7b00.tar.gz
packages_apps_Settings-d4f337dcdff1720679cd2b8ae077bdd1604e7b00.tar.bz2
Merge "Fix bug #2987804 (Provide a better UI for selecting the Backup account)" into honeycomb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/PrivacySettings.java39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 9ada710..28dc93a 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -50,7 +50,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
private PreferenceScreen mConfigure;
private static final int DIALOG_ERASE_BACKUP = 2;
- private int mDialogType;
+ private int mDialogType;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -74,6 +74,14 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
}
@Override
+ public void onResume() {
+ super.onResume();
+
+ // Refresh UI
+ updateToggles();
+ }
+
+ @Override
public void onStop() {
if (mConfirmDialog != null && mConfirmDialog.isShowing()) {
mConfirmDialog.dismiss();
@@ -105,7 +113,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
}
}
}
-
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
@@ -147,25 +154,36 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
Settings.Secure.BACKUP_AUTO_RESTORE, 1) == 1);
mAutoRestore.setEnabled(backupEnabled);
- mConfigure.setEnabled(configIntent != null);
+ final boolean configureEnabled = (configIntent != null) && backupEnabled;
+ mConfigure.setEnabled(configureEnabled);
mConfigure.setIntent(configIntent);
- if (configSummary != null) {
- mConfigure.setSummary(configSummary);
+ setConfigureSummary(configSummary);
+ }
+
+ private void setConfigureSummary(String summary) {
+ if (summary != null) {
+ mConfigure.setSummary(summary);
} else {
mConfigure.setSummary(R.string.backup_configure_account_default_summary);
}
}
+ private void updateConfigureSummary() {
+ try {
+ String transport = mBackupManager.getCurrentTransport();
+ String summary = mBackupManager.getDestinationString(transport);
+ setConfigureSummary(summary);
+ } catch (RemoteException e) {
+ // Not much we can do here
+ }
+ }
+
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
//updateProviders();
if (mDialogType == DIALOG_ERASE_BACKUP) {
setBackupEnabled(false);
- }
- } else {
- if (mDialogType == DIALOG_ERASE_BACKUP) {
- mBackup.setChecked(true);
- mAutoRestore.setEnabled(true);
+ updateConfigureSummary();
}
}
mDialogType = 0;
@@ -188,5 +206,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
}
mBackup.setChecked(enable);
mAutoRestore.setEnabled(enable);
+ mConfigure.setEnabled(enable);
}
}