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

Commit 5c636b04 authored by Sergey Ten's avatar Sergey Ten Committed by Josh Guilfoyle
Browse files

Add support for wallpaper and color palette thumbnails.

parent 574c7056
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -141,6 +141,22 @@ public class BaseThemeInfo implements Parcelable {
     */
    public String soundPackName;

    /**
     * The name of a wallpaper thumbnail asset.
     *
     * @see wallpaperPreview attribute
     *
     */
    public String wallpaperThumbnailName;

    /**
     * The name of a color palette thumbnail asset.
     *
     * @see colorPalettePreview attribute
     *
     */
    public String colorPaletteThumbnailName;


    private static final String LOCKED_NAME = "locked/";

@@ -182,6 +198,8 @@ public class BaseThemeInfo implements Parcelable {
        dest.writeString(copyright);
        dest.writeInt(isDrmProtected? 1 : 0);
        dest.writeString(soundPackName);
        dest.writeString(wallpaperThumbnailName);
        dest.writeString(colorPaletteThumbnailName);
    }

    protected BaseThemeInfo() {
@@ -203,6 +221,8 @@ public class BaseThemeInfo implements Parcelable {
        copyright = source.readString();
        isDrmProtected = (source.readInt() != 0);
        soundPackName = source.readString();
        wallpaperThumbnailName = source.readString();
        colorPaletteThumbnailName = source.readString();
    }

    protected void changeDrmFlagIfNeeded(String resourcePath) {
+22 −0
Original line number Diff line number Diff line
@@ -149,6 +149,18 @@ public final class ThemeInfo extends BaseThemeInfo {
     */
    private static final int THEME_HAS_COLOR_PALETTE_INDEX = 15;

    /**
     * {@link #parentThemePackageName}
     *
     */
    private static final int WALLPAPER_THUMBNAIL_INDEX = 16;

    /**
     * {@link #parentThemePackageName}
     *
     */
    private static final int COLORPALETTE_THUMBNAIL_INDEX = 17;


    private static final String [] compulsoryAttributes = new String [] {
        "name",
@@ -170,6 +182,8 @@ public final class ThemeInfo extends BaseThemeInfo {
        "parentThemeId",
        "parentThemePackageName",
        "hasColorPalette",
        "wallpaperPreview",
        "colorPalettePreview",
    };

    private static Map<String, Integer> attributesLookupTable;
@@ -281,6 +295,14 @@ public final class ThemeInfo extends BaseThemeInfo {
                    case THEME_HAS_COLOR_PALETTE_INDEX:
                        hasColorPalette = attrs.getAttributeValue(i).equalsIgnoreCase("true");
                        break;

                    case WALLPAPER_THUMBNAIL_INDEX:
                        wallpaperThumbnailName = attrs.getAttributeValue(i);
                        break;

                    case COLORPALETTE_THUMBNAIL_INDEX:
                        colorPaletteThumbnailName = attrs.getAttributeValue(i);
                        break;
                }
            }
        }