summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hongwei Wang <hwwang@google.com> 2021-02-18 23:37:31 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-02-18 23:37:31 +0000
commit9c702c9b9eba0cd90a01729bfa30d3c9293f2bd3 (patch)
tree3cb2aebcc20a6033caf859ba4d18258e0f86c4f5
parent94a444742a877a43bfa1704b601d95a53548d6a5 (diff)
parent1c2fd3aa7fc8b7e5027aeba485b4d9affcbb1399 (diff)
Merge "Polish the PipMenuView when showing the controls" into sc-dev
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_expand.xml6
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_ic_close_white.xml4
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_ic_pause_white.xml4
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_ic_play_arrow_white.xml4
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_ic_settings.xml4
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_ic_skip_next_white.xml6
-rw-r--r--libs/WindowManager/Shell/res/drawable/pip_ic_skip_previous_white.xml6
-rw-r--r--libs/WindowManager/Shell/res/layout/pip_menu.xml6
-rw-r--r--libs/WindowManager/Shell/res/layout/pip_menu_action.xml14
-rw-r--r--libs/WindowManager/Shell/res/values/dimen.xml10
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActionView.java48
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java6
-rw-r--r--packages/SystemUI/res/layout/pip_menu_activity.xml93
-rw-r--r--packages/SystemUI/tools/lint/baseline.xml11
14 files changed, 90 insertions, 132 deletions
diff --git a/libs/WindowManager/Shell/res/drawable/pip_expand.xml b/libs/WindowManager/Shell/res/drawable/pip_expand.xml
index c99d81934aab..d36c4f72ecd0 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_expand.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_expand.xml
@@ -14,8 +14,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="36dp"
- android:height="36dp"
+ android:width="@dimen/pip_expand_action_inner_size"
+ android:height="@dimen/pip_expand_action_inner_size"
android:viewportWidth="36"
android:viewportHeight="36">
@@ -25,4 +25,4 @@
android:fillColor="#FFFFFF"
android:pathData="M10 21H7v8h8v-3h-5v-5zm-3-6h3v-5h5V7H7v8zm19 11h-5v3h8v-8h-3v5zM21
7v3h5v5h3V7h-8z" />
-</vector> \ No newline at end of file
+</vector>
diff --git a/libs/WindowManager/Shell/res/drawable/pip_ic_close_white.xml b/libs/WindowManager/Shell/res/drawable/pip_ic_close_white.xml
index bcc850a854de..60456267afef 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_ic_close_white.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_ic_close_white.xml
@@ -15,8 +15,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
+ android:width="@dimen/pip_action_inner_size"
+ android:height="@dimen/pip_action_inner_size"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
diff --git a/libs/WindowManager/Shell/res/drawable/pip_ic_pause_white.xml b/libs/WindowManager/Shell/res/drawable/pip_ic_pause_white.xml
index ef9b2d9c1c63..0c469f7abb78 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_ic_pause_white.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_ic_pause_white.xml
@@ -15,8 +15,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
+ android:width="@dimen/pip_action_inner_size"
+ android:height="@dimen/pip_action_inner_size"
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/libs/WindowManager/Shell/res/drawable/pip_ic_play_arrow_white.xml b/libs/WindowManager/Shell/res/drawable/pip_ic_play_arrow_white.xml
index f12d2cbebc87..8567afa3232c 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_ic_play_arrow_white.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_ic_play_arrow_white.xml
@@ -15,8 +15,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
+ android:width="@dimen/pip_action_inner_size"
+ android:height="@dimen/pip_action_inner_size"
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/libs/WindowManager/Shell/res/drawable/pip_ic_settings.xml b/libs/WindowManager/Shell/res/drawable/pip_ic_settings.xml
index b61e98ce2f9f..73ec167f1f6f 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_ic_settings.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_ic_settings.xml
@@ -15,8 +15,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
+ android:width="@dimen/pip_action_inner_size"
+ android:height="@dimen/pip_action_inner_size"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
diff --git a/libs/WindowManager/Shell/res/drawable/pip_ic_skip_next_white.xml b/libs/WindowManager/Shell/res/drawable/pip_ic_skip_next_white.xml
index 040c7e642241..6c5542131ab8 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_ic_skip_next_white.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_ic_skip_next_white.xml
@@ -15,8 +15,8 @@ Copyright (C) 2017 The Android Open Source Project
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
+ android:width="@dimen/pip_action_inner_size"
+ android:height="@dimen/pip_action_inner_size"
android:viewportWidth="24"
android:viewportHeight="24">
@@ -25,4 +25,4 @@ Copyright (C) 2017 The Android Open Source Project
android:pathData="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z" />
<path
android:pathData="M0 0h24v24H0z" />
-</vector> \ No newline at end of file
+</vector>
diff --git a/libs/WindowManager/Shell/res/drawable/pip_ic_skip_previous_white.xml b/libs/WindowManager/Shell/res/drawable/pip_ic_skip_previous_white.xml
index b9b94b73a00f..6b5382b662b1 100644
--- a/libs/WindowManager/Shell/res/drawable/pip_ic_skip_previous_white.xml
+++ b/libs/WindowManager/Shell/res/drawable/pip_ic_skip_previous_white.xml
@@ -15,8 +15,8 @@ Copyright (C) 2017 The Android Open Source Project
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
+ android:width="@dimen/pip_action_inner_size"
+ android:height="@dimen/pip_action_inner_size"
android:viewportWidth="24"
android:viewportHeight="24">
@@ -25,4 +25,4 @@ Copyright (C) 2017 The Android Open Source Project
android:pathData="M6 6h2v12H6zm3.5 6l8.5 6V6z" />
<path
android:pathData="M0 0h24v24H0z" />
-</vector> \ No newline at end of file
+</vector>
diff --git a/libs/WindowManager/Shell/res/layout/pip_menu.xml b/libs/WindowManager/Shell/res/layout/pip_menu.xml
index b581f555c234..9fe024748610 100644
--- a/libs/WindowManager/Shell/res/layout/pip_menu.xml
+++ b/libs/WindowManager/Shell/res/layout/pip_menu.xml
@@ -40,7 +40,7 @@
android:layout_height="@dimen/pip_expand_action_size"
android:layout_gravity="center"
android:contentDescription="@string/pip_phone_expand"
- android:padding="10dp"
+ android:gravity="center"
android:src="@drawable/pip_expand"
android:background="?android:selectableItemBackgroundBorderless" />
</FrameLayout>
@@ -72,8 +72,8 @@
android:id="@+id/settings"
android:layout_width="@dimen/pip_action_size"
android:layout_height="@dimen/pip_action_size"
- android:padding="@dimen/pip_action_padding"
android:contentDescription="@string/pip_phone_settings"
+ android:gravity="center"
android:src="@drawable/pip_ic_settings"
android:background="?android:selectableItemBackgroundBorderless" />
@@ -81,8 +81,8 @@
android:id="@+id/dismiss"
android:layout_width="@dimen/pip_action_size"
android:layout_height="@dimen/pip_action_size"
- android:padding="@dimen/pip_action_padding"
android:contentDescription="@string/pip_phone_close"
+ android:gravity="center"
android:src="@drawable/pip_ic_close_white"
android:background="?android:selectableItemBackgroundBorderless" />
</LinearLayout>
diff --git a/libs/WindowManager/Shell/res/layout/pip_menu_action.xml b/libs/WindowManager/Shell/res/layout/pip_menu_action.xml
index 7a026ca63f50..a733b31d9fb0 100644
--- a/libs/WindowManager/Shell/res/layout/pip_menu_action.xml
+++ b/libs/WindowManager/Shell/res/layout/pip_menu_action.xml
@@ -14,10 +14,18 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<ImageButton
+<com.android.wm.shell.pip.phone.PipMenuActionView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/pip_action_size"
android:layout_height="@dimen/pip_action_size"
- android:padding="@dimen/pip_action_padding"
android:background="?android:selectableItemBackgroundBorderless"
- android:forceHasOverlappingRendering="false" />
+ android:forceHasOverlappingRendering="false">
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="@dimen/pip_action_inner_size"
+ android:layout_height="@dimen/pip_action_inner_size"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"/>
+
+</com.android.wm.shell.pip.phone.PipMenuActionView>
diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml
index 583964b2f4a4..75bed3777a9d 100644
--- a/libs/WindowManager/Shell/res/values/dimen.xml
+++ b/libs/WindowManager/Shell/res/values/dimen.xml
@@ -21,14 +21,20 @@
<dimen name="floating_dismiss_gradient_height">250dp</dimen>
<!-- The padding around a PiP actions. -->
- <dimen name="pip_action_padding">12dp</dimen>
+ <dimen name="pip_action_padding">16dp</dimen>
<!-- The height of the PiP actions container in which the actions are vertically centered. -->
<dimen name="pip_action_size">48dp</dimen>
- <!-- The width and height of the PiP expand action. -->
+ <!-- The width and height of the PiP action asset drawn within the container. -->
+ <dimen name="pip_action_inner_size">20dp</dimen>
+
+ <!-- The width and height of the PiP expand action container. -->
<dimen name="pip_expand_action_size">60dp</dimen>
+ <!-- The width and height of the PiP expand action asset drawn within the container. -->
+ <dimen name="pip_expand_action_inner_size">28dp</dimen>
+
<!-- The padding between actions in the PiP in landscape Note that the PiP does not reflect
the configuration of the device, so we can't use -land resources. -->
<dimen name="pip_between_action_padding_land">8dp</dimen>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActionView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActionView.java
new file mode 100644
index 000000000000..f11ae422e837
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActionView.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.wm.shell.pip.phone;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+
+import com.android.wm.shell.R;
+
+/**
+ * Container layout wraps single action image view drawn in PiP menu and can restrict the size of
+ * action image view (see pip_menu_action.xml).
+ */
+public class PipMenuActionView extends FrameLayout {
+ private ImageView mImageView;
+
+ public PipMenuActionView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mImageView = findViewById(R.id.image);
+ }
+
+ /** pass through to internal {@link #mImageView} */
+ public void setImageDrawable(Drawable drawable) {
+ mImageView.setImageDrawable(drawable);
+ }
+}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java
index 1cf3a48e9575..0d64407f649f 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java
@@ -59,7 +59,6 @@ import android.view.ViewRootImpl;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
-import android.widget.ImageButton;
import android.widget.LinearLayout;
import com.android.wm.shell.R;
@@ -407,7 +406,7 @@ public class PipMenuView extends FrameLayout {
// Ensure we have as many buttons as actions
final LayoutInflater inflater = LayoutInflater.from(mContext);
while (mActionsGroup.getChildCount() < mActions.size()) {
- final ImageButton actionView = (ImageButton) inflater.inflate(
+ final PipMenuActionView actionView = (PipMenuActionView) inflater.inflate(
R.layout.pip_menu_action, mActionsGroup, false);
mActionsGroup.addView(actionView);
}
@@ -424,7 +423,8 @@ public class PipMenuView extends FrameLayout {
&& (stackBounds.width() > stackBounds.height());
for (int i = 0; i < mActions.size(); i++) {
final RemoteAction action = mActions.get(i);
- final ImageButton actionView = (ImageButton) mActionsGroup.getChildAt(i);
+ final PipMenuActionView actionView =
+ (PipMenuActionView) mActionsGroup.getChildAt(i);
// TODO: Check if the action drawable has changed before we reload it
action.getIcon().loadDrawableAsync(mContext, d -> {
diff --git a/packages/SystemUI/res/layout/pip_menu_activity.xml b/packages/SystemUI/res/layout/pip_menu_activity.xml
deleted file mode 100644
index 2b33e17a5fbd..000000000000
--- a/packages/SystemUI/res/layout/pip_menu_activity.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/background"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- Menu layout -->
- <FrameLayout
- android:id="@+id/menu_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:forceHasOverlappingRendering="false"
- android:accessibilityTraversalAfter="@id/dismiss">
-
- <!-- The margins for this container is calculated in the code depending on whether the
- actions_container is visible. -->
- <FrameLayout
- android:id="@+id/expand_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageButton
- android:id="@+id/expand_button"
- android:layout_width="60dp"
- android:layout_height="60dp"
- android:layout_gravity="center"
- android:contentDescription="@string/pip_phone_expand"
- android:padding="10dp"
- android:src="@drawable/pip_expand"
- android:background="?android:selectableItemBackgroundBorderless" />
- </FrameLayout>
-
- <FrameLayout
- android:id="@+id/actions_container"
- android:layout_width="match_parent"
- android:layout_height="@dimen/pip_action_size"
- android:layout_gravity="bottom"
- android:visibility="invisible">
- <LinearLayout
- android:id="@+id/actions_group"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center_horizontal"
- android:orientation="horizontal"
- android:divider="@android:color/transparent"
- android:showDividers="middle" />
- </FrameLayout>
- </FrameLayout>
-
- <ImageButton
- android:id="@+id/settings"
- android:layout_width="@dimen/pip_action_size"
- android:layout_height="@dimen/pip_action_size"
- android:layout_gravity="top|start"
- android:padding="@dimen/pip_action_padding"
- android:contentDescription="@string/pip_phone_settings"
- android:src="@drawable/ic_settings"
- android:background="?android:selectableItemBackgroundBorderless" />
-
- <ImageButton
- android:id="@+id/dismiss"
- android:layout_width="@dimen/pip_action_size"
- android:layout_height="@dimen/pip_action_size"
- android:layout_gravity="top|end"
- android:padding="@dimen/pip_action_padding"
- android:contentDescription="@string/pip_phone_close"
- android:src="@drawable/ic_close_white"
- android:background="?android:selectableItemBackgroundBorderless" />
-
- <!--TODO (b/156917828): Add content description for a11y purposes?-->
- <ImageButton
- android:id="@+id/resize_handle"
- android:layout_width="@dimen/pip_resize_handle_size"
- android:layout_height="@dimen/pip_resize_handle_size"
- android:layout_gravity="top|start"
- android:layout_margin="@dimen/pip_resize_handle_margin"
- android:src="@drawable/pip_resize_handle"
- android:background="?android:selectableItemBackgroundBorderless" />
-</FrameLayout>
diff --git a/packages/SystemUI/tools/lint/baseline.xml b/packages/SystemUI/tools/lint/baseline.xml
index 3e494032b8e2..9a2e3207a6f4 100644
--- a/packages/SystemUI/tools/lint/baseline.xml
+++ b/packages/SystemUI/tools/lint/baseline.xml
@@ -1262,17 +1262,6 @@
<issue
id="MergeRootFrame"
message="This `&lt;FrameLayout>` can be replaced with a `&lt;merge>` tag"
- errorLine1="&lt;FrameLayout"
- errorLine2="^">
- <location
- file="res/layout/pip_menu_activity.xml"
- line="16"
- column="1"/>
- </issue>
-
- <issue
- id="MergeRootFrame"
- message="This `&lt;FrameLayout>` can be replaced with a `&lt;merge>` tag"
errorLine1="&lt;FrameLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;"
errorLine2="^">
<location