TV: Add PiP content sized views to one FrameLayout
Restructuring of the tv pip menu layout to improve readability. Also includes some extra comments. Bug: 241744433 Test: manual - start a PiP and open the menu to see if the views including the edu text are still shown properly Change-Id: I2b39b3d251500de4d62d80829affbd8d2b6af42a
This commit is contained in:
@@ -16,92 +16,91 @@
|
||||
-->
|
||||
<!-- 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">
|
||||
<ScrollView
|
||||
android:id="@+id/tv_pip_menu_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<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">
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/tv_pip_menu_horizontal_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none">
|
||||
|
||||
<Space
|
||||
android:layout_width="@dimen/pip_menu_button_wrapper_margin"
|
||||
android:layout_height="@dimen/pip_menu_button_wrapper_margin"/>
|
||||
|
||||
<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 +110,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 +138,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 +146,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"
|
||||
|
||||
@@ -97,6 +97,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
|
||||
private final ImageView mArrowLeft;
|
||||
private final TvWindowMenuActionButton mA11yDoneButton;
|
||||
|
||||
private final View mPipBackground;
|
||||
|
||||
private final ScrollView mScrollView;
|
||||
private final HorizontalScrollView mHorizontalScrollView;
|
||||
private View mFocusedButton;
|
||||
@@ -148,6 +150,8 @@ 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);
|
||||
|
||||
mScrollView = findViewById(R.id.tv_pip_menu_scroll);
|
||||
mHorizontalScrollView = findViewById(R.id.tv_pip_menu_horizontal_scroll);
|
||||
|
||||
@@ -231,7 +235,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 +276,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)
|
||||
|
||||
Reference in New Issue
Block a user