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

Commit 092a56de authored by Richard MacGregor's avatar Richard MacGregor Committed by Clark Scheff
Browse files

[1/3] Implement better legacy support for themes

Switch back to consistent naming of variables for preview columns in themes contract.

Change-Id: I9edfb219098a5ab7109c5d79995602edd77f3658
parent 912b01ed
Loading
Loading
Loading
Loading
+75 −106
Original line number Diff line number Diff line
@@ -467,7 +467,7 @@ public class ThemesContract {
        public static final String COMPONENT_ID = "component_id";

        /**
         * The unique key for a row. See the KEY_* constants
         * The unique key for a row. See the Valid key constants section below
         * for valid examples
         * <P>Type: TEXT</P>
         */
@@ -482,210 +482,179 @@ public class ThemesContract {
        /**
         * Valid keys
         */
        public static final String KEY_STATUSBAR_BACKGROUND = "statusbar_background";
        public static final String KEY_STATUSBAR_BLUETOOTH_ICON = "statusbar_bluetooth_icon";
        public static final String KEY_STATUSBAR_WIFI_ICON = "statusbar_wifi_icon";
        public static final String KEY_STATUSBAR_SIGNAL_ICON = "statusbar_signal_icon";
        public static final String KEY_STATUSBAR_BATTERY_PORTRAIT = "statusbar_battery_portrait";
        public static final String KEY_STATUSBAR_BATTERY_LANDSCAPE = "statusbar_battery_landscape";
        public static final String KEY_STATUSBAR_BATTERY_CIRCLE = "statusbar_battery_circle";
        public static final String KEY_STATUSBAR_CLOCK_TEXT_COLOR = "statusbar_clock_text_color";
        public static final String KEY_STATUSBAR_WIFI_COMBO_MARGIN_END =
                "statusbar_wifi_combo_margin_end";
        public static final String KEY_NAVBAR_BACKGROUND = "navbar_background";
        public static final String KEY_NAVBAR_BACK_BUTTON = "navbar_back_button";
        public static final String KEY_NAVBAR_HOME_BUTTON = "navbar_home_button";
        public static final String KEY_NAVBAR_RECENT_BUTTON = "navbar_recent_button";
        public static final String KEY_ICON_PREVIEW_1 = "icon_preview_1";
        public static final String KEY_ICON_PREVIEW_2 = "icon_preview_2";
        public static final String KEY_ICON_PREVIEW_3 = "icon_preview_3";
        // KEY_WALLPAPER_FULL - path to the full-sized image in the theme assets directory
        public static final String KEY_WALLPAPER_FULL = "wallpaper_full";
        // KEY_WALLPAPER_PREVIEW - scaled and cropped version of the full size wallpaper
        public static final String KEY_WALLPAPER_PREVIEW = "wallpaper_preview";
        // KEY_WALLPAPER_THUMBNAIL - scaled version of the preview size wallpaper
        public static final String KEY_WALLPAPER_THUMBNAIL = "wallpaper_thumbnail";
        // KEY_LOCK_WALLPAPER_PREVIEW - scaled and cropped version of the full size wallpaper
        public static final String KEY_LOCK_WALLPAPER_PREVIEW = "lock_wallpaper_preview";
        // KEY_LOCK_WALLPAPER_THUMBNAIL - scaled version of the preview size wallpaper
        public static final String KEY_LOCK_WALLPAPER_THUMBNAIL = "lock_wallpaper_thumbnail";
        public static final String KEY_STYLE_PREVIEW = "style_preview";
        public static final String KEY_STYLE_THUMBNAIL = "style_thumbnail";
        public static final String KEY_BOOTANIMATION_THUMBNAIL = "bootanimation_thumbnail";
    }

    /**
     * The following is being depricated in version 15. Only present for build compatibility.
     * Table containing cached preview blobs for a given theme
     */
    public static class LegacyPreviewColumns {
        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "previews");

        /**
         * Uri for retrieving the previews for the currently applied components.
         * Querying the themes provider using this URI will return a cursor with a single row
         * containing all the previews for the components that are currently applied.
         */
        public static final Uri APPLIED_URI = Uri.withAppendedPath(AUTHORITY_URI,
                "applied_previews");

        /**
         * The unique ID for a row.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String _ID = "_id";

        /**
         * The unique ID for the theme these previews belong to.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String THEME_ID = "theme_id";

        /**
         * Cached image of the themed status bar background.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_BACKGROUND = "statusbar_background";

        /**
         * Cached image of the themed bluetooth status icon.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_BLUETOOTH_ICON = "statusbar_bluetooth_icon";

        /**
         * Cached image of the themed wifi status icon.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_WIFI_ICON = "statusbar_wifi_icon";

        /**
         * Cached image of the themed cellular signal status icon.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_SIGNAL_ICON = "statusbar_signal_icon";

        /**
         * Cached image of the themed battery using portrait style.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_BATTERY_PORTRAIT = "statusbar_battery_portrait";

        /**
         * Cached image of the themed battery using landscape style.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_BATTERY_LANDSCAPE = "statusbar_battery_landscape";

        /**
         * Cached image of the themed battery using circle style.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String STATUSBAR_BATTERY_CIRCLE = "statusbar_battery_circle";

        /**
         * The themed margin value between the wifi and rssi signal icons.
         * The themed color used for clock text in the status bar.
         * <P>Type: INTEGER (int)</P>
         */
        public static final String STATUSBAR_WIFI_COMBO_MARGIN_END = "wifi_combo_margin_end";
        public static final String STATUSBAR_CLOCK_TEXT_COLOR = "statusbar_clock_text_color";

        /**
         * The themed color used for clock text in the status bar.
         * The themed margin value between the wifi and rssi signal icons.
         * <P>Type: INTEGER (int)</P>
         */
        public static final String STATUSBAR_CLOCK_TEXT_COLOR = "statusbar_clock_text_color";
        public static final String STATUSBAR_WIFI_COMBO_MARGIN_END = "wifi_combo_margin_end";

        /**
         * Cached image of the themed navigation bar background.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String NAVBAR_BACKGROUND = "navbar_background";

        /**
         * Cached image of the themed back button.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String NAVBAR_BACK_BUTTON = "navbar_back_button";

        /**
         * Cached image of the themed home button.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String NAVBAR_HOME_BUTTON = "navbar_home_button";

        /**
         * Cached image of the themed recents button.
         * <P>Type: BLOB (bitmap)</P>
         * <P>Type: String (file path)</P>
         */
        public static final String NAVBAR_RECENT_BUTTON = "navbar_recent_button";

        /**
         * Cached image of the 1/4 icons
         * <P>Type: BLOB (bitmap)</P>
         * Cached image of the 1/3 icons
         * <P>Type: String (file path)</P>
         */
        public static final String ICON_PREVIEW_1 = "icon_preview_1";

        /**
         * Cached image of the 2/4 icons
         * <P>Type: BLOB (bitmap)</P>
         * Cached image of the 2/3 icons
         * <P>Type: String (file path)</P>
         */
        public static final String ICON_PREVIEW_2 = "icon_preview_2";

        /**
         * Cached image of the 3/4 icons
         * <P>Type: BLOB (bitmap)</P>
         * Cached image of the 3/3 icons
         * <P>Type: String (file path)</P>
         */
        public static final String ICON_PREVIEW_3 = "icon_preview_3";

        /**
         * Cached image of the 4/4 icons
         * <P>Type: BLOB (bitmap)</P>
         * Full path to the theme's wallpaper asset.
         * <P>Type: String (file path)</P>
         */
        public static final String ICON_PREVIEW_4 = "icon_preview_4";
        public static final String WALLPAPER_FULL = "wallpaper_full";

        /**
         * Cached preview of UI controls representing the theme's style
         * <P>Type: BLOB (bitmap)</P>
         * Cached preview of the theme's wallpaper which is larger than the thumbnail
         * but smaller than the full sized wallpaper.
         * <P>Type: String (file path)</P>
         */
        public static final String STYLE_PREVIEW = "style_preview";
        public static final String WALLPAPER_PREVIEW = "wallpaper_preview";

        /**
         * Cached thumbnail preview of UI controls representing the theme's style
         * <P>Type: BLOB (bitmap)</P>
         * Cached thumbnail of the theme's wallpaper
         * <P>Type: String (file path)</P>
         */
        public static final String STYLE_THUMBNAIL = "style_thumbnail";
        public static final String WALLPAPER_THUMBNAIL = "wallpaper_thumbnail";

        /**
         * Cached thumbnail of the theme's boot animation
         * <P>Type: BLOB (bitmap)</P>
         * Cached preview of the theme's lockscreen  wallpaper which is larger than the thumbnail
         * but smaller than the full sized lockscreen wallpaper.
         * <P>Type: String (file path)</P>
         */
        public static final String BOOTANIMATION_THUMBNAIL = "bootanimation_thumbnail";
        public static final String LOCK_WALLPAPER_PREVIEW = "lock_wallpaper_preview";

        /**
         * Cached thumbnail of the theme's wallpaper
         * <P>Type: BLOB (bitmap)</P>
         * Cached thumbnail of the theme's lockscreen wallpaper
         * <P>Type: String (file path)</P>
         */
        public static final String WALLPAPER_THUMBNAIL = "wallpaper_thumbnail";
        public static final String LOCK_WALLPAPER_THUMBNAIL = "lock_wallpaper_thumbnail";

        /**
         * Cached preview of the theme's wallpaper which is larger than the thumbnail
         * but smaller than the full sized wallpaper.
         * <P>Type: BLOB (bitmap)</P>
         * Cached preview of UI controls representing the theme's style
         * <P>Type: String (file path)</P>
         */
        public static final String WALLPAPER_PREVIEW = "wallpaper_preview";
        public static final String STYLE_PREVIEW = "style_preview";

        /**
         * Cached thumbnail of the theme's lockscreen wallpaper
         * <P>Type: BLOB (bitmap)</P>
         * Cached thumbnail preview of UI controls representing the theme's style
         * <P>Type: String (file path)</P>
         */
        public static final String LOCK_WALLPAPER_THUMBNAIL = "lock_wallpaper_thumbnail";
        public static final String STYLE_THUMBNAIL = "style_thumbnail";

        /**
         * Cached preview of the theme's lockscreen  wallpaper which is larger than the thumbnail
         * but smaller than the full sized lockscreen wallpaper.
         * <P>Type: BLOB (bitmap)</P>
         * Cached thumbnail of the theme's boot animation
         * <P>Type: String (file path)</P>
         */
        public static final String LOCK_WALLPAPER_PREVIEW = "lock_wallpaper_preview";
        public static final String BOOTANIMATION_THUMBNAIL = "bootanimation_thumbnail";

        public static final String[] VALID_KEYS = {
            STATUSBAR_BACKGROUND,
            STATUSBAR_BLUETOOTH_ICON,
            STATUSBAR_WIFI_ICON,
            STATUSBAR_SIGNAL_ICON,
            STATUSBAR_BATTERY_PORTRAIT,
            STATUSBAR_BATTERY_LANDSCAPE,
            STATUSBAR_BATTERY_CIRCLE,
            STATUSBAR_CLOCK_TEXT_COLOR,
            STATUSBAR_WIFI_COMBO_MARGIN_END,
            NAVBAR_BACKGROUND,
            NAVBAR_BACK_BUTTON,
            NAVBAR_HOME_BUTTON,
            NAVBAR_RECENT_BUTTON,
            ICON_PREVIEW_1,
            ICON_PREVIEW_2,
            ICON_PREVIEW_3,
            WALLPAPER_FULL,
            WALLPAPER_PREVIEW,
            WALLPAPER_THUMBNAIL,
            LOCK_WALLPAPER_PREVIEW,
            LOCK_WALLPAPER_THUMBNAIL,
            STYLE_PREVIEW,
            STYLE_THUMBNAIL,
            BOOTANIMATION_THUMBNAIL,
        };
    }

    public static class Intent {