summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2013-06-03 00:38:47 -0400
committerDanesh Mondegarian <daneshm90@gmail.com>2013-06-03 00:38:47 -0400
commitfa583e172247cc4c863f53bf92ef71c65fe96ff1 (patch)
tree096ac116b7bbc7fb8cec5d2ac0f10f97f86b83b7 /policy
parentd62ebbdaa0491fe23d6968deae85f3a6c5112ea8 (diff)
downloadframeworks_base-fa583e172247cc4c863f53bf92ef71c65fe96ff1.zip
frameworks_base-fa583e172247cc4c863f53bf92ef71c65fe96ff1.tar.gz
frameworks_base-fa583e172247cc4c863f53bf92ef71c65fe96ff1.tar.bz2
Lockscreen : Add custom background overlay
Adds an overlay on top of custom images/colors to better match stock appearance. https://jira.cyanogenmod.org/browse/CYAN-1280 Change-Id: I1210d208de912e7f6a1941284f1fe1ff0776ab48
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java14
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java2
2 files changed, 12 insertions, 4 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index f11d444..e10a066 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -38,8 +38,11 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
+import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
@@ -325,9 +328,10 @@ public class KeyguardHostView extends KeyguardViewBase {
return;
}
+ Drawable back = null;
if (!background.isEmpty()) {
try {
- setBackgroundColor(Integer.parseInt(background));
+ back = new ColorDrawable(Integer.parseInt(background));
} catch(NumberFormatException e) {
Log.e(TAG, "Invalid background color " + background);
}
@@ -336,11 +340,15 @@ public class KeyguardHostView extends KeyguardViewBase {
Context settingsContext = getContext().createPackageContext("com.android.settings", 0);
String wallpaperFile = settingsContext.getFilesDir() + "/lockwallpaper";
Bitmap backgroundBitmap = BitmapFactory.decodeFile(wallpaperFile);
- setBackgroundDrawable(new BitmapDrawable(backgroundBitmap));
+ back = new BitmapDrawable(getContext().getResources(), backgroundBitmap);
} catch (NameNotFoundException e) {
- // Do nothing here
+ // Do nothing here
}
}
+ if (back != null) {
+ back.setColorFilter(BACKGROUND_COLOR, PorterDuff.Mode.MULTIPLY);
+ setBackground(back);
+ }
}
private boolean shouldEnableAddWidget() {
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java
index 6fcacd3..cc88283 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java
@@ -45,7 +45,7 @@ import android.widget.FrameLayout;
*/
public abstract class KeyguardViewBase extends FrameLayout {
- private static final int BACKGROUND_COLOR = 0x70000000;
+ protected static final int BACKGROUND_COLOR = 0x70000000;
private AudioManager mAudioManager;
private TelephonyManager mTelephonyManager = null;
protected KeyguardViewMediator.ViewMediatorCallback mViewMediatorCallback;