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

Commit c24734e8 authored by Galia Peycheva's avatar Galia Peycheva
Browse files

Add edu text to TV PiP

The edu text is added to the bottom of the TvPipMenuView, below the
pip content. This also makes the front and back pip menu surfaces
change size while the edu text is showing. It is shown for 10 seconds
and after that it is hidden by sliding upwards. This repositions the
PiP window so that it is placed properly (centered in case of expanded
pip).

This change introduces temporary decor insets - this is for the edu
text. Temporary decor insets don't interfere with the keep-clear area
algorithm - they will not cause the pip to move if they intersect with
a keep-clear area. They are only taken into account when calculating
the anchor bounds. Permanent decor insets are also taken into account
when calculating intersecting keep-clear areas

Bug: 219884907
Test: manual - start pip and check that the edu text is displayed and
      goes away after 10 seconds
Change-Id: Ie27c633c517903a4bf0b1544626bd00b621c19d4
parent d2d5e683
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2022 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:gravity="center">
    <item android:gravity="center">
        <shape
            android:shape="oval">
            <stroke
                android:color="@color/tv_pip_edu_text_home_icon"
                android:width="1sp" />
            <solid android:color="@android:color/transparent" />
            <size
                android:width="@dimen/pip_menu_edu_text_home_icon_outline"
                android:height="@dimen/pip_menu_edu_text_home_icon_outline"/>
        </shape>
    </item>
    <item
        android:width="@dimen/pip_menu_edu_text_home_icon"
        android:height="@dimen/pip_menu_edu_text_home_icon"
        android:gravity="center">
        <vector
            android:width="24sp"
            android:height="24sp"
            android:viewportWidth="24"
            android:viewportHeight="24">
            <path
                android:fillColor="@color/tv_pip_edu_text_home_icon"
                android:pathData="M12,3L4,9v12h5v-7h6v7h5V9z"/>
        </vector>
    </item>
</layer-list>
+52 −3
Original line number Diff line number Diff line
@@ -21,22 +21,36 @@
            android:layout_height="match_parent"
            android:gravity="center|top">

    <View
        android:id="@+id/tv_pip"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/pip_menu_outer_space"
        android:layout_marginStart="@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:gravity="center_horizontal"
        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:layout_margin="@dimen/pip_menu_outer_space"
        android:visibility="gone"/>

    <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:gravity="center_vertical"
        android:scrollbars="none"
        android:layout_margin="@dimen/pip_menu_outer_space">
        android:scrollbars="none">

        <LinearLayout
            android:id="@+id/tv_pip_menu_action_buttons"
@@ -89,6 +103,41 @@
        </LinearLayout>
    </HorizontalScrollView>

    <View
        android:id="@+id/tv_pip_border"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/pip_menu_outer_space_frame"
        android:layout_marginStart="@dimen/pip_menu_outer_space_frame"
        android:layout_marginEnd="@dimen/pip_menu_outer_space_frame"
        android:background="@drawable/tv_pip_menu_border"/>

    <FrameLayout
        android:id="@+id/tv_pip_menu_edu_text_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/tv_pip"
        android:layout_alignBottom="@+id/tv_pip_menu_frame"
        android:layout_alignStart="@+id/tv_pip"
        android:layout_alignEnd="@+id/tv_pip"
        android:background="@color/tv_pip_menu_background"
        android:clipChildren="true">

        <TextView
            android:id="@+id/tv_pip_menu_edu_text"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/pip_menu_edu_text_view_height"
            android:layout_gravity="bottom|center"
            android:gravity="center"
            android:paddingBottom="@dimen/pip_menu_border_width"
            android:text="@string/pip_edu_text"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="1"
            android:scrollHorizontally="true"
            android:textAppearance="@style/TvPipEduText"/>
    </FrameLayout>

    <View
        android:id="@+id/tv_pip_menu_frame"
        android:layout_width="match_parent"
+7 −0
Original line number Diff line number Diff line
@@ -37,5 +37,12 @@
    <dimen name="pip_menu_arrow_elevation">5dp</dimen>

    <dimen name="pip_menu_elevation">1dp</dimen>

    <dimen name="pip_menu_edu_text_view_height">24dp</dimen>
    <dimen name="pip_menu_edu_text_home_icon">9sp</dimen>
    <dimen name="pip_menu_edu_text_home_icon_outline">14sp</dimen>
    <integer name="pip_edu_text_show_duration_ms">10500</integer>
    <integer name="pip_edu_text_window_exit_animation_duration_ms">1000</integer>
    <integer name="pip_edu_text_view_exit_animation_duration_ms">300</integer>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -24,4 +24,7 @@
    <color name="tv_pip_menu_icon_bg_unfocused">#990E0E0F</color>
    <color name="tv_pip_menu_focus_border">#E8EAED</color>
    <color name="tv_pip_menu_background">#1E232C</color>

    <color name="tv_pip_edu_text">#99D2E3FC</color>
    <color name="tv_pip_edu_text_home_icon">#D2E3FC</color>
</resources>
+9 −0
Original line number Diff line number Diff line
@@ -47,4 +47,13 @@
        <item name="android:layout_width">96dp</item>
        <item name="android:layout_height">48dp</item>
    </style>

    <style name="TvPipEduText">
        <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
        <item name="android:textAllCaps">true</item>
        <item name="android:textSize">10sp</item>
        <item name="android:lineSpacingExtra">4sp</item>
        <item name="android:lineHeight">16sp</item>
        <item name="android:textColor">@color/tv_pip_edu_text</item>
    </style>
</resources>
Loading