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

Commit 5ac371b2 authored by Amin Shaikh's avatar Amin Shaikh
Browse files

Fix crash and hide Custom button

Will show Custom button and default to Custom select when the feature is
fully functional.

Bug: 124786795
Fixes: 126392573
Test: change theme in dev settings; ensure wallpaper app start
Change-Id: I84a2e6725beea94f7c9735d45e6fc07e4cc64a63
parent 381f91ed
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ import java.util.function.Consumer;
public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeBundleProvider {

    private static final String TAG = "DefaultThemeProvider";
    // TODO(b/124796742): remove once custom theme picker is ready to merge
    private static final boolean SHOW_CUSTOM_THEME_OPTION = false;

    private static final String THEMES_ARRAY = "themes";
    private static final String TITLE_PREFIX = "theme_title_";
@@ -227,8 +229,11 @@ public class DefaultThemeProvider extends ResourcesApkProvider implements ThemeB
                        e);
            }
        }

        if (SHOW_CUSTOM_THEME_OPTION) {
            addCustomTheme();
        }
    }

    /**
     * Default theme requires different treatment: if there are overlay packages specified in the
+5 −2
Original line number Diff line number Diff line
@@ -182,7 +182,6 @@ public class ThemeFragment extends ToolbarFragment {
    private void setUpOptions(@Nullable Bundle savedInstanceState) {
        mThemeManager.fetchOptions(options -> {
            mOptionsController = new OptionSelectorController(mOptionsContainer, options);

            mOptionsController.addListener(selected -> {
                if (selected instanceof CustomTheme && !((CustomTheme) selected).isDefined()) {
                    navigateToCustomTheme();
@@ -195,7 +194,6 @@ public class ThemeFragment extends ToolbarFragment {
            mOptionsController.initOptions(mThemeManager);
            String previouslySelected = savedInstanceState != null
                    ? savedInstanceState.getString(KEY_SELECTED_THEME) : null;

            for (ThemeBundle theme : options) {
                if (previouslySelected != null
                        && previouslySelected.equals(theme.getSerializedPackages())) {
@@ -205,6 +203,11 @@ public class ThemeFragment extends ToolbarFragment {
                    break;
                }
            }
            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);
            }
            mOptionsController.setSelectedOption(mSelectedTheme);
        });
        createAdapter();