Merge changes I67256421,I2b39b3d2
* changes: Add dim layer to PiP menu below buttons TV: Add PiP content sized views to one FrameLayout
This commit is contained in:
committed by
Android (Google) Code Review
commit
4ef60d7308
@@ -16,92 +16,98 @@
|
||||
-->
|
||||
<!-- Layout for TvPipMenuView -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tv_pip_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center|top">
|
||||
android:id="@+id/tv_pip_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center|top">
|
||||
|
||||
<!-- Matches the PiP app content -->
|
||||
<View
|
||||
<FrameLayout
|
||||
android:id="@+id/tv_pip"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:alpha="0"
|
||||
android:background="@color/tv_pip_menu_background"
|
||||
android:layout_marginTop="@dimen/pip_menu_outer_space"
|
||||
android:layout_marginStart="@dimen/pip_menu_outer_space"
|
||||
android:layout_marginEnd="@dimen/pip_menu_outer_space"/>
|
||||
android:layout_marginEnd="@dimen/pip_menu_outer_space">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/tv_pip_menu_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@+id/tv_pip"
|
||||
android:layout_alignStart="@+id/tv_pip"
|
||||
android:layout_alignEnd="@+id/tv_pip"
|
||||
android:layout_alignBottom="@+id/tv_pip"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"/>
|
||||
<View
|
||||
android:id="@+id/tv_pip_menu_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/tv_pip_menu_background"
|
||||
android:alpha="0"/>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/tv_pip_menu_horizontal_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@+id/tv_pip"
|
||||
android:layout_alignStart="@+id/tv_pip"
|
||||
android:layout_alignEnd="@+id/tv_pip"
|
||||
android:layout_alignBottom="@+id/tv_pip"
|
||||
android:scrollbars="none">
|
||||
<View
|
||||
android:id="@+id/tv_pip_menu_dim_layer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/tv_pip_menu_dim_layer"
|
||||
android:alpha="0"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tv_pip_menu_action_buttons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:alpha="0">
|
||||
<ScrollView
|
||||
android:id="@+id/tv_pip_menu_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="@dimen/pip_menu_button_wrapper_margin"
|
||||
android:layout_height="@dimen/pip_menu_button_wrapper_margin"/>
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/tv_pip_menu_horizontal_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none">
|
||||
|
||||
<com.android.wm.shell.common.TvWindowMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_fullscreen_button"
|
||||
<LinearLayout
|
||||
android:id="@+id/tv_pip_menu_action_buttons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_fullscreen_white"
|
||||
android:text="@string/pip_fullscreen" />
|
||||
android:orientation="horizontal"
|
||||
android:alpha="0">
|
||||
|
||||
<com.android.wm.shell.common.TvWindowMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_close_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_close_white"
|
||||
android:text="@string/pip_close" />
|
||||
<Space
|
||||
android:layout_width="@dimen/pip_menu_button_wrapper_margin"
|
||||
android:layout_height="@dimen/pip_menu_button_wrapper_margin"/>
|
||||
|
||||
<!-- More TvPipMenuActionButtons may be added here at runtime. -->
|
||||
<com.android.wm.shell.pip.tv.TvPipMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_fullscreen_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_fullscreen_white"
|
||||
android:text="@string/pip_fullscreen" />
|
||||
|
||||
<com.android.wm.shell.common.TvWindowMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_move_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_move_white"
|
||||
android:text="@string/pip_move" />
|
||||
<com.android.wm.shell.pip.tv.TvPipMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_close_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_close_white"
|
||||
android:text="@string/pip_close" />
|
||||
|
||||
<com.android.wm.shell.common.TvWindowMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_expand_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_collapse"
|
||||
android:visibility="gone"
|
||||
android:text="@string/pip_collapse" />
|
||||
<!-- More TvPipMenuActionButtons may be added here at runtime. -->
|
||||
|
||||
<Space
|
||||
android:layout_width="@dimen/pip_menu_button_wrapper_margin"
|
||||
android:layout_height="@dimen/pip_menu_button_wrapper_margin"/>
|
||||
<com.android.wm.shell.pip.tv.TvPipMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_move_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_move_white"
|
||||
android:text="@string/pip_move" />
|
||||
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
<com.android.wm.shell.pip.tv.TvPipMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_expand_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/pip_ic_collapse"
|
||||
android:visibility="gone"
|
||||
android:text="@string/pip_collapse" />
|
||||
|
||||
<Space
|
||||
android:layout_width="@dimen/pip_menu_button_wrapper_margin"
|
||||
android:layout_height="@dimen/pip_menu_button_wrapper_margin"/>
|
||||
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Frame around the content, just overlapping the corners to make them round -->
|
||||
<View
|
||||
android:id="@+id/tv_pip_border"
|
||||
android:layout_width="0dp"
|
||||
@@ -111,6 +117,7 @@
|
||||
android:layout_marginEnd="@dimen/pip_menu_outer_space_frame"
|
||||
android:background="@drawable/tv_pip_menu_border"/>
|
||||
|
||||
<!-- Temporarily extending the background to show an edu text hint for opening the menu -->
|
||||
<FrameLayout
|
||||
android:id="@+id/tv_pip_menu_edu_text_container"
|
||||
android:layout_width="match_parent"
|
||||
@@ -138,6 +145,7 @@
|
||||
android:textAppearance="@style/TvPipEduText"/>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Frame around the PiP content + edu text hint - used to highlight open menu -->
|
||||
<View
|
||||
android:id="@+id/tv_pip_menu_frame"
|
||||
android:layout_width="match_parent"
|
||||
@@ -145,7 +153,8 @@
|
||||
android:layout_margin="@dimen/pip_menu_outer_space_frame"
|
||||
android:background="@drawable/tv_pip_menu_border"/>
|
||||
|
||||
<com.android.wm.shell.common.TvWindowMenuActionButton
|
||||
<!-- Move menu -->
|
||||
<com.android.wm.shell.pip.tv.TvPipMenuActionButton
|
||||
android:id="@+id/tv_pip_menu_done_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<color name="tv_window_menu_icon_bg_unfocused">#990E0E0F</color>
|
||||
|
||||
<color name="tv_pip_menu_focus_border">#E8EAED</color>
|
||||
<color name="tv_pip_menu_dim_layer">#990E0E0F</color>
|
||||
<color name="tv_pip_menu_background">#1E232C</color>
|
||||
|
||||
<color name="tv_pip_edu_text">#99D2E3FC</color>
|
||||
|
||||
@@ -97,6 +97,9 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
private final ImageView mArrowLeft;
|
||||
private final TvWindowMenuActionButton mA11yDoneButton;
|
||||
|
||||
private final View mPipBackground;
|
||||
private final View mDimLayer;
|
||||
|
||||
private final ScrollView mScrollView;
|
||||
private final HorizontalScrollView mHorizontalScrollView;
|
||||
private View mFocusedButton;
|
||||
@@ -148,6 +151,9 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
mExpandButton = findViewById(R.id.tv_pip_menu_expand_button);
|
||||
mExpandButton.setOnClickListener(this);
|
||||
|
||||
mPipBackground = findViewById(R.id.tv_pip_menu_background);
|
||||
mDimLayer = findViewById(R.id.tv_pip_menu_dim_layer);
|
||||
|
||||
mScrollView = findViewById(R.id.tv_pip_menu_scroll);
|
||||
mHorizontalScrollView = findViewById(R.id.tv_pip_menu_horizontal_scroll);
|
||||
|
||||
@@ -231,7 +237,7 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
mCurrentPipBounds.width() / (float) mCurrentPipBounds.height(),
|
||||
finishBounds.width() / (float) finishBounds.height());
|
||||
if (ratioChanged) {
|
||||
mPipView.animate()
|
||||
mPipBackground.animate()
|
||||
.alpha(1f)
|
||||
.setInterpolator(TvPipInterpolators.EXIT)
|
||||
.setDuration(mResizeAnimationDuration / 2)
|
||||
@@ -272,7 +278,7 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
"%s: onPipTransitionFinished()", TAG);
|
||||
|
||||
// Fade in content by fading out view on top.
|
||||
mPipView.animate()
|
||||
mPipBackground.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(mResizeAnimationDuration / 2)
|
||||
.setInterpolator(TvPipInterpolators.ENTER)
|
||||
@@ -770,6 +776,7 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
refocusPreviousButton();
|
||||
}
|
||||
animateAlphaTo(show ? 1 : 0, mActionButtonsContainer);
|
||||
animateAlphaTo(show ? 1 : 0, mDimLayer);
|
||||
}
|
||||
|
||||
private void setFrameHighlighted(boolean highlighted) {
|
||||
|
||||
Reference in New Issue
Block a user