aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-10-22 23:28:13 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-10-22 23:28:13 +0200
commitecfa2288eb58c631900261270a99c8dcf27b4b4d (patch)
treeb1982f98095300a524c1e4e7c3325991e44da0ec /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
parentf4f16e62a200e8ac051a69a5810cf34a4940776f (diff)
downloadopen-keychain-ecfa2288eb58c631900261270a99c8dcf27b4b4d.tar.gz
open-keychain-ecfa2288eb58c631900261270a99c8dcf27b4b4d.tar.bz2
open-keychain-ecfa2288eb58c631900261270a99c8dcf27b4b4d.zip
Fix crash on Android 5
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
index ec9509768..cacceb5d0 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
@@ -23,6 +23,7 @@ import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -139,16 +140,20 @@ public class KeychainApplication extends Application {
}
static void brandGlowEffect(Context context, int brandColor) {
- // terrible hack to brand the edge overscroll glow effect
- // https://gist.github.com/menny/7878762#file-brandgloweffect_full-java
-
- //glow
- int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android");
- Drawable androidGlow = context.getResources().getDrawable(glowDrawableId);
- androidGlow.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN);
- //edge
- int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android");
- Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId);
- androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN);
+ try {
+ // terrible hack to brand the edge overscroll glow effect
+ // https://gist.github.com/menny/7878762#file-brandgloweffect_full-java
+
+ //glow
+ int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android");
+ Drawable androidGlow = context.getResources().getDrawable(glowDrawableId);
+ androidGlow.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN);
+ //edge
+ int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android");
+ Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId);
+ androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN);
+ } catch (Resources.NotFoundException e) {
+ // no hack on Android 5
+ }
}
}