mirror of https://github.com/M66B/FairEmail.git
Prevent odd crash
This commit is contained in:
parent
a7b55d5570
commit
9a4933f20e
|
@ -29,6 +29,7 @@ import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -124,6 +125,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||||
int colorPrimaryDark = Helper.resolveColor(this, R.attr.colorPrimaryDark);
|
int colorPrimaryDark = Helper.resolveColor(this, R.attr.colorPrimaryDark);
|
||||||
int colorActionForeground = Helper.resolveColor(this, R.attr.colorActionForeground);
|
int colorActionForeground = Helper.resolveColor(this, R.attr.colorActionForeground);
|
||||||
|
|
||||||
|
try {
|
||||||
Drawable d = getDrawable(R.drawable.baseline_mail_24);
|
Drawable d = getDrawable(R.drawable.baseline_mail_24);
|
||||||
Bitmap bm = Bitmap.createBitmap(
|
Bitmap bm = Bitmap.createBitmap(
|
||||||
d.getIntrinsicWidth(),
|
d.getIntrinsicWidth(),
|
||||||
|
@ -134,9 +136,18 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||||
d.setTint(colorActionForeground);
|
d.setTint(colorActionForeground);
|
||||||
d.draw(canvas);
|
d.draw(canvas);
|
||||||
|
|
||||||
|
int colorPrimary = colorPrimaryDark;
|
||||||
|
if (colorPrimary != 0 && Color.alpha(colorPrimary) != 255) {
|
||||||
|
Log.e("Task color primary=" + Integer.toHexString(colorPrimary));
|
||||||
|
colorPrimary = ColorUtils.setAlphaComponent(colorPrimary, 255);
|
||||||
|
}
|
||||||
|
|
||||||
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
|
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
|
||||||
null, bm, ColorUtils.setAlphaComponent(colorPrimaryDark, 255));
|
null, bm, colorPrimary);
|
||||||
setTaskDescription(td);
|
setTaskDescription(td);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
|
|
||||||
boolean navbar_colorize = prefs.getBoolean("navbar_colorize", false);
|
boolean navbar_colorize = prefs.getBoolean("navbar_colorize", false);
|
||||||
if (navbar_colorize) {
|
if (navbar_colorize) {
|
||||||
|
|
Loading…
Reference in New Issue