Fix crash on Android 5

This commit is contained in:
Dominik Schürmann 2014-10-22 23:28:13 +02:00
parent f4f16e62a2
commit ecfa2288eb

View File

@ -23,6 +23,7 @@ import android.app.Application;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
@ -139,6 +140,7 @@ public class KeychainApplication extends Application {
} }
static void brandGlowEffect(Context context, int brandColor) { static void brandGlowEffect(Context context, int brandColor) {
try {
// terrible hack to brand the edge overscroll glow effect // terrible hack to brand the edge overscroll glow effect
// https://gist.github.com/menny/7878762#file-brandgloweffect_full-java // https://gist.github.com/menny/7878762#file-brandgloweffect_full-java
@ -150,5 +152,8 @@ public class KeychainApplication extends Application {
int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android"); int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android");
Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId); Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId);
androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN); androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN);
} catch (Resources.NotFoundException e) {
// no hack on Android 5
}
} }
} }