OSDN Git Service

Tint screenshot frame black in dark mode
authorBeth Thibodeau <ethibodeau@google.com>
Fri, 8 Mar 2019 19:32:51 +0000 (14:32 -0500)
committerBeth Thibodeau <ethibodeau@google.com>
Fri, 8 Mar 2019 20:01:10 +0000 (20:01 +0000)
Fixes: 123034259
Test: visual, demo at https://photos.app.goo.gl/AcyoYfZu6FX5qkaPA
Change-Id: I1834f068953a44deb266111ad668589fc8ade29f

packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java

index bed0c45..341461b 100644 (file)
@@ -42,9 +42,11 @@ import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.ColorMatrix;
 import android.graphics.ColorMatrixColorFilter;
 import android.graphics.Matrix;
@@ -743,6 +745,15 @@ class GlobalScreenshot {
                 return (x - flashDurationPct) / (1f - flashDurationPct);
             }
         };
+
+        Resources r = mContext.getResources();
+        if ((r.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
+                == Configuration.UI_MODE_NIGHT_YES) {
+            mScreenshotView.getBackground().setTint(Color.BLACK);
+        } else {
+            mScreenshotView.getBackground().setTintList(null);
+        }
+
         ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
         anim.setDuration(SCREENSHOT_DROP_IN_DURATION);
         anim.addListener(new AnimatorListenerAdapter() {