summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-04-27 11:20:08 (GMT)
committerDanny Baumann <dannybaumann@web.de>2016-04-27 11:20:08 (GMT)
commit9e3dd801808f76c7109d8a9cc5ec2222b8292733 (patch)
treefb20ad221082b8851b0bcb3faa44ae6ab64922ad
parent2e0534f1bc9cbefebf50e72577e3ef8ee968eb99 (diff)
downloadandroid_packages_apps_Eleven-9e3dd801808f76c7109d8a9cc5ec2222b8292733.zip
android_packages_apps_Eleven-9e3dd801808f76c7109d8a9cc5ec2222b8292733.tar.gz
android_packages_apps_Eleven-9e3dd801808f76c7109d8a9cc5ec2222b8292733.tar.bz2
Load palette in background.
Change-Id: I03322c552ee1151be14e1d7c4db2a8f493d34580
-rw-r--r--src/com/cyanogenmod/eleven/utils/BitmapWithColors.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/eleven/utils/BitmapWithColors.java b/src/com/cyanogenmod/eleven/utils/BitmapWithColors.java
index a587c84..aaa46f5 100644
--- a/src/com/cyanogenmod/eleven/utils/BitmapWithColors.java
+++ b/src/com/cyanogenmod/eleven/utils/BitmapWithColors.java
@@ -17,6 +17,7 @@ package com.cyanogenmod.eleven.utils;
import android.graphics.Bitmap;
import android.graphics.Color;
+import android.os.Looper;
import android.support.v7.graphics.Palette;
import android.support.v7.graphics.Target;
import android.util.LruCache;
@@ -68,6 +69,12 @@ public class BitmapWithColors {
public BitmapWithColors(Bitmap bitmap, int bitmapKey) {
mBitmap = bitmap;
mBitmapKey = bitmapKey;
+
+ if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
+ // we're already running in background, so do the
+ // (costly) palette initialization immediately
+ loadColorsIfNeeded();
+ }
}
public BitmapWithColors(Bitmap bitmap, int bitmapKey, int vibrantColor, int vibrantDarkColor) {