Fully turn off task description

master
M66B 8 months ago
parent 6e2bd02852
commit 916427a795

@ -393,29 +393,29 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
try { try {
boolean task_description = prefs.getBoolean("task_description", true); boolean task_description = prefs.getBoolean("task_description", true);
int colorPrimary = (task_description if (task_description) {
? Helper.resolveColor(this, androidx.appcompat.R.attr.colorPrimaryDark) int colorPrimary = Helper.resolveColor(this, androidx.appcompat.R.attr.colorPrimaryDark);
: getColor(R.color.lightBluePrimary)); if (colorPrimary != 0 && Color.alpha(colorPrimary) != 255) {
if (colorPrimary != 0 && Color.alpha(colorPrimary) != 255) { Log.w("Task color primary=" + Integer.toHexString(colorPrimary));
Log.w("Task color primary=" + Integer.toHexString(colorPrimary)); colorPrimary = ColorUtils.setAlphaComponent(colorPrimary, 255);
colorPrimary = ColorUtils.setAlphaComponent(colorPrimary, 255); }
}
double lum = ColorUtils.calculateLuminance(colorPrimary); double lum = ColorUtils.calculateLuminance(colorPrimary);
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(),
d.getIntrinsicHeight(), d.getIntrinsicHeight(),
Bitmap.Config.ARGB_8888); Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bm); Canvas canvas = new Canvas(bm);
d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
d.setTint(lum > LUMINANCE_THRESHOLD ? Color.BLACK : Color.WHITE); d.setTint(lum > LUMINANCE_THRESHOLD ? Color.BLACK : Color.WHITE);
d.draw(canvas); d.draw(canvas);
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription( ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
null, bm, colorPrimary); null, bm, colorPrimary);
setTaskDescription(td); setTaskDescription(td);
}
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }

Loading…
Cancel
Save