Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit feb02d4b authored by Santiago Etchebehere's avatar Santiago Etchebehere
Browse files

Limit the maximum number of themes

We don't want more than 10 in total.
Also increment the space between the options to make sure
the last one is cut to hint scrolling.

Bug: 133903562
Change-Id: Ic81de761f0e80a67e69337ee68e9e73ece7d0aa4
parent 53794c88
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@
    <dimen name="theme_option_font_text_size">16dp</dimen>
    <dimen name="theme_option_title_font_text_size">12sp</dimen>

    <dimen name="option_tile_margin_horizontal">2dp</dimen>
    <dimen name="option_tile_margin_horizontal">6dp</dimen>
    <dimen name="theme_option_label_margin">4dp</dimen>

    <dimen name="preview_card_padding">20dp</dimen>
+8 −3
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@ 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;
@@ -403,9 +406,11 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB
            }
        }

        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));
        }

    }