Loading res/layout/fragment_grid_picker.xml +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/options_container" android:layout_width="match_parent" android:layout_height="@dimen/options_container_height" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"/> </LinearLayout> Loading res/values/bools.xml +1 −1 Original line number Diff line number Diff line Loading @@ -16,5 +16,5 @@ limitations under the License. --> <resources> <bool name="use_grid_for_options">false</bool> <bool name="use_grid_for_options">true</bool> </resources> No newline at end of file res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,9 @@ [CHAR LIMIT=20] --> <string name="custom_theme_previous">Previous</string> <!-- Title for "Custom theme" option. [CHAR LIMIT=15] --> <string name="custom_theme">Custom</string> <!-- Generic label for one system Style/Theme (combination of fonts/colors/icons) that is defined and customized by the user (note there could be more than one so the label includes a number, eg "Custom 1, Custom 2, etc") [CHAR LIMIT=15] --> Loading src/com/android/customization/model/theme/DefaultThemeProvider.java +4 −10 Original line number Diff line number Diff line Loading @@ -78,9 +78,6 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB private static final String THEME_TITLE_FIELD = "_theme_title"; private static final String THEME_ID_FIELD = "_theme_id"; // Maximum number of themes allowed (including default, pre-bundled and custom) private static final int MAX_TOTAL_THEMES = 10; private final OverlayThemeExtractor mOverlayProvider; private List<ThemeBundle> mThemes; private final CustomizationPreferences mCustomizationPreferences; Loading Loading @@ -109,6 +106,10 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB } private void loadAll() { // Add "Custom" option at the first. mThemes.add(new CustomTheme(CustomTheme.newId(), mContext.getString( R.string.custom_theme), new HashMap<>(), null)); addDefaultTheme(); String[] themeNames = getItemsFromStub(THEMES_ARRAY); Loading Loading @@ -321,13 +322,6 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB new HashMap<>(), null)); } } if (mThemes.size() < MAX_TOTAL_THEMES) { // Add an empty one at the end. mThemes.add(new CustomTheme(CustomTheme.newId(), mContext.getString( R.string.custom_theme_title, customThemesCount + 1), new HashMap<>(), null)); } } @Override Loading src/com/android/customization/picker/theme/ThemeFragment.java +13 −4 Original line number Diff line number Diff line Loading @@ -322,8 +322,7 @@ public class ThemeFragment extends AppbarFragment { } if (mSelectedTheme == null) { // Select the default theme if there is no matching custom enabled theme // TODO(b/124796742): default to custom if there is no matching theme bundle mSelectedTheme = options.get(0); mSelectedTheme = findDefaultThemeBundle(options); } else { // Only show show checkmark if we found a matching theme mOptionsController.setAppliedOption(mSelectedTheme); Loading Loading @@ -354,8 +353,7 @@ public class ThemeFragment extends AppbarFragment { } if (mSelectedTheme == null) { // Select the default theme if there is no matching custom enabled theme // TODO(b/124796742): default to custom if there is no matching theme bundle mSelectedTheme = options.get(0); mSelectedTheme = findDefaultThemeBundle(options); } else { // Only show show checkmark if we found a matching theme mOptionsController.setAppliedOption(mSelectedTheme); Loading @@ -364,6 +362,17 @@ public class ThemeFragment extends AppbarFragment { }, true); } private ThemeBundle findDefaultThemeBundle(List<ThemeBundle> options) { String defaultThemeTitle = getActivity().getResources().getString(R.string.default_theme_title); for (ThemeBundle bundle : options) { if (bundle.getTitle().equals(defaultThemeTitle)) { return bundle; } } return null; } private void navigateToCustomTheme(CustomTheme themeToEdit) { Intent intent = new Intent(getActivity(), CustomThemeActivity.class); intent.putExtra(CustomThemeActivity.EXTRA_THEME_TITLE, themeToEdit.getTitle()); Loading Loading
res/layout/fragment_grid_picker.xml +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/options_container" android:layout_width="match_parent" android:layout_height="@dimen/options_container_height" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"/> </LinearLayout> Loading
res/values/bools.xml +1 −1 Original line number Diff line number Diff line Loading @@ -16,5 +16,5 @@ limitations under the License. --> <resources> <bool name="use_grid_for_options">false</bool> <bool name="use_grid_for_options">true</bool> </resources> No newline at end of file
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,9 @@ [CHAR LIMIT=20] --> <string name="custom_theme_previous">Previous</string> <!-- Title for "Custom theme" option. [CHAR LIMIT=15] --> <string name="custom_theme">Custom</string> <!-- Generic label for one system Style/Theme (combination of fonts/colors/icons) that is defined and customized by the user (note there could be more than one so the label includes a number, eg "Custom 1, Custom 2, etc") [CHAR LIMIT=15] --> Loading
src/com/android/customization/model/theme/DefaultThemeProvider.java +4 −10 Original line number Diff line number Diff line Loading @@ -78,9 +78,6 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB private static final String THEME_TITLE_FIELD = "_theme_title"; private static final String THEME_ID_FIELD = "_theme_id"; // Maximum number of themes allowed (including default, pre-bundled and custom) private static final int MAX_TOTAL_THEMES = 10; private final OverlayThemeExtractor mOverlayProvider; private List<ThemeBundle> mThemes; private final CustomizationPreferences mCustomizationPreferences; Loading Loading @@ -109,6 +106,10 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB } private void loadAll() { // Add "Custom" option at the first. mThemes.add(new CustomTheme(CustomTheme.newId(), mContext.getString( R.string.custom_theme), new HashMap<>(), null)); addDefaultTheme(); String[] themeNames = getItemsFromStub(THEMES_ARRAY); Loading Loading @@ -321,13 +322,6 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB new HashMap<>(), null)); } } if (mThemes.size() < MAX_TOTAL_THEMES) { // Add an empty one at the end. mThemes.add(new CustomTheme(CustomTheme.newId(), mContext.getString( R.string.custom_theme_title, customThemesCount + 1), new HashMap<>(), null)); } } @Override Loading
src/com/android/customization/picker/theme/ThemeFragment.java +13 −4 Original line number Diff line number Diff line Loading @@ -322,8 +322,7 @@ public class ThemeFragment extends AppbarFragment { } if (mSelectedTheme == null) { // Select the default theme if there is no matching custom enabled theme // TODO(b/124796742): default to custom if there is no matching theme bundle mSelectedTheme = options.get(0); mSelectedTheme = findDefaultThemeBundle(options); } else { // Only show show checkmark if we found a matching theme mOptionsController.setAppliedOption(mSelectedTheme); Loading Loading @@ -354,8 +353,7 @@ public class ThemeFragment extends AppbarFragment { } if (mSelectedTheme == null) { // Select the default theme if there is no matching custom enabled theme // TODO(b/124796742): default to custom if there is no matching theme bundle mSelectedTheme = options.get(0); mSelectedTheme = findDefaultThemeBundle(options); } else { // Only show show checkmark if we found a matching theme mOptionsController.setAppliedOption(mSelectedTheme); Loading @@ -364,6 +362,17 @@ public class ThemeFragment extends AppbarFragment { }, true); } private ThemeBundle findDefaultThemeBundle(List<ThemeBundle> options) { String defaultThemeTitle = getActivity().getResources().getString(R.string.default_theme_title); for (ThemeBundle bundle : options) { if (bundle.getTitle().equals(defaultThemeTitle)) { return bundle; } } return null; } private void navigateToCustomTheme(CustomTheme themeToEdit) { Intent intent = new Intent(getActivity(), CustomThemeActivity.class); intent.putExtra(CustomThemeActivity.EXTRA_THEME_TITLE, themeToEdit.getTitle()); Loading