OSDN Git Service

Eleven: Add equalizer visualization
[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
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 <LinearLayout
18     xmlns:android="http://schemas.android.com/apk/res/android"
19     android:layout_width="match_parent"
20     android:layout_height="match_parent"
21     android:orientation="vertical">
22
23     <include
24         android:id="@+id/audio_player_header"
25         layout="@layout/audio_player_header_bar" />
26
27     <com.cyngn.eleven.widgets.SquareFrame
28         android:layout_width="match_parent"
29         android:layout_height="match_parent">
30         <com.cyngn.eleven.widgets.SquareViewPager
31             android:id="@+id/audio_player_album_art_viewpager"
32             android:layout_width="match_parent"
33             android:layout_height="match_parent" />
34         <include layout="@layout/loading_empty_container" />
35
36         <View
37             android:id="@+id/equalizerGradient"
38             android:layout_width="match_parent"
39             android:layout_height="match_parent"
40             android:background="@drawable/equalizer_background"
41             android:layout_gravity="bottom"/>
42
43         <com.cyngn.eleven.widgets.EqualizerView
44             android:id="@+id/equalizerView"
45             android:gravity="bottom"
46             android:layout_gravity="bottom"
47             android:layout_width="match_parent"
48             android:layout_height="match_parent"
49             android:clipChildren="false"
50             android:clipToPadding="false"
51             android:visibility="visible" />
52     </com.cyngn.eleven.widgets.SquareFrame>
53
54     <RelativeLayout
55         android:layout_width="fill_parent"
56         android:layout_height="fill_parent" >
57         <com.cyngn.eleven.widgets.PlayPauseProgressButton
58             xmlns:android="http://schemas.android.com/apk/res/android"
59             android:id="@+id/playPauseProgressButton"
60             android:layout_width="@dimen/audio_player_controls_main_button_width"
61             android:layout_height="@dimen/audio_player_controls_main_button_height"
62             android:layout_centerInParent="true" >
63
64             <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
65             <com.cyngn.eleven.widgets.PlayPauseButton
66                 android:id="@+id/action_button_play"
67                 android:layout_width="match_parent"
68                 android:layout_height="match_parent"
69                 android:layout_gravity="center"
70                 android:contentDescription="@string/accessibility_play"
71                 android:focusable="true"
72                 android:scaleType="centerCrop"
73                 android:src="@drawable/btn_playback_play" />
74
75             <ProgressBar
76                 android:id="@+id/progressBarBackground"
77                 style="?android:attr/progressBarStyleHorizontal"
78                 android:layout_width="match_parent"
79                 android:layout_height="match_parent"
80                 android:clickable="false"
81                 android:indeterminate="false"
82                 android:max="100"
83                 android:progress="100"
84                 android:progressDrawable="@drawable/now_playing_progress_background" />
85
86             <ProgressBar
87                 android:id="@+id/circularProgressBar"
88                 style="?android:attr/progressBarStyleHorizontal"
89                 android:layout_width="match_parent"
90                 android:layout_height="match_parent"
91                 android:clickable="false"
92                 android:indeterminate="false"
93                 android:max="100"
94                 android:progressDrawable="@drawable/now_playing_progress" />
95         </com.cyngn.eleven.widgets.PlayPauseProgressButton>
96
97         <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
98         <!-- ANSWER: two issues (a) centerInside doesn't scale up, only down, use
99              fitCenter instead. Also, ImageButtons come with built-in padding, but
100              that only makes a visible difference when you are scaling the image.
101              so you have to set the padding to zero in order to get the result you expect -->
102         <!-- This is the left side of the progress bar - it has the previous
103         and shuffle button and the current time text -->
104         <RelativeLayout
105             android:layout_width="wrap_content"
106             android:layout_height="fill_parent"
107             android:layout_toLeftOf="@id/playPauseProgressButton">
108
109             <TextView
110                 android:id="@+id/audio_player_current_time"
111                 android:layout_width="52dp"
112                 android:layout_height="@dimen/audio_player_controls_end_button_height"
113                 android:gravity="left|center_vertical"
114                 android:layout_alignParentRight="true"
115                 android:layout_centerVertical="true"
116                 android:paddingLeft="@dimen/audio_player_time_text_padding"
117                 android:textColor="@color/audio_player_text_color"
118                 android:textSize="@dimen/audio_player_time_text_size"
119                 android:textStyle="bold"/>
120
121             <com.cyngn.eleven.widgets.RepeatingImageButton
122                 android:id="@+id/action_button_previous"
123                 android:layout_width="@dimen/audio_player_controls_end_button_width"
124                 android:layout_height="@dimen/audio_player_controls_end_button_height"
125                 android:layout_toLeftOf="@id/audio_player_current_time"
126                 android:layout_centerVertical="true"
127                 android:scaleType="fitCenter"
128                 android:src="@drawable/btn_playback_previous" />
129
130             <!-- divider -->
131             <View
132                 android:layout_height="@dimen/audio_player_divider_height"
133                 android:layout_width="@dimen/audio_player_divider_length"
134                 android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
135                 android:layout_marginBottom="@dimen/audio_player_divider_vertical_offset"
136                 android:layout_alignParentRight="true"
137                 android:layout_above="@id/audio_player_current_time"
138                 android:background="@color/now_playing_divider" />
139
140             <!-- divider -->
141             <View
142                 android:layout_height="@dimen/audio_player_divider_height"
143                 android:layout_width="@dimen/audio_player_divider_length"
144                 android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
145                 android:layout_marginTop="@dimen/audio_player_divider_vertical_offset"
146                 android:layout_alignParentRight="true"
147                 android:layout_below="@id/audio_player_current_time"
148                 android:background="@color/now_playing_divider" />
149
150             <com.cyngn.eleven.widgets.BrowseButton
151                 android:id="@+id/action_button_browse"
152                 android:layout_width="@dimen/audio_player_controls_end_button_width"
153                 android:layout_height="@dimen/audio_player_controls_end_button_height"
154                 android:layout_above="@id/action_button_previous"
155                 android:layout_alignLeft="@id/action_button_previous"
156                 android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
157                 android:layout_marginBottom="@dimen/audio_player_secondary_control_offset"
158                 android:contentDescription="@string/accessibility_browse"
159                 android:focusable="true"
160                 android:scaleType="fitCenter"
161                 android:src="@drawable/btn_playback_browse" />
162
163             <com.cyngn.eleven.widgets.ShuffleButton
164                 android:id="@+id/action_button_shuffle"
165                 android:layout_width="@dimen/audio_player_controls_end_button_width"
166                 android:layout_height="@dimen/audio_player_controls_end_button_height"
167                 android:layout_below="@id/action_button_previous"
168                 android:layout_alignLeft="@id/action_button_previous"
169                 android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
170                 android:layout_marginTop="@dimen/audio_player_secondary_control_offset"
171                 android:contentDescription="@string/accessibility_shuffle"
172                 android:scaleType="fitCenter"
173                 android:src="@drawable/btn_playback_shuffle_all" />
174         </RelativeLayout>
175
176         <!-- This is the right side of the progress bar - it has the next
177         and repeat button and the total time text -->
178         <RelativeLayout
179             android:layout_width="wrap_content"
180             android:layout_height="fill_parent"
181             android:layout_toRightOf="@id/playPauseProgressButton">
182
183             <TextView
184                 android:id="@+id/audio_player_total_time"
185                 android:layout_width="52dp"
186                 android:layout_height="@dimen/audio_player_controls_end_button_height"
187                 android:layout_alignParentLeft="true"
188                 android:layout_centerVertical="true"
189                 android:paddingRight="@dimen/audio_player_time_text_padding"
190                 android:gravity="right|center_vertical"
191                 android:textColor="@color/audio_player_text_color"
192                 android:textSize="@dimen/audio_player_time_text_size"
193                 android:textStyle="bold"/>
194
195             <com.cyngn.eleven.widgets.RepeatingImageButton
196                 android:id="@+id/action_button_next"
197                 android:layout_width="@dimen/audio_player_controls_end_button_width"
198                 android:layout_height="@dimen/audio_player_controls_end_button_height"
199                 android:layout_toRightOf="@id/audio_player_total_time"
200                 android:layout_centerVertical="true"
201                 android:scaleType="fitCenter"
202                 android:src="@drawable/btn_playback_next" />
203
204             <!-- divider -->
205             <View
206                 android:layout_height="@dimen/audio_player_divider_height"
207                 android:layout_width="@dimen/audio_player_divider_length"
208                 android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
209                 android:layout_marginBottom="@dimen/audio_player_divider_vertical_offset"
210                 android:layout_alignParentLeft="true"
211                 android:layout_above="@id/audio_player_total_time"
212                 android:background="@color/now_playing_divider" />
213
214             <!-- divider -->
215             <View
216                 android:layout_height="@dimen/audio_player_divider_height"
217                 android:layout_width="@dimen/audio_player_divider_length"
218                 android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
219                 android:layout_marginTop="@dimen/audio_player_divider_vertical_offset"
220                 android:layout_alignParentLeft="true"
221                 android:layout_below="@id/audio_player_total_time"
222                 android:background="@color/now_playing_divider" />
223
224             <com.cyngn.eleven.widgets.QueueButton
225                 android:id="@+id/action_button_queue"
226                 android:layout_width="@dimen/audio_player_controls_end_button_width"
227                 android:layout_height="@dimen/audio_player_controls_end_button_height"
228                 android:layout_above="@id/action_button_next"
229                 android:layout_alignRight="@id/action_button_next"
230                 android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
231                 android:layout_marginBottom="@dimen/audio_player_secondary_control_offset"
232                 android:contentDescription="@string/accessibility_queue"
233                 android:focusable="true"
234                 android:scaleType="fitCenter"
235                 android:src="@drawable/btn_queue_icon" />
236
237             <com.cyngn.eleven.widgets.RepeatButton
238                 android:id="@+id/action_button_repeat"
239                 android:layout_width="@dimen/audio_player_controls_end_button_width"
240                 android:layout_height="@dimen/audio_player_controls_end_button_height"
241                 android:layout_below="@id/action_button_next"
242                 android:layout_alignRight="@id/action_button_next"
243                 android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
244                 android:layout_marginTop="@dimen/audio_player_secondary_control_offset"
245                 android:contentDescription="@string/accessibility_repeat"
246                 android:focusable="true"
247                 android:scaleType="fitCenter"
248                 android:src="@drawable/btn_playback_repeat_all" />
249
250         </RelativeLayout>
251
252     </RelativeLayout>
253 </LinearLayout>