Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6581a7d0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix and clean up Tv Pip Menu"

parents 3b074f90 19911209
Loading
Loading
Loading
Loading
+0 −33
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2020 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.
-->
<!-- Layout for {@link com.android.wm.shell.pip.tv.PipControlsView}. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
    <com.android.wm.shell.pip.tv.PipControlButtonView
        android:id="@+id/full_button"
        android:layout_width="@dimen/picture_in_picture_button_width"
        android:layout_height="wrap_content"
        android:src="@drawable/pip_ic_fullscreen_white"
        android:text="@string/pip_fullscreen" />

    <com.android.wm.shell.pip.tv.PipControlButtonView
        android:id="@+id/close_button"
        android:layout_width="@dimen/picture_in_picture_button_width"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/picture_in_picture_button_start_margin"
        android:src="@drawable/pip_ic_close_white"
        android:text="@string/pip_close" />
</merge>
+34 −14
Original line number Diff line number Diff line
@@ -14,19 +14,39 @@
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<!-- Layout for TvPipMenuView -->
<FrameLayout 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:orientation="horizontal"
              android:paddingTop="350dp"
              android:background="#CC000000"
              android:gravity="top|center_horizontal"
              android:clipChildren="false">
             android:background="#CC000000">

    <com.android.wm.shell.pip.tv.PipControlsView
        android:id="@+id/pip_controls"
    <LinearLayout
        android:id="@+id/tv_pip_menu_action_buttons"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:alpha="0" />
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="350dp"
        android:orientation="horizontal"
        android:alpha="0">

        <com.android.wm.shell.pip.tv.TvPipMenuActionButton
            android:id="@+id/tv_pip_menu_fullscreen_button"
            android:layout_width="@dimen/picture_in_picture_button_width"
            android:layout_height="wrap_content"
            android:src="@drawable/pip_ic_fullscreen_white"
            android:text="@string/pip_fullscreen" />

        <com.android.wm.shell.pip.tv.TvPipMenuActionButton
            android:id="@+id/tv_pip_menu_close_button"
            android:layout_width="@dimen/picture_in_picture_button_width"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/picture_in_picture_button_start_margin"
            android:src="@drawable/pip_ic_close_white"
            android:text="@string/pip_close" />

        <!-- More TvPipMenuActionButtons may be added here at runtime. -->

    </LinearLayout>

</FrameLayout>
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!-- Layout for {@link com.android.wm.shell.pip.tv.PipControlButtonView}. -->
<!-- Layout for TvPipMenuActionButton -->
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <ImageView android:id="@+id/button"
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<com.android.wm.shell.pip.tv.PipControlButtonView
<com.android.wm.shell.pip.tv.TvPipMenuActionButton
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="@dimen/picture_in_picture_button_width"
    android:layout_height="wrap_content"
+10 −2
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ import java.util.Objects;
/**
 * Manages the picture-in-picture (PIP) UI and states.
 */
public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallback {
public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallback,
        TvPipMenuController.Delegate {
    private static final String TAG = "TvPipController";
    static final boolean DEBUG = false;

@@ -198,7 +199,7 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
        mPipBoundsAlgorithm = pipBoundsAlgorithm;
        mPipMediaController = pipMediaController;
        mTvPipMenuController = tvPipMenuController;
        mTvPipMenuController.attachPipController(this);
        mTvPipMenuController.setDelegate(this);
        // Ensure that we have the display info in case we get calls to update the bounds
        // before the listener calls back
        final DisplayInfo displayInfo = new DisplayInfo();
@@ -289,6 +290,7 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
    /**
     * Closes PIP (PIPed activity and PIP system UI).
     */
    @Override
    public void closePip() {
        if (DEBUG) Log.d(TAG, "closePip(), current state=" + getStateDescription());

@@ -318,9 +320,15 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
        mHandler.removeCallbacks(mClosePipRunnable);
    }

    @Override
    public void movePipToNormalPosition() {
        resizePinnedStack(PipController.STATE_PIP);
    }

    /**
     * Moves the PIPed activity to the fullscreen and closes PIP system UI.
     */
    @Override
    public void movePipToFullscreen() {
        if (DEBUG) Log.d(TAG, "movePipToFullscreen(), current state=" + getStateDescription());

Loading