xref: /aosp_15_r20/development/samples/ApiDemos/res/layout/picture_in_picture.xml (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2018 The Android Open Source Project
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~      http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License.
16  -->
17
18<!--
19  Demonstrates Picture-In-Picture with various configurations.
20      - Enter PiP with on-screen button
21      - Enter PiP by swiping up to home or tap on home button
22      - Toggle the auto enter PiP flag on and off
23      - Toggle the source rect hint on and off
24      - Toggle the seamless resize flag on and off
25      - Change the position of current and next source rect hint
26      - Tablet layout on foldables
27      - Enter content PiP
28  -->
29<LinearLayout
30    xmlns:android="http://schemas.android.com/apk/res/android"
31    xmlns:app="http://schemas.android.com/apk/res-auto"
32    android:id="@+id/container"
33    android:layout_width="match_parent"
34    android:layout_height="match_parent"
35    android:orientation="vertical">
36
37    <!-- layout params would be changed programmatically -->
38    <include layout="@layout/picture_in_picture_content" />
39
40    <ScrollView
41        android:id="@+id/control_group"
42        android:layout_width="match_parent"
43        android:layout_height="0dp"
44        android:layout_weight="1">
45
46        <LinearLayout
47            android:layout_width="match_parent"
48            android:layout_height="match_parent"
49            android:orientation="vertical">
50
51            <TextView
52                android:id="@+id/text_to_hide"
53                android:layout_width="match_parent"
54                android:layout_height="wrap_content"
55                android:text="@string/activity_picture_in_picture_placeholder_text"
56                android:visibility="invisible" />
57
58            <Switch
59                android:id="@+id/auto_pip_toggle"
60                android:layout_width="match_parent"
61                android:layout_height="wrap_content"
62                android:padding="8dp"
63                android:text="@string/activity_picture_in_picture_auto_pip_toggle" />
64
65            <Switch
66                android:id="@+id/source_rect_hint_toggle"
67                android:layout_width="match_parent"
68                android:layout_height="wrap_content"
69                android:padding="8dp"
70                android:text="@string/activity_picture_in_picture_source_rect_hint_toggle" />
71
72            <Switch
73                android:id="@+id/seamless_resize_toggle"
74                android:layout_width="match_parent"
75                android:layout_height="wrap_content"
76                android:padding="8dp"
77                android:text="@string/activity_picture_in_picture_seamless_resize_toggle" />
78
79            <Switch
80                android:id="@+id/enter_pip_on_back"
81                android:layout_width="match_parent"
82                android:layout_height="wrap_content"
83                android:padding="8dp"
84                android:text="@string/activity_picture_in_picture_enter_pip_on_back_toggle" />
85
86            <RadioGroup
87                android:id="@+id/current_position"
88                android:layout_width="match_parent"
89                android:layout_height="wrap_content"
90                android:orientation="horizontal"
91                android:padding="8dp">
92
93                <TextView
94                    android:layout_width="wrap_content"
95                    android:layout_height="wrap_content"
96                    android:text="@string/label_current_position" />
97
98                <RadioButton
99                    android:id="@+id/radio_current_start"
100                    android:layout_width="wrap_content"
101                    android:layout_height="wrap_content"
102                    android:text="@string/label_position_start" />
103
104                <RadioButton
105                    android:id="@+id/radio_current_end"
106                    android:layout_width="wrap_content"
107                    android:layout_height="wrap_content"
108                    android:text="@string/label_position_end" />
109
110            </RadioGroup>
111
112            <LinearLayout
113                android:layout_width="match_parent"
114                android:layout_height="wrap_content"
115                android:padding="8dp"
116                android:orientation="horizontal">
117
118                <TextView
119                  android:layout_width="wrap_content"
120                  android:layout_height="wrap_content"
121                  android:text="@string/label_aspect_ratio" />
122
123                <Spinner
124                    android:id="@+id/aspect_ratio"
125                    android:layout_width="0dp"
126                    android:layout_height="wrap_content"
127                    android:layout_weight="1" />
128            </LinearLayout>
129
130            <Button
131                android:id="@+id/enter_pip_button"
132                android:layout_width="wrap_content"
133                android:layout_height="wrap_content"
134                android:text="@string/enter_picture_in_picture" />
135
136            <Button
137                android:id="@+id/enter_content_pip_button"
138                android:layout_width="wrap_content"
139                android:layout_height="wrap_content"
140                android:text="@string/enter_content_pip" />
141
142        </LinearLayout>
143
144    </ScrollView>
145
146</LinearLayout>
147