summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-07-23 17:25:28 (GMT)
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-08-06 22:25:03 (GMT)
commit81400f76c9a82592f487a6d5987df2ef5dd8fa35 (patch)
treed28d138213746c156c59958b3cb6d910a8b27e1f /src
parenteccabad6119b744d4aa0d34020d621f0dca403f5 (diff)
downloadandroid_packages_providers_ThemesProvider-81400f76c9a82592f487a6d5987df2ef5dd8fa35.zip
android_packages_providers_ThemesProvider-81400f76c9a82592f487a6d5987df2ef5dd8fa35.tar.gz
android_packages_providers_ThemesProvider-81400f76c9a82592f487a6d5987df2ef5dd8fa35.tar.bz2
Properly account for lock wallpaper previews
Previews for themes with both regular wallpaper and lock screen wallpapers were being incorrectly generated such that the lock screen wallpaper was showing up for both. Change-Id: If9838cd000a9555364b645e063f17bac543b6dd2
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java b/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java
index 894d710..e204640 100644
--- a/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java
+++ b/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java
@@ -23,9 +23,9 @@ import android.content.res.AssetManager;
import android.content.res.Resources;
import android.content.res.ThemeConfig;
import android.graphics.Bitmap;
-
-import android.provider.ThemesContract;
+import android.provider.ThemesContract.PreviewColumns;
import android.text.TextUtils;
+
import org.cyanogenmod.themes.provider.R;
import java.io.File;
@@ -63,7 +63,7 @@ public class WallpaperPreviewGenerator {
}
preview = BitmapUtils.decodeResource(res,
com.android.internal.R.drawable.default_wallpaper, mPreviewSize, mPreviewSize);
- item = createWallpaperItems(0, baseDir, null, pkgName, preview);
+ item = createWallpaperItems(0, baseDir, null, pkgName, preview, false);
if (item != null) {
items.wallpapers.add(item);
items.lockscreen = item;
@@ -82,7 +82,7 @@ public class WallpaperPreviewGenerator {
}
preview = BitmapUtils.getBitmapFromAsset(themeContext, path,
mPreviewSize, mPreviewSize);
- item = createWallpaperItems(id, baseDir, path, pkgName, preview);
+ item = createWallpaperItems(id, baseDir, path, pkgName, preview, false);
if (item != null) {
items.wallpapers.add(item);
id++;
@@ -97,14 +97,14 @@ public class WallpaperPreviewGenerator {
}
preview = BitmapUtils.getBitmapFromAsset(themeContext, path,
mPreviewSize, mPreviewSize);
- items.lockscreen = createWallpaperItems(0, baseDir, path, pkgName, preview);
+ items.lockscreen = createWallpaperItems(0, baseDir, path, pkgName, preview, true);
}
}
return items;
}
private WallpaperItem createWallpaperItems(int id, String baseDir, String assetPath,
- String pkgName, Bitmap preview) {
+ String pkgName, Bitmap preview, boolean isLockWallpaper) {
if (TextUtils.isEmpty(assetPath) && preview == null) {
return null;
}
@@ -114,11 +114,15 @@ public class WallpaperPreviewGenerator {
item.assetPath = assetPath;
if (preview != null) {
- String fileName = ThemesContract.PreviewColumns.WALLPAPER_PREVIEW + componentID;
+ String filePrefix = isLockWallpaper ? PreviewColumns.LOCK_WALLPAPER_PREVIEW :
+ PreviewColumns.WALLPAPER_PREVIEW;
+ String fileName = filePrefix + componentID;
item.previewPath = PreviewUtils.compressAndSaveJpg(preview, baseDir, pkgName, fileName);
Bitmap thumbnail = Bitmap.createScaledBitmap(preview, mThumbnailSize, mThumbnailSize,
true);
- fileName = ThemesContract.PreviewColumns.WALLPAPER_THUMBNAIL + componentID;
+ filePrefix = isLockWallpaper ? PreviewColumns.LOCK_WALLPAPER_THUMBNAIL :
+ PreviewColumns.LOCK_WALLPAPER_THUMBNAIL;
+ fileName = filePrefix + componentID;
item.thumbnailPath = PreviewUtils.compressAndSavePng(thumbnail, baseDir, pkgName,
fileName);
}