mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
Fix crash on Android 5
This commit is contained in:
parent
f4f16e62a2
commit
ecfa2288eb
@ -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
|
||||
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);
|
||||
//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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user