diff options
author | Luis Vidal <lvidal@cyngn.com> | 2016-02-05 16:30:29 -0800 |
---|---|---|
committer | Luis Vidal <lvidal@cyngn.com> | 2016-02-05 18:39:01 -0800 |
commit | 8884b35c3bf762e721f3f7fec8f699b26b4c54f3 (patch) | |
tree | 869f592f69a54c06d6e3fc6a7c6003d78efb6ef9 /src | |
parent | 4028c36068d4d9dac12b989e937e5ad3486a1bd3 (diff) | |
download | packages_apps_ThemeChooser-8884b35c3bf762e721f3f7fec8f699b26b4c54f3.zip packages_apps_ThemeChooser-8884b35c3bf762e721f3f7fec8f699b26b4c54f3.tar.gz packages_apps_ThemeChooser-8884b35c3bf762e721f3f7fec8f699b26b4c54f3.tar.bz2 |
Restore the selected components in the chooser
If the user makes a chance to the currently applied theme, but then
it abandons the change, the map that contains the currently selected
components is wiped out. This patch will restore the map to its original
state so all the currently selected components are properly highlighted
in the component cards if the user decides to go back and make changes
to the currently applied theme
Change-Id: Ia7f38491ce9b2c2f7cae7dae8cf1f5d241391096
TICKET: OPO-467
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyngn/theme/chooser/MyThemeFragment.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/com/cyngn/theme/chooser/MyThemeFragment.java b/src/com/cyngn/theme/chooser/MyThemeFragment.java index 1171236..f9292d0 100644 --- a/src/com/cyngn/theme/chooser/MyThemeFragment.java +++ b/src/com/cyngn/theme/chooser/MyThemeFragment.java @@ -360,11 +360,18 @@ public class MyThemeFragment extends ThemeFragment { super.onLoadFinished(loader, c); // if the theme is resetting, we need to apply these changes now that the supported // theme components have been properly set. - if (mThemeResetting && loader.getId() == LOADER_ID_ALL) { - applyTheme(); - } else if (loader.getId() == LOADER_ID_ALL && mApplyThemeOnPopulated) { - loadComponentsToApply(); - applyTheme(); + if (loader.getId() == LOADER_ID_ALL) { + if (mThemeResetting) { + applyTheme(); + } else if (mApplyThemeOnPopulated) { + loadComponentsToApply(); + applyTheme(); + } else if (mSelectedComponentsMap.size() == 0) { + //Re-populates selected components with current theme. Why? + //We got here because the cursor was reloaded after the user pressed back and no + //changes were applied, causing the selected components map to be wiped out + mSelectedComponentsMap.putAll(mCurrentTheme); + } } } |