summaryrefslogtreecommitdiff
path: root/src/com/android/customization/picker/theme
diff options
context:
space:
mode:
authorchihhangchuang <chihhangchuang@google.com>2020-05-29 23:56:32 +0800
committerchihhangchuang <chihhangchuang@google.com>2020-06-01 16:50:26 +0800
commita78c7a89904ec3608351f76e2700b99d0e95bbfe (patch)
treea68073c71469026b274a0a1a95a987d88a5e4201 /src/com/android/customization/picker/theme
parentc4d30d641a9f7312078a300e42cb18ef9678dff5 (diff)
downloadThemePicker-a78c7a89904ec3608351f76e2700b99d0e95bbfe.tar.gz
Add onSaveInstanceState support for GridPicker
Before: https://drive.google.com/file/d/1BeiF2qZiGCNnA4XhXRdAJz_0H54qJdVb/view?usp=sharing After: https://drive.google.com/file/d/1F1YCoLtLrmG4CH2WPY6lJ0ZbdY1Z7AWc/view?usp=sharing Test: Manually Fixes: 157734889 Change-Id: Iee93f058fadd7891536cf0d5e745261a31778470
Diffstat (limited to 'src/com/android/customization/picker/theme')
-rw-r--r--src/com/android/customization/picker/theme/ThemeFragment.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 61f19494..64147b2a 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -68,6 +68,8 @@ public class ThemeFragment extends AppbarFragment {
private static final String TAG = "ThemeFragment";
private static final String KEY_SELECTED_THEME = "ThemeFragment.SelectedThemeBundle";
+ private static final String KEY_STATE_BOTTOM_ACTION_BAR_VISIBILITY =
+ "ThemeFragment.bottomActionBarVisibility";
private static final int FULL_PREVIEW_REQUEST_CODE = 1000;
/**
@@ -220,6 +222,10 @@ public class ThemeFragment extends AppbarFragment {
if (mSelectedTheme != null && !mSelectedTheme.isActive(mThemeManager)) {
outState.putString(KEY_SELECTED_THEME, mSelectedTheme.getSerializedPackages());
}
+ if (mBottomActionBar != null) {
+ outState.putBoolean(KEY_STATE_BOTTOM_ACTION_BAR_VISIBILITY,
+ mBottomActionBar.isVisible());
+ }
}
@Override
@@ -316,10 +322,11 @@ public class ThemeFragment extends AppbarFragment {
mSelectedTheme = findDefaultThemeBundle(options);
}
mOptionsController.setSelectedOption(mSelectedTheme);
- // Set selected option above will show BottomActionBar when entering the tab. But
- // it should not show when entering the tab. But it's visible for previously
- // selected theme.
- if (mSelectedTheme != previouslySelectedTheme) {
+ boolean bottomActionBarVisibility = savedInstanceState != null
+ && savedInstanceState.getBoolean(KEY_STATE_BOTTOM_ACTION_BAR_VISIBILITY);
+ if (bottomActionBarVisibility) {
+ mBottomActionBar.show();
+ } else {
mBottomActionBar.hide();
}
}