summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author mattsziklay <mattsziklay@google.com> 2023-04-27 10:30:46 -0700
committer mattsziklay <mattsziklay@google.com> 2023-05-04 12:51:45 -0700
commitc8f118f97c941443613ff38e26e81cf1e6a301c6 (patch)
tree3ed3c20a34958929857ea7e860ac33ff6c4b9915
parent966ee1fd122e0810270f4806eb1c50adb69d72b7 (diff)
Make resize veil background adapt to theme.
Set the background of the resize veil to light or dark based on whether dark theme is applied. Video: http://recall/-/hJNEr4C0IUowK3TyPPf4wT/diSieIqfY6tdF5rsoOT0PH Bug: 274773589 Test: Manual; resize apps with different caption colors. Change-Id: Id94d81ae01ad0e9edeaed51591f539d4fe5eb913
-rw-r--r--libs/WindowManager/Shell/res/values/colors.xml2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java17
2 files changed, 19 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/res/values/colors.xml b/libs/WindowManager/Shell/res/values/colors.xml
index c487e4afd678..0ffa1d9fe8f1 100644
--- a/libs/WindowManager/Shell/res/values/colors.xml
+++ b/libs/WindowManager/Shell/res/values/colors.xml
@@ -67,4 +67,6 @@
<color name="desktop_mode_caption_menu_text_color">#191C1D</color>
<color name="desktop_mode_caption_menu_buttons_color_inactive">#191C1D</color>
<color name="desktop_mode_caption_menu_buttons_color_active">#00677E</color>
+ <color name="desktop_mode_resize_veil_light">#EFF1F2</color>
+ <color name="desktop_mode_resize_veil_dark">#1C1C17</color>
</resources>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java
index fa2d7a87c3cb..4899453ac991 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java
@@ -19,8 +19,10 @@ package com.android.wm.shell.windowdecor;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
+import android.annotation.ColorRes;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -109,6 +111,10 @@ public class ResizeVeil {
t.reparent(mVeilSurface, parentSurface);
mParentSurface = parentSurface;
}
+
+ int backgroundColorId = getBackgroundColorId();
+ mViewHost.getView().setBackgroundColor(mContext.getColor(backgroundColorId));
+
t.show(mVeilSurface)
.apply();
final ValueAnimator animator = new ValueAnimator();
@@ -158,6 +164,17 @@ public class ResizeVeil {
animator.start();
}
+ @ColorRes
+ private int getBackgroundColorId() {
+ Configuration configuration = mContext.getResources().getConfiguration();
+ if ((configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK)
+ == Configuration.UI_MODE_NIGHT_YES) {
+ return R.color.desktop_mode_resize_veil_dark;
+ } else {
+ return R.color.desktop_mode_resize_veil_light;
+ }
+ }
+
/**
* Dispose of veil when it is no longer needed, likely on close of its container decor.
*/