Update fullscreen handle appearance.

Makes fullscreen desktop handle rounder and aligns its brightness with
notification icons.
Before: https://screenshot.googleplex.com/89zkkMpUefHc39L
After: https://screenshot.googleplex.com/3ceqjybE6QvHsWe

Bug: 280830923
Test: Manual
Change-Id: I4cd9a65366c2e3f17c22f54c85a64e53b50e6b9a
This commit is contained in:
mattsziklay
2023-06-05 17:15:00 -07:00
parent 5e51aa6b86
commit 6980cec2dd
3 changed files with 34 additions and 23 deletions

View File

@@ -13,13 +13,20 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group android:translateY="8.0">
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="4dp"
android:viewportWidth="128"
android:viewportHeight="4"
>
<group>
<clip-path
android:pathData="M2 0H126C127.105 0 128 0.895431 128 2C128 3.10457 127.105 4 126 4H2C0.895431 4 0 3.10457 0 2C0 0.895431 0.895431 0 2 0Z"
/>
<path
android:fillColor="@android:color/black" android:pathData="M3,5V3H21V5Z"/>
android:pathData="M0 0V4H128V0"
android:fillColor="@android:color/black"
/>
</group>
</vector>

View File

@@ -28,6 +28,7 @@
android:layout_width="176dp"
android:layout_height="42dp"
android:paddingHorizontal="24dp"
android:paddingVertical="19dp"
android:contentDescription="@string/handle_text"
android:src="@drawable/decor_handle_dark"
tools:tint="@color/desktop_mode_caption_handle_bar_dark"

View File

@@ -1,32 +1,35 @@
package com.android.wm.shell.windowdecor.viewholder
import android.app.ActivityManager.RunningTaskInfo
import android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM
import android.content.Context
import android.graphics.Color
import android.view.View
import android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
/**
* Encapsulates the root [View] of a window decoration and its children to facilitate looking up
* children (via findViewById) and updating to the latest data from [RunningTaskInfo].
*/
internal abstract class DesktopModeWindowDecorationViewHolder(rootView: View) {
val context: Context = rootView.context
val context: Context = rootView.context
/**
* A signal to the view holder that new data is available and that the views should be updated
* to reflect it.
*/
abstract fun bindData(taskInfo: RunningTaskInfo)
/**
* A signal to the view holder that new data is available and that the views should be updated to
* reflect it.
*/
abstract fun bindData(taskInfo: RunningTaskInfo)
/**
* Whether the caption items should use the 'light' color variant so that there's good contrast
* with the caption background color.
*/
protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean {
return if (Color.alpha(taskInfo.taskDescription.statusBarColor) != 0) {
Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5
} else {
taskInfo.taskDescription.statusBarAppearance and APPEARANCE_LIGHT_STATUS_BARS == 0
}
/**
* Whether the caption items should use the 'light' color variant so that there's good contrast
* with the caption background color.
*/
protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean {
return if (Color.alpha(taskInfo.taskDescription.statusBarColor) != 0 &&
taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) {
Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5
} else {
taskInfo.taskDescription.statusBarAppearance and APPEARANCE_LIGHT_STATUS_BARS == 0
}
}
}