• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    NOTE: All panes have the same width. The preference pane and preview pane are merely visual
20    effects achieved by utilizing the overlay. In order to have different paddings for preference
21    pane and preview pane without compromising the smooth scroll animation, we must refrain from
22    flipping visibility between VISIBLE and GONE of extra View elements to use them as paddings.
23
24    Since the preference pane is designed to have larger paddingStart than the preview pane, we
25    achieved the desired visual effect by:
26    (1) Setting paddingStart for all panes (frame1, frame2, ...) to be the desired value of preview
27    pane paddingStart, denoted by Y.
28    (2) Adding two View elements (extra_padding and extra_padding_rtl) both with width denoted by X
29    at the very beginning and end within the TwoPanelScrollView, such that the sum of X and Y equals
30    to the desired value of preference pane visual paddingStart.
31    (3) Always slides the visible window of TwoPanelScrollView from 0 on X-axis by integer increment
32    of preference pane width.
33
34    Here are concrete examples to help us understand:
35    (1) When frame1 is the preference pane, the screen shows extra_padding, frame1 and part of
36    frame2 as preview pane. The combination of extra_padding and frame1's paddingStart consists the
37    visual paddingStart of preference pane.
38    (2) When we navigate to the next pane and frame2 becomes the preference pane, the screen shows a
39    small fraction of frame1's paddingEnd, frame2 and part of frame3 as preview pane. Because we
40    slide the visible window by an increment of preference pane width on X-axis, there will always
41    be exactly X amount of previous pane's blank paddingEnd blending into the real paddingStart of
42    current preference pane to consist the larger visual paddingStart.
43-->
44<com.android.tv.twopanelsettings.TwoPanelSettingsRootView
45    xmlns:android="http://schemas.android.com/apk/res/android"
46    android:id="@+id/two_panel_fragment_container"
47    android:layout_width="match_parent"
48    android:layout_height="match_parent"
49    android:orientation="horizontal"
50    android:background="@color/tp_fragment_container_background_color">
51
52    <com.android.tv.twopanelsettings.TwoPanelScrollView
53        android:id="@+id/scrollview"
54        android:layout_width="@dimen/tp_settings_panes_width"
55        android:layout_height="match_parent"
56        android:scrollbars="none"
57        android:importantForAccessibility="no">
58
59        <LinearLayout
60            android:id="@+id/linearlayout"
61            android:orientation="horizontal"
62            android:layout_width="@dimen/tp_settings_panes_width"
63            android:layout_height="match_parent">
64
65            <!-- extra_padding, the extra paddingStart of preference pane -->
66            <FrameLayout
67                 android:background="@color/tp_preference_panel_background_color"
68                 android:layout_width="@dimen/preference_pane_extra_padding_start"
69                 android:layout_height="match_parent" />
70
71            <FrameLayout
72                android:id="@+id/frame1"
73                android:background="@color/tp_preference_panel_background_color"
74                android:layout_width="@dimen/tp_settings_preference_pane_width"
75                android:layout_height="match_parent"
76                android:paddingStart="@dimen/pane_basic_padding_start"
77                android:paddingEnd="@dimen/preference_pane_padding_end"
78                android:clipChildren="false"
79                android:clipToPadding="false">
80            </FrameLayout>
81
82            <FrameLayout
83                android:id="@+id/frame2"
84                android:background="@color/tp_preference_panel_background_color"
85                android:layout_width="@dimen/tp_settings_preference_pane_width"
86                android:layout_height="match_parent"
87                android:paddingStart="@dimen/pane_basic_padding_start"
88                android:paddingEnd="@dimen/preference_pane_padding_end"
89                android:clipChildren="false"
90                android:clipToPadding="false">
91            </FrameLayout>
92
93            <FrameLayout
94                android:id="@+id/frame3"
95                android:background="@color/tp_preference_panel_background_color"
96                android:layout_width="@dimen/tp_settings_preference_pane_width"
97                android:layout_height="match_parent"
98                android:paddingStart="@dimen/pane_basic_padding_start"
99                android:paddingEnd="@dimen/preference_pane_padding_end"
100                android:clipChildren="false"
101                android:clipToPadding="false">
102            </FrameLayout>
103
104            <FrameLayout
105                android:id="@+id/frame4"
106                android:background="@color/tp_preference_panel_background_color"
107                android:layout_width="@dimen/tp_settings_preference_pane_width"
108                android:layout_height="match_parent"
109                android:paddingStart="@dimen/pane_basic_padding_start"
110                android:paddingEnd="@dimen/preference_pane_padding_end"
111                android:clipChildren="false"
112                android:clipToPadding="false">
113            </FrameLayout>
114
115            <FrameLayout
116                android:id="@+id/frame5"
117                android:background="@color/tp_preference_panel_background_color"
118                android:layout_width="@dimen/tp_settings_preference_pane_width"
119                android:layout_height="match_parent"
120                android:paddingStart="@dimen/pane_basic_padding_start"
121                android:paddingEnd="@dimen/preference_pane_padding_end"
122                android:clipChildren="false"
123                android:clipToPadding="false">
124            </FrameLayout>
125
126            <FrameLayout
127                android:id="@+id/frame6"
128                android:background="@color/tp_preference_panel_background_color"
129                android:layout_width="@dimen/tp_settings_preference_pane_width"
130                android:layout_height="match_parent"
131                android:paddingStart="@dimen/pane_basic_padding_start"
132                android:paddingEnd="@dimen/preference_pane_padding_end"
133                android:clipChildren="false"
134                android:clipToPadding="false">
135            </FrameLayout>
136
137            <FrameLayout
138                android:id="@+id/frame7"
139                android:background="@color/tp_preference_panel_background_color"
140                android:layout_width="@dimen/tp_settings_preference_pane_width"
141                android:layout_height="match_parent"
142                android:paddingStart="@dimen/pane_basic_padding_start"
143                android:paddingEnd="@dimen/preference_pane_padding_end"
144                android:clipChildren="false"
145                android:clipToPadding="false">
146            </FrameLayout>
147
148            <FrameLayout
149                android:id="@+id/frame8"
150                android:background="@color/tp_preference_panel_background_color"
151                android:layout_width="@dimen/tp_settings_preference_pane_width"
152                android:layout_height="match_parent"
153                android:paddingStart="@dimen/pane_basic_padding_start"
154                android:paddingEnd="@dimen/preference_pane_padding_end"
155                android:clipChildren="false"
156                android:clipToPadding="false">
157            </FrameLayout>
158
159            <FrameLayout
160                android:id="@+id/frame9"
161                android:background="@color/tp_preference_panel_background_color"
162                android:layout_width="@dimen/tp_settings_preference_pane_width"
163                android:layout_height="match_parent"
164                android:paddingStart="@dimen/pane_basic_padding_start"
165                android:paddingEnd="@dimen/preference_pane_padding_end"
166                android:clipChildren="false"
167                android:clipToPadding="false">
168            </FrameLayout>
169
170            <FrameLayout
171                android:id="@+id/frame10"
172                android:background="@color/tp_preference_panel_background_color"
173                android:layout_width="@dimen/tp_settings_preference_pane_width"
174                android:layout_height="match_parent"
175                android:paddingStart="@dimen/pane_basic_padding_start"
176                android:paddingEnd="@dimen/preference_pane_padding_end"
177                android:clipChildren="false"
178                android:clipToPadding="false">
179            </FrameLayout>
180
181            <!-- extra_padding_rtl, the extra paddingStart of preference pane in RTL -->
182            <FrameLayout
183                android:background="@color/tp_preference_panel_background_color"
184                android:layout_width="@dimen/preference_pane_extra_padding_start"
185                android:layout_height="match_parent" />
186
187        </LinearLayout>
188    </com.android.tv.twopanelsettings.TwoPanelScrollView>
189
190</com.android.tv.twopanelsettings.TwoPanelSettingsRootView>
191