• 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="@drawable/background_gradient">
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            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
66                android:id="@+id/frame1"
67                android:background="@color/tp_preference_panel_background_color"
68                android:layout_width="@dimen/tp_settings_preference_pane_width"
69                android:layout_height="match_parent"
70                android:paddingEnd="@dimen/preference_pane_padding_end"
71                android:clipChildren="false"
72                android:clipToPadding="false">
73            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
74
75            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
76                android:id="@+id/frame2"
77                android:background="@color/tp_preference_panel_background_color"
78                android:layout_width="@dimen/tp_settings_preference_pane_width"
79                android:layout_height="match_parent"
80                android:paddingEnd="@dimen/preference_pane_padding_end"
81                android:clipChildren="false"
82                android:clipToPadding="false">
83            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
84
85            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
86                android:id="@+id/frame3"
87                android:background="@color/tp_preference_panel_background_color"
88                android:layout_width="@dimen/tp_settings_preference_pane_width"
89                android:layout_height="match_parent"
90                android:paddingEnd="@dimen/preference_pane_padding_end"
91                android:clipChildren="false"
92                android:clipToPadding="false">
93            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
94
95            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
96                android:id="@+id/frame4"
97                android:background="@color/tp_preference_panel_background_color"
98                android:layout_width="@dimen/tp_settings_preference_pane_width"
99                android:layout_height="match_parent"
100                android:paddingEnd="@dimen/preference_pane_padding_end"
101                android:clipChildren="false"
102                android:clipToPadding="false">
103            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
104
105            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
106                android:id="@+id/frame5"
107                android:background="@color/tp_preference_panel_background_color"
108                android:layout_width="@dimen/tp_settings_preference_pane_width"
109                android:layout_height="match_parent"
110                android:paddingEnd="@dimen/preference_pane_padding_end"
111                android:clipChildren="false"
112                android:clipToPadding="false">
113            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
114
115            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
116                android:id="@+id/frame6"
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:paddingEnd="@dimen/preference_pane_padding_end"
121                android:clipChildren="false"
122                android:clipToPadding="false">
123            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
124
125            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
126                android:id="@+id/frame7"
127                android:background="@color/tp_preference_panel_background_color"
128                android:layout_width="@dimen/tp_settings_preference_pane_width"
129                android:layout_height="match_parent"
130                android:paddingEnd="@dimen/preference_pane_padding_end"
131                android:clipChildren="false"
132                android:clipToPadding="false">
133            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
134
135            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
136                android:id="@+id/frame8"
137                android:background="@color/tp_preference_panel_background_color"
138                android:layout_width="@dimen/tp_settings_preference_pane_width"
139                android:layout_height="match_parent"
140                android:paddingEnd="@dimen/preference_pane_padding_end"
141                android:clipChildren="false"
142                android:clipToPadding="false">
143            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
144
145            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
146                android:id="@+id/frame9"
147                android:background="@color/tp_preference_panel_background_color"
148                android:layout_width="@dimen/tp_settings_preference_pane_width"
149                android:layout_height="match_parent"
150                android:paddingEnd="@dimen/preference_pane_padding_end"
151                android:clipChildren="false"
152                android:clipToPadding="false">
153            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
154
155            <com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout
156                android:id="@+id/frame10"
157                android:background="@color/tp_preference_panel_background_color"
158                android:layout_width="@dimen/tp_settings_preference_pane_width"
159                android:layout_height="match_parent"
160                android:paddingEnd="@dimen/preference_pane_padding_end"
161                android:clipChildren="false"
162                android:clipToPadding="false">
163            </com.android.tv.twopanelsettings.TwoPanelSettingsFrameLayout>
164
165        </LinearLayout>
166    </com.android.tv.twopanelsettings.TwoPanelScrollView>
167
168</com.android.tv.twopanelsettings.TwoPanelSettingsRootView>
169