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

Commit b05638a4 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Android (Google) Code Review
Browse files

Merge "Store an empty theme object on first visit" into ub-launcher3-qt-dev

parents 6089bd59 4ca222f6
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY
import android.graphics.Point;
import android.provider.Settings;

import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;

@@ -41,6 +42,7 @@ import com.android.wallpaper.module.WallpaperPersister.SetWallpaperCallback;
import com.android.wallpaper.module.WallpaperSetter;
import com.android.wallpaper.picker.SetWallpaperDialogFragment.Listener;
import com.android.wallpaper.util.WallpaperCropUtils;
import org.json.JSONObject;

import java.util.HashSet;
import java.util.Map;
@@ -210,4 +212,17 @@ public class ThemeManager implements CustomizationManager<ThemeBundle> {
    public ThemeBundle findThemeByPackages(ThemeBundle other) {
        return mProvider.findEquivalent(other);
    }

    /**
     * Store empty theme if no theme has been set yet. This will prevent Settings from showing the
     * suggestion to select a theme
     */
    public void storeEmptyTheme() {
        String themeSetting = Settings.Secure.getString(mActivity.getContentResolver(),
                ResourceConstants.THEME_SETTING);
        if (TextUtils.isEmpty(themeSetting)) {
            Settings.Secure.putString(mActivity.getContentResolver(),
                    ResourceConstants.THEME_SETTING, new JSONObject().toString());
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -228,6 +228,10 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
            if (!prefs.getTabVisited(name)) {
                prefs.setTabVisited(name);
                hideTipDot(item);

                if (id == R.id.nav_theme) {
                    getThemeManager().storeEmptyTheme();
                }
            }
            return true;
        });