Merged the two music controller layouts into one.
This commit is contained in:
parent
e4799143c4
commit
4db8e8d302
3 changed files with 80 additions and 244 deletions
|
|
@ -95,15 +95,13 @@ public class MusicControllerActivity extends AbsFabActivity {
|
|||
ImageView albumArtBackground;
|
||||
@InjectView(R.id.album_art)
|
||||
SquareIfPlaceImageView albumArt;
|
||||
@InjectView(R.id.song_current_progress)
|
||||
TextView songCurrentProgress;
|
||||
@InjectView(R.id.song_total_time)
|
||||
TextView songTotalTime;
|
||||
@InjectView(R.id.progress_slider)
|
||||
SeekBar progressSlider;
|
||||
@InjectView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
TextView songCurrentProgress;
|
||||
TextView songTotalTime;
|
||||
SeekBar progressSlider;
|
||||
|
||||
private int lastFooterColor = -1;
|
||||
private int lastTextColor = -2;
|
||||
|
||||
|
|
@ -126,11 +124,11 @@ public class MusicControllerActivity extends AbsFabActivity {
|
|||
setStatusBarTransparent();
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_music_controller);
|
||||
ButterKnife.inject(this);
|
||||
|
||||
initAppearanceVarsFromSharedPrefs();
|
||||
|
||||
setContentView(alternativeProgressSlider ? R.layout.activity_music_controller_alternative_progress_slider : R.layout.activity_music_controller);
|
||||
ButterKnife.inject(this);
|
||||
initProgressSliderDependentViews();
|
||||
|
||||
moveSeekBarIntoPlace();
|
||||
adjustTitleBoxSize();
|
||||
|
|
@ -143,6 +141,22 @@ public class MusicControllerActivity extends AbsFabActivity {
|
|||
updateCurrentSong();
|
||||
}
|
||||
|
||||
private void initProgressSliderDependentViews() {
|
||||
if (alternativeProgressSlider) {
|
||||
findViewById(R.id.default_progress_container).setVisibility(View.GONE);
|
||||
findViewById(R.id.default_progress_slider).setVisibility(View.GONE);
|
||||
findViewById(R.id.alternative_progress_container).setVisibility(View.VISIBLE);
|
||||
|
||||
songCurrentProgress = (TextView) findViewById(R.id.alternative_song_current_progress);
|
||||
songTotalTime = (TextView) findViewById(R.id.alternative_song_total_time);
|
||||
progressSlider = (SeekBar) findViewById(R.id.alternative_progress_slider);
|
||||
} else {
|
||||
songCurrentProgress = (TextView) findViewById(R.id.default_song_current_progress);
|
||||
songTotalTime = (TextView) findViewById(R.id.default_song_total_time);
|
||||
progressSlider = (SeekBar) findViewById(R.id.default_progress_slider);
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpAlbumArtViews() {
|
||||
albumArtBackground.setAlpha(0.7f);
|
||||
albumArt.forceSquare(forceSquareAlbumArt);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,53 @@
|
|||
android:background="?android:colorBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/alternative_progress_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/progress_container_height"
|
||||
android:background="?music_controller_container_color"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
android:visibility="gone"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alternative_song_current_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical|left|end"
|
||||
android:paddingLeft="8dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?themed_drawable_color"
|
||||
android:textSize="10sp"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry,SmallSp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alternative_song_total_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical|right|end"
|
||||
android:paddingRight="8dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?themed_drawable_color"
|
||||
android:textSize="10sp"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry,SmallSp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/alternative_progress_slider"
|
||||
style="@style/MusicProgressSlider"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toLeftOf="@id/alternative_song_total_time"
|
||||
android:layout_toRightOf="@id/alternative_song_current_progress"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/footer"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -58,15 +105,14 @@
|
|||
tools:ignore="ContentDescription,UnusedAttribute">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
app:cardBackgroundColor="?music_controller_container_color"
|
||||
android:id="@+id/playback_controller_card"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp" />
|
||||
android:layout_margin="16dp"
|
||||
android:visibility="gone"
|
||||
app:cardBackgroundColor="?music_controller_container_color" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/prev_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
|
|
@ -76,12 +122,12 @@
|
|||
android:layout_toLeftOf="@+id/fab"
|
||||
android:layout_toStartOf="@+id/fab"
|
||||
android:background="?round_selector"
|
||||
android:elevation="8dp"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_previous_white_48dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
|
|
@ -91,12 +137,12 @@
|
|||
android:layout_toEndOf="@+id/fab"
|
||||
android:layout_toRightOf="@+id/fab"
|
||||
android:background="?round_selector"
|
||||
android:elevation="8dp"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_next_white_48dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/repeat_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
|
|
@ -106,12 +152,12 @@
|
|||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:background="?round_selector"
|
||||
android:elevation="8dp"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_repeat_white_48dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/shuffle_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
|
|
@ -121,6 +167,7 @@
|
|||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:background="?round_selector"
|
||||
android:elevation="8dp"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_shuffle_white_48dp" />
|
||||
|
|
@ -162,14 +209,14 @@
|
|||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progress_container"
|
||||
android:id="@+id/default_progress_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/shadow_up">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_current_progress"
|
||||
android:id="@+id/default_song_current_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
|
|
@ -183,7 +230,7 @@
|
|||
tools:ignore="RtlHardcoded,RtlSymmetry,SmallSp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_total_time"
|
||||
android:id="@+id/default_song_total_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
|
|
@ -202,7 +249,7 @@
|
|||
<!-- PROGRESS SLIDER-->
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress_slider"
|
||||
android:id="@+id/default_progress_slider"
|
||||
style="@style/TraditionalMusicProgressSlider"
|
||||
android:layout_above="@+id/footer_frame"
|
||||
android:elevation="2dp"
|
||||
|
|
|
|||
|
|
@ -1,225 +0,0 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context="com.kabouzeid.gramophone.ui.activities.MusicControllerActivity">
|
||||
|
||||
<!-- BOTTOM-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/footer_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:colorBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progress_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/progress_container_height"
|
||||
android:background="?music_controller_container_color"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_current_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical|left|end"
|
||||
android:paddingLeft="8dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?themed_drawable_color"
|
||||
android:textSize="10sp"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry,SmallSp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_total_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical|right|end"
|
||||
android:paddingRight="8dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?themed_drawable_color"
|
||||
android:textSize="10sp"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry,SmallSp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress_slider"
|
||||
style="@style/MusicProgressSlider"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toLeftOf="@id/song_total_time"
|
||||
android:layout_toRightOf="@id/song_current_progress"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/footer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?default_bar_color"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/title_box_padding_large"
|
||||
android:paddingLeft="72dp"
|
||||
android:paddingRight="72dp"
|
||||
android:paddingTop="@dimen/title_box_padding_large"
|
||||
android:transitionName="@string/transition_album_text"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?attr/title_text_color" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_artist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
android:textColor="?attr/caption_text_color" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/media_controller_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/media_controller_container_height"
|
||||
android:background="?music_controller_container_color"
|
||||
tools:ignore="ContentDescription,UnusedAttribute">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
app:cardBackgroundColor="?music_controller_container_color"
|
||||
android:id="@+id/playback_controller_card"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/prev_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="@dimen/tmp_now_playing_skip_rewind_margin"
|
||||
android:layout_marginRight="@dimen/tmp_now_playing_skip_rewind_margin"
|
||||
android:layout_toLeftOf="@+id/fab"
|
||||
android:layout_toStartOf="@+id/fab"
|
||||
android:background="?round_selector"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_previous_white_48dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/tmp_now_playing_skip_rewind_margin"
|
||||
android:layout_marginStart="@dimen/tmp_now_playing_skip_rewind_margin"
|
||||
android:layout_toEndOf="@+id/fab"
|
||||
android:layout_toRightOf="@+id/fab"
|
||||
android:background="?round_selector"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_next_white_48dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/repeat_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:background="?round_selector"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_repeat_white_48dp" />
|
||||
|
||||
<ImageButton
|
||||
android:elevation="8dp"
|
||||
android:id="@+id/shuffle_button"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:background="?round_selector"
|
||||
android:padding="22dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_shuffle_white_48dp" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
style="@style/PlayPauseFab"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="0dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- ALBUMART-->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/album_art_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/footer_frame"
|
||||
android:background="@color/black">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/album_art_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<com.kabouzeid.gramophone.views.SquareIfPlaceImageView
|
||||
android:id="@+id/album_art"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_album_art"
|
||||
android:transitionName="@string/transition_album_cover"
|
||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
</FrameLayout>
|
||||
|
||||
<!-- TOOLBAR-->
|
||||
|
||||
<include layout="@layout/shadow_statusbar_actionbar" />
|
||||
|
||||
<include
|
||||
android:id="@+id/status_bar"
|
||||
layout="@layout/status_bar" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
android:layout_below="@id/status_bar"
|
||||
android:background="#00000000" />
|
||||
|
||||
</RelativeLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue