<!-- ICS to Jelly Bean -->
<uses-sdk
- android:minSdkVersion="16"
+ android:minSdkVersion="17"
android:targetSdkVersion="20" />
<!-- Used for caching and creating new playlists -->
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 Cyanogen, Inc.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:innerRadiusRatio="2.601"
+ android:thicknessRatio="8.666"
+ android:shape="ring">
+ <solid android:color="@color/circular_progress_bar" />
+</shape>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 Cyanogen, Inc.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:innerRadiusRatio="2.601"
+ android:thicknessRatio="8.666"
+ android:shape="ring">
+ <solid android:color="@color/circular_progress_bar_background" />
+</shape>
<include layout="@layout/bottom_action_bar" />
- <include
- android:id="@+id/firstHeaderBar"
- layout="@layout/header_bar" />
-
<fragment
android:id="@+id/audioPlayerFragment"
class="com.cyngn.eleven.ui.fragments.AudioPlayerFragment"
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 Andrew Neal
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_height="match_parent"
+ android:orientation="vertical">
- <LinearLayout
+ <include
+ android:id="@+id/audio_player_header"
+ layout="@layout/audio_player_header_bar" />
+
+ <com.cyngn.eleven.widgets.SquareViewPager
+ android:id="@+id/audio_player_album_art_viewpager"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent" />
+
+ <RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+ <com.cyngn.eleven.widgets.PlayPauseProgressButton
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/playPauseProgressButton"
+ android:layout_width="@dimen/audio_player_controls_main_button_width"
+ android:layout_height="@dimen/audio_player_controls_main_button_height"
+ android:layout_centerInParent="true" >
- <RelativeLayout
- android:id="@+id/album_art_section"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_above="@android:id/progress"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
- android:layout_alignParentTop="true" >
-
- <com.cyngn.eleven.widgets.SquareViewPager
- android:id="@+id/audio_player_album_art_viewpager"
+ <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
+ <com.cyngn.eleven.widgets.PlayPauseButton
+ android:id="@+id/action_button_play"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- </RelativeLayout>
-
- <!-- This is the add to playlist, track name and menu button -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:baselineAligned="false"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingBottom="@dimen/audio_player_header_padding_bottom">
-
- <ImageView
- android:id="@+id/action_button_add_to_playlist"
- android:layout_width="@dimen/audio_player_controls_top_button_width"
- android:layout_height="@dimen/audio_player_controls_top_button_height"
- android:layout_weight="0"
- android:scaleType="centerInside"
- android:src="@drawable/btn_add_to_playlist" />
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:contentDescription="@string/accessibility_play"
+ android:focusable="true"
+ android:scaleType="centerCrop"
+ android:src="@drawable/btn_playback_play_med" />
+
+ <ProgressBar
+ android:id="@+id/progressBarBackground"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clickable="false"
+ android:indeterminate="false"
+ android:max="100"
+ android:progress="100"
+ android:progressDrawable="@drawable/now_playing_progress_background" />
+
+ <ProgressBar
+ android:id="@+id/circularProgressBar"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clickable="false"
+ android:indeterminate="false"
+ android:max="100"
+ android:progressDrawable="@drawable/now_playing_progress" />
+ </com.cyngn.eleven.widgets.PlayPauseProgressButton>
+
+ <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
+ <!-- ANSWER: two issues (a) centerInside doesn't scale up, only down, use
+ fitCenter instead. Also, ImageButtons come with built-in padding, but
+ that only makes a visible difference when you are scaling the image.
+ so you have to set the padding to zero in order to get the result you expect -->
+ <!-- This is the left side of the progress bar - it has the previous
+ and shuffle button and the current time text -->
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:layout_toLeftOf="@id/playPauseProgressButton">
<TextView
- android:id="@+id/audio_player_track_name"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:gravity="center_horizontal"
- android:marqueeRepeatLimit="marquee_forever"
- android:paddingLeft="@dimen/audio_player_track_name_padding_side"
- android:paddingRight="@dimen/audio_player_track_name_padding_side"
- android:scrollHorizontally="true"
- android:singleLine="true"
+ android:id="@+id/audio_player_current_time"
+ android:layout_width="52dp"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:gravity="left|center_vertical"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:paddingLeft="@dimen/audio_player_time_text_padding"
android:textColor="@color/audio_player_text_color"
- android:textSize="@dimen/audio_player_track_text_size"
- android:textStyle="bold" />
-
- <ImageView
- android:id="@+id/action_button_menu"
- android:layout_width="@dimen/audio_player_controls_top_button_width"
- android:layout_height="@dimen/audio_player_controls_top_button_height"
- android:layout_weight="0"
- android:scaleType="centerInside"
- android:src="@drawable/menu_button_light" />
- </LinearLayout>
+ android:textSize="@dimen/audio_player_time_text_size"
+ android:textStyle="bold"/>
+
+ <com.cyngn.eleven.widgets.RepeatingImageButton
+ android:id="@+id/action_button_previous"
+ android:layout_width="@dimen/audio_player_controls_end_button_width"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_toLeftOf="@id/audio_player_current_time"
+ android:layout_centerVertical="true"
+ android:scaleType="fitCenter"
+ android:src="@drawable/btn_playback_previous" />
+
+ <!-- divider -->
+ <View
+ android:layout_height="@dimen/audio_player_divider_height"
+ android:layout_width="@dimen/audio_player_divider_length"
+ android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
+ android:layout_marginBottom="@dimen/audio_player_divider_vertical_offset"
+ android:layout_alignParentRight="true"
+ android:layout_above="@id/audio_player_current_time"
+ android:background="@color/now_playing_divider" />
+
+ <!-- divider -->
+ <View
+ android:layout_height="@dimen/audio_player_divider_height"
+ android:layout_width="@dimen/audio_player_divider_length"
+ android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
+ android:layout_marginTop="@dimen/audio_player_divider_vertical_offset"
+ android:layout_alignParentRight="true"
+ android:layout_below="@id/audio_player_current_time"
+ android:background="@color/now_playing_divider" />
+
+ <com.cyngn.eleven.widgets.BrowseButton
+ android:id="@+id/action_button_browse"
+ android:layout_width="@dimen/audio_player_controls_end_button_width"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_above="@id/action_button_previous"
+ android:layout_alignLeft="@id/action_button_previous"
+ android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
+ android:layout_marginBottom="@dimen/audio_player_secondary_control_offset"
+ android:contentDescription="@string/accessibility_browse"
+ android:focusable="true"
+ android:scaleType="fitCenter"
+ android:src="@drawable/btn_playback_browse" />
+
+ <com.cyngn.eleven.widgets.ShuffleButton
+ android:id="@+id/action_button_shuffle"
+ android:layout_width="@dimen/audio_player_controls_end_button_width"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_below="@id/action_button_previous"
+ android:layout_alignLeft="@id/action_button_previous"
+ android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
+ android:layout_marginTop="@dimen/audio_player_secondary_control_offset"
+ android:contentDescription="@string/accessibility_shuffle"
+ android:scaleType="fitCenter"
+ android:src="@drawable/btn_playback_shuffle_all" />
+ </RelativeLayout>
+ <!-- This is the right side of the progress bar - it has the next
+ and repeat button and the total time text -->
<RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <FrameLayout
- android:id="@+id/play_pause_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_alignParentTop="true"
- android:contentDescription="@string/accessibility_play">
- <include
- android:layout_width="@dimen/audio_player_controls_main_button_width"
- android:layout_height="@dimen/audio_player_controls_main_button_height"
- layout="@layout/play_pause_progress_button"/>
- </FrameLayout>
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:layout_toRightOf="@id/playPauseProgressButton">
- <!-- TODO: Figure out why scaleType: centerInside isn't properly scaling up -->
- <!-- This is the left side of the progress bar - it has the previous
- and shuffle button and the current time text -->
- <RelativeLayout
- android:layout_width="@dimen/audio_player_controls_side_width"
- android:layout_height="fill_parent"
- android:layout_toLeftOf="@id/play_pause_container"
- android:paddingTop="@dimen/audio_player_control_padding_top">
- <com.cyngn.eleven.widgets.RepeatingImageButton
- android:id="@+id/action_button_previous"
- android:layout_width="@dimen/audio_player_controls_end_button_width"
- android:layout_height="@dimen/audio_player_controls_end_button_height"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:scaleType="center"
- android:src="@drawable/btn_playback_previous" />
-
- <TextView
- android:id="@+id/audio_player_current_time"
- android:layout_width="fill_parent"
- android:layout_height="@dimen/audio_player_controls_end_button_height"
- android:gravity="center_vertical"
- android:layout_toRightOf="@id/action_button_previous"
- android:paddingLeft="@dimen/audio_player_time_text_padding"
- android:textColor="@color/audio_player_text_color"
- android:textSize="@dimen/audio_player_time_text_size"
- android:textStyle="bold"/>
-
- <com.cyngn.eleven.widgets.ShuffleButton
- android:id="@+id/action_button_shuffle"
- android:layout_width="@dimen/audio_player_controls_end_button_width"
- android:layout_height="@dimen/audio_player_controls_end_button_height"
- android:layout_below="@id/action_button_previous"
- android:layout_alignLeft="@id/audio_player_current_time"
- android:contentDescription="@string/accessibility_shuffle"
- android:scaleType="center"
- android:src="@drawable/btn_playback_shuffle_all" />
- </RelativeLayout>
-
- <!-- This is the right side of the progress bar - it has the next
- and repeat button and the total time text -->
- <RelativeLayout
- android:layout_width="@dimen/audio_player_controls_side_width"
- android:layout_height="fill_parent"
- android:layout_toRightOf="@id/play_pause_container"
- android:paddingTop="@dimen/audio_player_control_padding_top">
- <com.cyngn.eleven.widgets.RepeatingImageButton
- android:id="@+id/action_button_next"
- android:layout_width="@dimen/audio_player_controls_end_button_width"
- android:layout_height="@dimen/audio_player_controls_end_button_height"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"
- android:scaleType="center"
- android:src="@drawable/btn_playback_next" />
-
- <TextView
- android:id="@+id/audio_player_total_time"
- android:layout_width="fill_parent"
- android:layout_height="@dimen/audio_player_controls_end_button_height"
- android:layout_toLeftOf="@id/action_button_next"
- android:gravity="right|center_vertical"
- android:paddingRight="@dimen/audio_player_time_text_padding"
- android:textColor="@color/audio_player_text_color"
- android:textSize="@dimen/audio_player_time_text_size"
- android:textStyle="bold"/>
-
- <com.cyngn.eleven.widgets.RepeatButton
- android:id="@+id/action_button_repeat"
- android:layout_width="@dimen/audio_player_controls_end_button_width"
- android:layout_height="@dimen/audio_player_controls_end_button_height"
- android:layout_below="@id/action_button_next"
- android:layout_alignRight="@id/audio_player_total_time"
- android:contentDescription="@string/accessibility_repeat"
- android:focusable="true"
- android:scaleType="center"
- android:src="@drawable/btn_playback_repeat_all" />
-
- </RelativeLayout>
+ <TextView
+ android:id="@+id/audio_player_total_time"
+ android:layout_width="52dp"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:paddingRight="@dimen/audio_player_time_text_padding"
+ android:gravity="right|center_vertical"
+ android:textColor="@color/audio_player_text_color"
+ android:textSize="@dimen/audio_player_time_text_size"
+ android:textStyle="bold"/>
+
+ <com.cyngn.eleven.widgets.RepeatingImageButton
+ android:id="@+id/action_button_next"
+ android:layout_width="@dimen/audio_player_controls_end_button_width"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_toRightOf="@id/audio_player_total_time"
+ android:layout_centerVertical="true"
+ android:scaleType="fitCenter"
+ android:src="@drawable/btn_playback_next" />
+
+ <!-- divider -->
+ <View
+ android:layout_height="@dimen/audio_player_divider_height"
+ android:layout_width="@dimen/audio_player_divider_length"
+ android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
+ android:layout_marginBottom="@dimen/audio_player_divider_vertical_offset"
+ android:layout_alignParentLeft="true"
+ android:layout_above="@id/audio_player_total_time"
+ android:background="@color/now_playing_divider" />
+
+ <!-- divider -->
+ <View
+ android:layout_height="@dimen/audio_player_divider_height"
+ android:layout_width="@dimen/audio_player_divider_length"
+ android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
+ android:layout_marginTop="@dimen/audio_player_divider_vertical_offset"
+ android:layout_alignParentLeft="true"
+ android:layout_below="@id/audio_player_total_time"
+ android:background="@color/now_playing_divider" />
+
+ <com.cyngn.eleven.widgets.QueueButton
+ android:id="@+id/action_button_queue"
+ android:layout_width="@dimen/audio_player_controls_end_button_width"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_above="@id/action_button_next"
+ android:layout_alignRight="@id/action_button_next"
+ android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
+ android:layout_marginBottom="@dimen/audio_player_secondary_control_offset"
+ android:contentDescription="@string/accessibility_queue"
+ android:focusable="true"
+ android:scaleType="fitCenter"
+ android:src="@drawable/btn_queue_icon" />
+
+ <com.cyngn.eleven.widgets.RepeatButton
+ android:id="@+id/action_button_repeat"
+ android:layout_width="@dimen/audio_player_controls_end_button_width"
+ android:layout_height="@dimen/audio_player_controls_end_button_height"
+ android:layout_below="@id/action_button_next"
+ android:layout_alignRight="@id/action_button_next"
+ android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
+ android:layout_marginTop="@dimen/audio_player_secondary_control_offset"
+ android:contentDescription="@string/accessibility_repeat"
+ android:focusable="true"
+ android:scaleType="fitCenter"
+ android:src="@drawable/btn_playback_repeat_all" />
</RelativeLayout>
- </LinearLayout>
-</FrameLayout>
\ No newline at end of file
+
+ </RelativeLayout>
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<!--
+ Copyright (C) 2014 Cyanogen, Inc.
+-->
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="@dimen/header_bar_height"
+ android:orientation="horizontal"
+ android:paddingStart="@dimen/header_bar_padding_left"
+ android:paddingEnd="@dimen/header_bar_padding_right">
+
+ <LinearLayout
+ android:id="@+id/header_bar_button_container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_centerVertical="true"
+ android:layout_alignParentEnd="true">
+
+ <ImageView
+ android:id="@+id/header_bar_add_button"
+ android:layout_width="@dimen/header_bar_custom_button_width"
+ android:layout_height="@dimen/header_bar_custom_button_height"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="0"
+ android:layout_marginStart="@dimen/header_bar_button_padding"
+ android:layout_marginEnd="@dimen/header_bar_button_padding"
+ android:src="@drawable/btn_add_to_playlist"
+ android:scaleType="centerInside" />
+
+ <ImageView
+ android:id="@+id/header_bar_search_button"
+ android:layout_width="@dimen/header_bar_custom_button_width"
+ android:layout_height="@dimen/header_bar_custom_button_height"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="0"
+ android:layout_marginStart="@dimen/header_bar_button_padding"
+ android:layout_marginEnd="@dimen/header_bar_button_padding"
+ android:src="@drawable/ic_action_search"
+ android:scaleType="centerInside" />
+
+ <ImageView
+ android:id="@+id/header_bar_menu_button"
+ android:layout_width="@dimen/header_bar_menu_button_width"
+ android:layout_height="@dimen/header_bar_menu_button_height"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="0"
+ android:scaleType="centerInside"
+ android:layout_marginStart="@dimen/header_bar_button_padding"
+ android:src="@drawable/menu_button_light"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/header_bar_text_container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true"
+ android:layout_toStartOf="@id/header_bar_button_container">
+
+ <TextView
+ android:id="@+id/header_bar_song_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:textAllCaps="true"
+ android:textColor="@color/header_action_bar_text_color"
+ android:textSize="@dimen/text_size_medium"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/header_bar_artist_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingBottom="2dp"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:textAllCaps="true"
+ android:fontFamily="sans-serif-light"
+ android:textColor="@color/header_action_bar_text_color"
+ android:textSize="@dimen/text_size_micro" />
+ </LinearLayout>
+</RelativeLayout>
\ No newline at end of file
<!-- search no results text color -->
<color name="no_results">#ff231f20</color>
<color name="no_results_light">@color/white</color>
+
+ <color name="now_playing_divider">#40ffffff</color>
</resources>
<dimen name="playlist_detail_header_bottom_height">40.0dip</dimen>
<!-- Audio player Buttons (play/pause/shuffle/repeat/next/previous)-->
- <dimen name="audio_player_controls_end_button_width">30.0dip</dimen>
- <dimen name="audio_player_controls_end_button_height">30.0dip</dimen>
- <dimen name="audio_player_controls_main_button_width">80.0dip</dimen>
- <dimen name="audio_player_controls_main_button_height">80.0dip</dimen>
+ <dimen name="audio_player_controls_end_button_width">34.0dip</dimen>
+ <dimen name="audio_player_controls_end_button_height">34.0dip</dimen>
+ <dimen name="audio_player_controls_end_button_half_width">17.0dip</dimen>
+ <dimen name="audio_player_controls_main_button_width">100.0dip</dimen>
+ <dimen name="audio_player_controls_main_button_height">100.0dip</dimen>
<dimen name="audio_player_controls_top_button_width">26.0dip</dimen>
<dimen name="audio_player_controls_top_button_height">30.0dip</dimen>
<dimen name="audio_player_controls_side_width">83.0dip</dimen>
<dimen name="audio_player_control_padding_top">26.0dip</dimen>
+ <dimen name="audio_player_secondary_control_offset">16dp</dimen>
<!-- Audio player track text settings-->
<dimen name="audio_player_track_name_padding_side">36.0dip</dimen>
<dimen name="audio_player_track_text_size">14sp</dimen>
<!-- Audio player time text settings-->
- <dimen name="audio_player_time_text_padding">6.0dip</dimen>
- <dimen name="audio_player_time_text_size">12sp</dimen>
+ <dimen name="audio_player_time_text_padding">3.0dip</dimen>
+ <dimen name="audio_player_time_text_size">@dimen/text_size_micro</dimen>
+
+ <dimen name="audio_player_divider_length">86.0dip</dimen>
+ <dimen name="audio_player_divider_height">1.0dip</dimen>
+ <dimen name="audio_player_divider_vertical_offset">8.0dip</dimen>
+ <dimen name="audio_player_divider_horizontal_offset">8.0dip</dimen>
<!-- App Widgets -->
<dimen name="app_widget_large_min_width">250.0dip</dimen>
<dimen name="color_scheme_dialog_row_padding">8.0dip</dimen>
<!-- Sliding Panel -->
- <dimen name="sliding_panel_indicator_height">26.0dip</dimen>
+ <dimen name="sliding_panel_indicator_height">20.0dip</dimen>
<dimen name="sliding_panel_shadow_height">0.0dip</dimen>
<!-- Header Bar -->
+ <dimen name="header_bar_height">50.0dip</dimen>
<dimen name="header_bar_up_width">30.0dip</dimen>
<dimen name="header_bar_up_height">30.0dip</dimen>
- <dimen name="header_bar_menu_button_width">30.0dip</dimen>
+ <dimen name="header_bar_menu_button_width">24.0dip</dimen>
<dimen name="header_bar_menu_button_height">30.0dip</dimen>
<dimen name="header_bar_custom_button_width">30.0dip</dimen>
<dimen name="header_bar_custom_button_height">30.0dip</dimen>
<dimen name="header_bar_button_padding_small">5.0dip</dimen>
<dimen name="header_bar_button_padding_large">10.0dip</dimen>
+ <dimen name="header_bar_padding_left">16.0dp</dimen>
+ <dimen name="header_bar_padding_right">8.0dp</dimen>
+ <dimen name="header_bar_button_container_padding">8.0dp</dimen>
+ <dimen name="header_bar_button_padding">6.0dp</dimen>
<!-- Title Page Indicator Settings -->
<dimen name="tpi_height">50dp</dimen>
<string name="accessibility_repeat">Repeat</string>
<string name="accessibility_repeat_all">Repeat all</string>
<string name="accessibility_repeat_one">Repeat one</string>
+ <string name="accessibility_queue">Open Queue</string>
+ <string name="accessibility_browse">Browse Music</string>
<!-- Toast messages -->
<string name="set_as_ringtone">\'<xliff:g id="name" example="Alarm Bell">%s</xliff:g>\' set as ringtone</string>
}
/**
- * @param text set the title text
+ * @param resId set the title text
*/
public void setTitleText(int resId) {
mTitleText.setText(resId);
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
-import android.view.ViewStub;
import android.widget.LinearLayout;
import com.cyngn.eleven.R;
*/
public class SlidingPanelActivity extends BaseActivity {
- enum Panel {
+ public enum Panel {
Browse,
MusicPlayer,
Queue,
}
private SlidingUpPanelLayout mFirstPanel;
- private HeaderBar mFirstHeaderBar;
private SlidingUpPanelLayout mSecondPanel;
protected Panel mTargetNavigatePanel;
}
});
- // setup the header bar
- mFirstHeaderBar = setupHeaderBar(R.id.firstHeaderBar, R.string.page_now_playing,
- R.drawable.btn_queue_icon, mShowQueue, mShowBrowse);
+
}
private void setupSecondPanel() {
showPanel(Panel.MusicPlayer);
}
- protected void showPanel(Panel panel) {
+ public void showPanel(Panel panel) {
// TODO: Add ability to do this instantaneously as opposed to animate
switch (panel) {
case Browse:
public void clearMetaInfo() {
super.clearMetaInfo();
mBlurScrimImage.transitionToDefaultState();
- mFirstHeaderBar.setTitleText("");
}
@Override
// load the blurred image
mBlurScrimImage.loadBlurImage(ApolloUtils.getImageFetcher(this));
-
- // Set the artist name
- mFirstHeaderBar.setTitleText(MusicUtils.getArtistName());
}
protected AudioPlayerFragment getAudioPlayerFragment() {
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
+import android.provider.MediaStore.Audio.Albums;
+import android.provider.MediaStore.Audio.Artists;
+import android.provider.MediaStore.Audio.Playlists;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
-
-import android.provider.MediaStore.Audio.Playlists;
-import android.provider.MediaStore.Audio.Albums;
-import android.provider.MediaStore.Audio.Artists;
import com.cyngn.eleven.MusicPlaybackService;
import com.cyngn.eleven.R;
import com.cyngn.eleven.adapters.AlbumArtPagerAdapter;
import com.cyngn.eleven.utils.ApolloUtils;
import com.cyngn.eleven.utils.MusicUtils;
import com.cyngn.eleven.utils.NavUtils;
+import com.cyngn.eleven.widgets.BrowseButton;
import com.cyngn.eleven.widgets.PlayPauseProgressButton;
+import com.cyngn.eleven.widgets.QueueButton;
import com.cyngn.eleven.widgets.RepeatButton;
import com.cyngn.eleven.widgets.RepeatingImageButton;
import com.cyngn.eleven.widgets.ShuffleButton;
// fragment view
private ViewGroup mRootView;
+ // Header views
+ private TextView mSongTitle;
+ private TextView mArtistName;
+
+ // Playlist Button
+ private ImageView mAddToPlaylistButton;
+
+ // Menu Button
+ private ImageView mMenuButton;
+
// Message to refresh the time
private static final int REFRESH_TIME = 1;
// Next button
private RepeatingImageButton mNextButton;
- // Playlist button
- private ImageView mAddToPlaylistButton;
-
- // Menu button
- private ImageView mMenuButton;
-
- // Track name
- private TextView mTrackName;
+ private BrowseButton mBrowseButton;
+ private QueueButton mQueueButton;
// Album art ListView
private ViewPager mAlbumArtViewPager;
final Bundle savedInstanceState) {
// The View for the fragment's UI
mRootView = (ViewGroup) inflater.inflate(R.layout.activity_player_fragment, null);
+
+ // Header title values
+ initHeaderBar();
+
initPlaybackControls();
return mRootView;
}
}
/**
- * Initializes the items in the now playing screen
+ * Initializes the header bar
*/
- @SuppressWarnings("deprecation")
- private void initPlaybackControls() {
- // Play and pause button
- mPlayPauseProgressButton = (PlayPauseProgressButton)mRootView.findViewById(R.id.playPauseProgressButton);
- // Shuffle button
- mShuffleButton = (ShuffleButton)mRootView.findViewById(R.id.action_button_shuffle);
- // Repeat button
- mRepeatButton = (RepeatButton)mRootView.findViewById(R.id.action_button_repeat);
- // Previous button
- mPreviousButton = (RepeatingImageButton)mRootView.findViewById(R.id.action_button_previous);
- // Next button
- mNextButton = (RepeatingImageButton)mRootView.findViewById(R.id.action_button_next);
- // Track name
- mTrackName = (TextView)mRootView.findViewById(R.id.audio_player_track_name);
- mTrackName.setSelected(true);
- mTrackName.setOnClickListener(mOpenAlbumProfile);
+ private void initHeaderBar() {
+ // Title text
+ mSongTitle = (TextView) mRootView.findViewById(R.id.header_bar_song_title);
+ mArtistName = (TextView) mRootView.findViewById(R.id.header_bar_artist_title);
+
+ // Buttons
+ // Search Button
+ View v = mRootView.findViewById(R.id.header_bar_search_button);
+ v.setBackground(new HoloSelector(getActivity()));
+ v.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ NavUtils.openSearch(getActivity(), "");
+ }
+ });
+ // Add to Playlist Button
// Setup the playlist button - add a click listener to show the context
- mAddToPlaylistButton = (ImageView)mRootView.findViewById(R.id.action_button_add_to_playlist);
+ mAddToPlaylistButton = (ImageView) mRootView.findViewById(R.id.header_bar_add_button);
mAddToPlaylistButton.setBackground(new HoloSelector(getActivity()));
// Create the context menu when requested
}
});
+ // Add the menu button
// menu button
- mMenuButton = (ImageView)mRootView.findViewById(R.id.action_button_menu);
+ mMenuButton = (ImageView) mRootView.findViewById(R.id.header_bar_menu_button);
mMenuButton.setBackground(new HoloSelector(getActivity()));
mMenuButton.setOnClickListener(new View.OnClickListener() {
@Override
showPopupMenu();
}
});
+ }
+ /**
+ * Initializes the items in the now playing screen
+ */
+ private void initPlaybackControls() {
+ mPlayPauseProgressButton = (PlayPauseProgressButton)mRootView.findViewById(R.id.playPauseProgressButton);
+ mShuffleButton = (ShuffleButton)mRootView.findViewById(R.id.action_button_shuffle);
+ mRepeatButton = (RepeatButton)mRootView.findViewById(R.id.action_button_repeat);
+ mPreviousButton = (RepeatingImageButton)mRootView.findViewById(R.id.action_button_previous);
+ mNextButton = (RepeatingImageButton)mRootView.findViewById(R.id.action_button_next);
+ mBrowseButton = (BrowseButton)mRootView.findViewById(R.id.action_button_browse);
+ mBrowseButton.setActivity(getActivity());
+ mQueueButton = (QueueButton)mRootView.findViewById(R.id.action_button_queue);
+ mQueueButton.setActivity(getActivity());
// Album art view pager
mAlbumArtViewPager = (ViewPager)mRootView.findViewById(R.id.audio_player_album_art_viewpager);
// Total time
mTotalTime = (TextView)mRootView.findViewById(R.id.audio_player_total_time);
- // Set the repeat listner for the previous button
+ // Set the repeat listener for the previous button
mPreviousButton.setRepeatListener(mRewindListener);
- // Set the repeat listner for the next button
+ // Set the repeat listener for the next button
mNextButton.setRepeatListener(mFastForwardListener);
mPlayPauseProgressButton.enableAndShow();
*/
private void updateNowPlayingInfo() {
// Set the track name
- mTrackName.setText(MusicUtils.getTrackName());
+ mSongTitle.setText(MusicUtils.getTrackName());
+ mArtistName.setText(MusicUtils.getArtistName());
// Set the total time
String totalTime = MusicUtils.makeShortTimeString(getActivity(), MusicUtils.duration() / 1000);
final long pos = mPosOverride < 0 ? MusicUtils.position() : mPosOverride;
if (pos >= 0 && MusicUtils.duration() > 0) {
refreshCurrentTimeText(pos);
- final int progress = (int)(1000 * pos / MusicUtils.duration());
if (mFromTouch) {
return 500;
}
};
- /**
- * Opens to the current album profile
- */
- private final View.OnClickListener mOpenAlbumProfile = new View.OnClickListener() {
-
- @Override
- public void onClick(final View v) {
- NavUtils.openAlbumProfile(getActivity(), MusicUtils.getAlbumName(),
- MusicUtils.getArtistName(), MusicUtils.getCurrentAlbumId());
- }
- };
-
public void showPopupMenu() {
// create the popup menu
if (mPopupMenu == null) {
--- /dev/null
+package com.cyngn.eleven.widgets;
+import android.content.Context;
+import android.support.v4.app.FragmentActivity;
+import android.util.AttributeSet;
+
+import com.cyngn.eleven.ui.activities.SlidingPanelActivity;
+
+public abstract class AudioActivityButton extends AudioButton {
+ protected SlidingPanelActivity mActivity;
+
+ public AudioActivityButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public void setActivity(FragmentActivity activity) {
+ mActivity = (SlidingPanelActivity)activity;
+ }
+}
\ No newline at end of file
--- /dev/null
+package com.cyngn.eleven.widgets;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
+import android.widget.ImageButton;
+
+import com.cyngn.eleven.utils.ApolloUtils;
+import com.cyngn.eleven.widgets.theme.HoloSelector;
+
+public abstract class AudioButton extends ImageButton implements OnClickListener, OnLongClickListener {
+ public static float ACTIVE_ALPHA = 1.0f;
+ public static float INACTIVE_ALPHA = 0.4f;
+
+ @SuppressWarnings("deprecation")
+ public AudioButton(final Context context, final AttributeSet attrs) {
+ super(context, attrs);
+ // Theme the selector
+ setPadding(0, 0, 0, 0);
+ setBackgroundDrawable(new HoloSelector(context));
+ // Control playback (cycle shuffle)
+ setOnClickListener(this);
+ // Show the cheat sheet
+ setOnLongClickListener(this);
+ }
+
+ @Override
+ public boolean onLongClick(final View view) {
+ if (TextUtils.isEmpty(view.getContentDescription())) {
+ return false;
+ } else {
+ ApolloUtils.showCheatSheet(view);
+ return true;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package com.cyngn.eleven.widgets;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import com.cyngn.eleven.ui.activities.SlidingPanelActivity;
+
+public class BrowseButton extends AudioActivityButton {
+
+ public BrowseButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void onClick(View view) {
+ mActivity.showPanel(SlidingPanelActivity.Panel.Browse);
+ }
+}
\ No newline at end of file
import android.content.Context;
import android.util.AttributeSet;
+import android.util.Log;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
// Make the play pause button size dependent on the container size
int horizontalPadding = getMeasuredWidth() / 4;
int verticalPadding = getMeasuredHeight() / 4;
- mPlayPauseButton.setPadding(horizontalPadding, horizontalPadding,
+ mPlayPauseButton.setPadding(
+ horizontalPadding, horizontalPadding,
verticalPadding, verticalPadding);
// rotate the progress bar 90 degrees counter clockwise so that the
--- /dev/null
+package com.cyngn.eleven.widgets;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import com.cyngn.eleven.ui.activities.SlidingPanelActivity;
+
+public class QueueButton extends AudioActivityButton {
+
+ public QueueButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void onClick(View view) {
+ mActivity.showPanel(SlidingPanelActivity.Panel.Queue);
+ }
+}
\ No newline at end of file
package com.cyngn.eleven.widgets;
import android.content.Context;
-import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
import android.widget.ImageButton;
import com.cyngn.eleven.MusicPlaybackService;
import com.cyngn.eleven.R;
-import com.cyngn.eleven.utils.ApolloUtils;
import com.cyngn.eleven.utils.MusicUtils;
-import com.cyngn.eleven.widgets.theme.HoloSelector;
/**
* A custom {@link ImageButton} that represents the "repeat" button.
*
* @author Andrew Neal (andrewdneal@gmail.com)
*/
-public class RepeatButton extends ImageButton implements OnClickListener, OnLongClickListener {
- public static float ACTIVE_ALPHA = 1.0f;
- public static float INACTIVE_ALPHA = 0.4f;
-
- /**
- * @param context The {@link Context} to use
- * @param attrs The attributes of the XML tag that is inflating the view.
- */
- @SuppressWarnings("deprecation")
+public class RepeatButton extends AudioButton {
public RepeatButton(final Context context, final AttributeSet attrs) {
super(context, attrs);
- // Set the selector
- setBackgroundDrawable(new HoloSelector(context));
- // Control playback (cycle repeat modes)
- setOnClickListener(this);
- // Show the cheat sheet
- setOnLongClickListener(this);
}
- /**
- * {@inheritDoc}
- */
@Override
public void onClick(final View v) {
MusicUtils.cycleRepeat();
updateRepeatState();
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onLongClick(final View view) {
- if (TextUtils.isEmpty(view.getContentDescription())) {
- return false;
- } else {
- ApolloUtils.showCheatSheet(view);
- return true;
- }
- }
-
- /**
- * Sets the correct drawable for the repeat state.
- */
+ /** Sets the correct drawable for the repeat state. */
public void updateRepeatState() {
switch (MusicUtils.getRepeatMode()) {
case MusicPlaybackService.REPEAT_ALL:
break;
}
}
-}
+}
\ No newline at end of file
*/
public class RepeatingImageButton extends ImageButton implements OnClickListener {
- /**
- * Next button theme resource
- */
- private static final String NEXT = "btn_playback_next";
-
- /**
- * Previous button theme resource
- */
- private static final String PREVIOUS = "btn_playback_previous";
-
private static final long sInterval = 400;
private long mStartTime;
public RepeatingImageButton(final Context context, final AttributeSet attrs) {
super(context, attrs);
// Theme the selector
+ setPadding(0, 0, 0, 0);
setBackgroundDrawable(new HoloSelector(context));
setFocusable(true);
setLongClickable(true);
package com.cyngn.eleven.widgets;
import android.content.Context;
-import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
-import android.widget.ImageButton;
import com.cyngn.eleven.MusicPlaybackService;
import com.cyngn.eleven.R;
-import com.cyngn.eleven.utils.ApolloUtils;
import com.cyngn.eleven.utils.MusicUtils;
-import com.cyngn.eleven.widgets.theme.HoloSelector;
/**
* @author Andrew Neal (andrewdneal@gmail.com)
*/
-public class ShuffleButton extends ImageButton implements OnClickListener, OnLongClickListener {
- public static float ACTIVE_ALPHA = 1.0f;
- public static float INACTIVE_ALPHA = 0.4f;
-
- /**
- * @param context The {@link Context} to use
- * @param attrs The attributes of the XML tag that is inflating the view.
- */
- @SuppressWarnings("deprecation")
+public class ShuffleButton extends AudioButton {
public ShuffleButton(final Context context, final AttributeSet attrs) {
super(context, attrs);
- // Theme the selector
- setBackgroundDrawable(new HoloSelector(context));
- // Control playback (cycle shuffle)
- setOnClickListener(this);
- // Show the cheat sheet
- setOnLongClickListener(this);
}
- /**
- * {@inheritDoc}
- */
@Override
public void onClick(final View v) {
MusicUtils.cycleShuffle();
updateShuffleState();
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onLongClick(final View view) {
- if (TextUtils.isEmpty(view.getContentDescription())) {
- return false;
- } else {
- ApolloUtils.showCheatSheet(view);
- return true;
- }
- }
-
- /**
- * Sets the correct drawable for the shuffle state.
- */
+ /** Sets the correct drawable for the shuffle state. */
public void updateShuffleState() {
switch (MusicUtils.getShuffleMode()) {
case MusicPlaybackService.SHUFFLE_NORMAL:
break;
}
}
-
-}
+}
\ No newline at end of file