OSDN Git Service

Make buttons more touch friendly.
[android-x86/packages-apps-Eleven.git] / res / layout / activity_player_fragment.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3   Copyright (C) 2012 Andrew Neal
4   Copyright (C) 2014 The CyanogenMod Project
5
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17 -->
18 <LinearLayout
19     xmlns:android="http://schemas.android.com/apk/res/android"
20     android:layout_width="match_parent"
21     android:layout_height="match_parent"
22     android:orientation="vertical">
23
24     <include
25         android:id="@+id/audio_player_header"
26         layout="@layout/audio_player_header_bar" />
27
28     <com.cyanogenmod.eleven.widgets.SquareFrame
29         android:layout_width="match_parent"
30         android:layout_height="match_parent">
31         <com.cyanogenmod.eleven.widgets.SquareViewPager
32             android:id="@+id/audio_player_album_art_viewpager"
33             android:layout_width="match_parent"
34             android:layout_height="match_parent" />
35         <include layout="@layout/loading_empty_container" />
36
37         <View
38             android:id="@+id/equalizerGradient"
39             android:layout_width="match_parent"
40             android:layout_height="match_parent"
41             android:background="@drawable/equalizer_background"
42             android:layout_gravity="bottom"/>
43
44         <com.cyanogenmod.eleven.widgets.EqualizerView
45             android:id="@+id/equalizerView"
46             android:gravity="bottom"
47             android:layout_gravity="bottom"
48             android:layout_width="match_parent"
49             android:layout_height="match_parent"
50             android:clipChildren="false"
51             android:clipToPadding="false"
52             android:visibility="visible" />
53
54         <TextView
55             android:id="@+id/audio_player_lyrics"
56             android:layout_gravity="center"
57             android:gravity="center"
58             android:layout_width="fill_parent"
59             android:layout_height="wrap_content"
60             android:minHeight="66dp"
61             android:paddingLeft="15dp"
62             android:paddingRight="15dp"
63             android:paddingTop="6dp"
64             android:paddingBottom="6dp"
65             android:background="@color/lyrics_background_color"
66             android:textColor="@color/white"
67             android:textSize="@dimen/text_size_small"
68             android:alpha="0.0"/>
69     </com.cyanogenmod.eleven.widgets.SquareFrame>
70
71     <RelativeLayout
72         android:layout_width="fill_parent"
73         android:layout_height="fill_parent"
74         android:background="@android:color/transparent" >
75         <com.cyanogenmod.eleven.widgets.PlayPauseProgressButton
76             android:id="@+id/playPauseProgressButton"
77             android:layout_width="@dimen/audio_player_controls_main_button_width"
78             android:layout_height="@dimen/audio_player_controls_main_button_height"
79             android:layout_centerInParent="true" >
80
81             <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
82             <com.cyanogenmod.eleven.widgets.PlayPauseButton
83                 android:id="@+id/action_button_play"
84                 android:layout_width="match_parent"
85                 android:layout_height="match_parent"
86                 android:layout_gravity="center"
87                 android:contentDescription="@string/accessibility_play"
88                 android:focusable="true"
89                 android:scaleType="centerCrop"
90                 android:src="@drawable/btn_playback_play" />
91
92             <ProgressBar
93                 android:id="@+id/progressBarBackground"
94                 style="?android:attr/progressBarStyleHorizontal"
95                 android:layout_width="match_parent"
96                 android:layout_height="match_parent"
97                 android:clickable="false"
98                 android:indeterminate="false"
99                 android:max="100"
100                 android:progress="100"
101                 android:progressDrawable="@drawable/now_playing_progress_background" />
102
103             <ProgressBar
104                 android:id="@+id/circularProgressBar"
105                 style="?android:attr/progressBarStyleHorizontal"
106                 android:layout_width="match_parent"
107                 android:layout_height="match_parent"
108                 android:clickable="false"
109                 android:indeterminate="false"
110                 android:max="100"
111                 android:progressDrawable="@drawable/now_playing_progress" />
112         </com.cyanogenmod.eleven.widgets.PlayPauseProgressButton>
113
114         <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
115         <!-- ANSWER: two issues (a) centerInside doesn't scale up, only down, use
116              fitCenter instead. Also, ImageButtons come with built-in padding, but
117              that only makes a visible difference when you are scaling the image.
118              so you have to set the padding to zero in order to get the result you expect -->
119         <!-- This is the left side of the progress bar - it has the previous
120         and shuffle button and the current time text -->
121         <RelativeLayout
122             android:layout_width="wrap_content"
123             android:layout_height="fill_parent"
124             android:layout_toLeftOf="@id/playPauseProgressButton">
125
126             <TextView
127                 android:id="@+id/audio_player_current_time"
128                 android:layout_width="52dp"
129                 android:layout_height="@dimen/audio_player_controls_end_button_height"
130                 android:gravity="left|center_vertical"
131                 android:layout_alignParentRight="true"
132                 android:layout_centerVertical="true"
133                 android:paddingLeft="@dimen/audio_player_time_text_padding"
134                 android:textColor="@color/audio_player_text_color"
135                 android:textSize="@dimen/audio_player_time_text_size"
136                 android:textStyle="bold"/>
137
138             <com.cyanogenmod.eleven.widgets.RepeatingImageButton
139                 android:id="@+id/action_button_previous"
140                 android:layout_width="@dimen/audio_player_controls_end_button_width"
141                 android:layout_height="@dimen/audio_player_controls_end_button_height"
142                 android:layout_toLeftOf="@id/audio_player_current_time"
143                 android:layout_centerVertical="true"
144                 android:scaleType="fitCenter"
145                 android:src="@drawable/btn_playback_previous" />
146
147             <!-- divider -->
148             <View
149                 android:id="@+id/action_button_left_top_divider"
150                 android:layout_height="@dimen/audio_player_divider_height"
151                 android:layout_width="@dimen/audio_player_divider_length"
152                 android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
153                 android:layout_alignParentRight="true"
154                 android:layout_above="@id/audio_player_current_time"
155                 android:background="@color/now_playing_divider" />
156
157             <!-- divider -->
158             <View
159                 android:id="@+id/action_button_left_bottom_divider"
160                 android:layout_height="@dimen/audio_player_divider_height"
161                 android:layout_width="@dimen/audio_player_divider_length"
162                 android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
163                 android:layout_alignParentRight="true"
164                 android:layout_below="@id/audio_player_current_time"
165                 android:background="@color/now_playing_divider" />
166
167             <com.cyanogenmod.eleven.widgets.BrowseButton
168                 android:id="@+id/action_button_browse"
169                 android:layout_width="@dimen/audio_player_controls_end_button_width"
170                 android:layout_height="@dimen/audio_player_controls_end_button_height"
171                 android:layout_above="@id/action_button_left_top_divider"
172                 android:layout_alignLeft="@id/action_button_previous"
173                 android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
174                 android:contentDescription="@string/accessibility_browse"
175                 android:focusable="true"
176                 android:scaleType="fitCenter"
177                 android:src="@drawable/btn_playback_browse" />
178
179             <com.cyanogenmod.eleven.widgets.ShuffleButton
180                 android:id="@+id/action_button_shuffle"
181                 android:layout_width="@dimen/audio_player_controls_end_button_width"
182                 android:layout_height="@dimen/audio_player_controls_end_button_height"
183                 android:layout_below="@id/action_button_left_bottom_divider"
184                 android:layout_alignLeft="@id/action_button_previous"
185                 android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
186                 android:contentDescription="@string/accessibility_shuffle"
187                 android:scaleType="fitCenter"
188                 android:src="@drawable/btn_playback_shuffle_all" />
189         </RelativeLayout>
190
191         <!-- This is the right side of the progress bar - it has the next
192         and repeat button and the total time text -->
193         <RelativeLayout
194             android:layout_width="wrap_content"
195             android:layout_height="fill_parent"
196             android:layout_toRightOf="@id/playPauseProgressButton">
197
198             <TextView
199                 android:id="@+id/audio_player_total_time"
200                 android:layout_width="52dp"
201                 android:layout_height="@dimen/audio_player_controls_end_button_height"
202                 android:layout_alignParentLeft="true"
203                 android:layout_centerVertical="true"
204                 android:paddingRight="@dimen/audio_player_time_text_padding"
205                 android:gravity="right|center_vertical"
206                 android:textColor="@color/audio_player_text_color"
207                 android:textSize="@dimen/audio_player_time_text_size"
208                 android:textStyle="bold"/>
209
210             <com.cyanogenmod.eleven.widgets.RepeatingImageButton
211                 android:id="@+id/action_button_next"
212                 android:layout_width="@dimen/audio_player_controls_end_button_width"
213                 android:layout_height="@dimen/audio_player_controls_end_button_height"
214                 android:layout_toRightOf="@id/audio_player_total_time"
215                 android:layout_centerVertical="true"
216                 android:scaleType="fitCenter"
217                 android:src="@drawable/btn_playback_next" />
218
219             <!-- divider -->
220             <View
221                 android:id="@+id/action_button_right_top_divider"
222                 android:layout_height="@dimen/audio_player_divider_height"
223                 android:layout_width="@dimen/audio_player_divider_length"
224                 android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
225                 android:layout_alignParentLeft="true"
226                 android:layout_above="@id/audio_player_total_time"
227                 android:background="@color/now_playing_divider" />
228
229             <!-- divider -->
230             <View
231                 android:id="@+id/action_button_right_bottom_divider"
232                 android:layout_height="@dimen/audio_player_divider_height"
233                 android:layout_width="@dimen/audio_player_divider_length"
234                 android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
235                 android:layout_alignParentLeft="true"
236                 android:layout_below="@id/audio_player_total_time"
237                 android:background="@color/now_playing_divider" />
238
239             <com.cyanogenmod.eleven.widgets.QueueButton
240                 android:id="@+id/action_button_queue"
241                 android:layout_width="@dimen/audio_player_controls_end_button_width"
242                 android:layout_height="@dimen/audio_player_controls_end_button_height"
243                 android:layout_above="@id/action_button_right_top_divider"
244                 android:layout_alignRight="@id/action_button_next"
245                 android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
246                 android:contentDescription="@string/accessibility_queue"
247                 android:focusable="true"
248                 android:scaleType="fitCenter"
249                 android:src="@drawable/btn_queue_icon" />
250
251             <com.cyanogenmod.eleven.widgets.RepeatButton
252                 android:id="@+id/action_button_repeat"
253                 android:layout_width="@dimen/audio_player_controls_end_button_width"
254                 android:layout_height="@dimen/audio_player_controls_end_button_height"
255                 android:layout_below="@id/action_button_right_bottom_divider"
256                 android:layout_alignRight="@id/action_button_next"
257                 android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
258                 android:contentDescription="@string/accessibility_repeat"
259                 android:focusable="true"
260                 android:scaleType="fitCenter"
261                 android:src="@drawable/btn_playback_repeat_all" />
262
263         </RelativeLayout>
264
265     </RelativeLayout>
266 </LinearLayout>