am fed62611: am c534638b: Disable notification prefs until folder prefs are loaded.

* commit 'fed62611c144a32a0a59e752757ac9597e4b3228':
  Disable notification prefs until folder prefs are loaded.
This commit is contained in:
Yu Ping Hu 2013-03-27 17:48:25 -07:00 committed by Android Git Automerger
commit 7aa8da86e4
2 changed files with 10 additions and 5 deletions

View File

@ -89,7 +89,9 @@
</PreferenceCategory>
<!-- This category is enabled after the folder preferences are loaded -->
<PreferenceCategory
android:enabled="false"
android:key="account_notifications"
android:title="@string/account_settings_notifications">

View File

@ -116,6 +116,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
private CheckBoxPreference mInboxNotify;
private CheckBoxPreference mInboxVibrate;
private Preference mInboxRingtone;
private PreferenceCategory mNotificationsCategory;
private CheckBoxPreference mSyncContacts;
private CheckBoxPreference mSyncCalendar;
private CheckBoxPreference mSyncEmail;
@ -563,11 +564,12 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
public void run() {
mInboxNotify.setChecked(
mInboxFolderPreferences.areNotificationsEnabled());
mInboxVibrate.setChecked(
mInboxFolderPreferences.isNotificationVibrateEnabled());
setRingtoneSummary();
// Notification preferences must be disabled until after
// mInboxFolderPreferences is available, so enable them here.
mNotificationsCategory.setEnabled(true);
}
});
}
@ -699,6 +701,9 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
}
});
mNotificationsCategory =
(PreferenceCategory) findPreference(PREFERENCE_CATEGORY_NOTIFICATIONS);
// Set the vibrator value, or hide it on devices w/o a vibrator
mInboxVibrate = (CheckBoxPreference) findPreference(
FolderPreferences.PreferenceKeys.NOTIFICATION_VIBRATE);
@ -710,9 +715,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
mInboxVibrate.setOnPreferenceChangeListener(this);
} else {
// No vibrator present. Remove the preference altogether.
PreferenceCategory notificationsCategory = (PreferenceCategory)
findPreference(PREFERENCE_CATEGORY_NOTIFICATIONS);
notificationsCategory.removePreference(mInboxVibrate);
mNotificationsCategory.removePreference(mInboxVibrate);
}
final Preference retryAccount = findPreference(PREFERENCE_POLICIES_RETRY_ACCOUNT);