diff options
author | Amith Yamasani <yamasani@google.com> | 2011-11-14 15:15:38 -0800 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2011-11-15 12:43:59 -0800 |
commit | 6b7cf2577623e061439ce7050f885a92167c2304 (patch) | |
tree | afa0e22d24c487cca1e86da1a1f2310cdedcbd4c /src | |
parent | 4b94e073854b72205f12ff268211a51d634fbc8f (diff) | |
download | packages_apps_Settings-6b7cf2577623e061439ce7050f885a92167c2304.tar.gz packages_apps_Settings-6b7cf2577623e061439ce7050f885a92167c2304.tar.bz2 packages_apps_Settings-6b7cf2577623e061439ce7050f885a92167c2304.zip |
Kill the Switch on top-right after exiting Accounts & sync.
Bug: 5564377 - Bluetooth screen showing a Switch that doesn't follow
the bluetooth setting.
This seems to have been the Switch in Accounts & sync being set as a
custom view for the Settings activity and not removed on changing
fragments.
Change-Id: I4575a769fbf5482048dbc4e912c6b6f782f505a0
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/accounts/ManageAccountsSettings.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java index 1396e0396..0177491bf 100644 --- a/src/com/android/settings/accounts/ManageAccountsSettings.java +++ b/src/com/android/settings/accounts/ManageAccountsSettings.java @@ -74,7 +74,14 @@ public class ManageAccountsSettings extends AccountPreferenceBase @Override public void onStart() { super.onStart(); - AccountManager.get(getActivity()).addOnAccountsUpdatedListener(this, null, true); + Activity activity = getActivity(); + AccountManager.get(activity).addOnAccountsUpdatedListener(this, null, true); + activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, + ActionBar.DISPLAY_SHOW_CUSTOM); + activity.getActionBar().setCustomView(mAutoSyncSwitch, new ActionBar.LayoutParams( + ActionBar.LayoutParams.WRAP_CONTENT, + ActionBar.LayoutParams.WRAP_CONTENT, + Gravity.CENTER_VERTICAL | Gravity.RIGHT)); } @Override @@ -100,12 +107,6 @@ public class ManageAccountsSettings extends AccountPreferenceBase final int padding = activity.getResources().getDimensionPixelSize( R.dimen.action_bar_switch_padding); mAutoSyncSwitch.setPadding(0, 0, padding, 0); - activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, - ActionBar.DISPLAY_SHOW_CUSTOM); - activity.getActionBar().setCustomView(mAutoSyncSwitch, new ActionBar.LayoutParams( - ActionBar.LayoutParams.WRAP_CONTENT, - ActionBar.LayoutParams.WRAP_CONTENT, - Gravity.CENTER_VERTICAL | Gravity.RIGHT)); mAutoSyncSwitch.setChecked(ContentResolver.getMasterSyncAutomatically()); mAutoSyncSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -123,7 +124,10 @@ public class ManageAccountsSettings extends AccountPreferenceBase @Override public void onStop() { super.onStop(); - AccountManager.get(getActivity()).removeOnAccountsUpdatedListener(this); + final Activity activity = getActivity(); + AccountManager.get(activity).removeOnAccountsUpdatedListener(this); + activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM); + activity.getActionBar().setCustomView(null); } @Override |