Added better transitions for now playing screen. Also added some dummy views to test the new look.
This commit is contained in:
parent
9193f63c18
commit
234b8d4a6a
3 changed files with 62 additions and 10 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.player;
|
package com.kabouzeid.gramophone.ui.fragments.player;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
@ -17,9 +19,12 @@ import android.view.View;
|
||||||
import android.view.ViewAnimationUtils;
|
import android.view.ViewAnimationUtils;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||||
import com.kabouzeid.gramophone.adapter.song.SongAdapter;
|
import com.kabouzeid.gramophone.adapter.song.SongAdapter;
|
||||||
import com.kabouzeid.gramophone.dialogs.AddToPlaylistDialog;
|
import com.kabouzeid.gramophone.dialogs.AddToPlaylistDialog;
|
||||||
import com.kabouzeid.gramophone.dialogs.PlayingQueueDialog;
|
import com.kabouzeid.gramophone.dialogs.PlayingQueueDialog;
|
||||||
|
|
@ -36,6 +41,7 @@ import com.kabouzeid.gramophone.ui.activities.base.AbsMusicServiceActivity;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||||
import com.kabouzeid.gramophone.ui.activities.tageditor.AbsTagEditorActivity;
|
import com.kabouzeid.gramophone.ui.activities.tageditor.AbsTagEditorActivity;
|
||||||
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
||||||
|
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
import com.kabouzeid.gramophone.util.Util;
|
import com.kabouzeid.gramophone.util.Util;
|
||||||
|
|
@ -66,6 +72,13 @@ public class PlayerFragment extends Fragment implements MusicServiceEventListene
|
||||||
@Bind(R.id.color_background)
|
@Bind(R.id.color_background)
|
||||||
View colorBackground;
|
View colorBackground;
|
||||||
|
|
||||||
|
@Bind(R.id.player_queue_subheader)
|
||||||
|
TextView playerQueueSubheader;
|
||||||
|
|
||||||
|
@Bind(R.id.current_song)
|
||||||
|
View currentSong;
|
||||||
|
MediaEntryViewHolder mediaEntryViewHolder;
|
||||||
|
|
||||||
private int lastColor;
|
private int lastColor;
|
||||||
|
|
||||||
private AbsMusicServiceActivity activity;
|
private AbsMusicServiceActivity activity;
|
||||||
|
|
@ -136,6 +149,16 @@ public class PlayerFragment extends Fragment implements MusicServiceEventListene
|
||||||
});
|
});
|
||||||
|
|
||||||
activity.addMusicServiceEventListener(this);
|
activity.addMusicServiceEventListener(this);
|
||||||
|
|
||||||
|
mediaEntryViewHolder = new MediaEntryViewHolder(currentSong) {
|
||||||
|
};
|
||||||
|
|
||||||
|
mediaEntryViewHolder.separator.setVisibility(View.VISIBLE);
|
||||||
|
mediaEntryViewHolder.shortSeparator.setVisibility(View.GONE);
|
||||||
|
mediaEntryViewHolder.title.setText("When I'm Gone");
|
||||||
|
mediaEntryViewHolder.text.setText("Eminem");
|
||||||
|
mediaEntryViewHolder.image.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
|
mediaEntryViewHolder.image.setImageDrawable(Util.getTintedDrawable(activity, R.drawable.ic_volume_up_white_24dp, ColorUtil.resolveColor(activity, R.attr.icon_color)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -218,15 +241,25 @@ public class PlayerFragment extends Fragment implements MusicServiceEventListene
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
private void animateColorChange(final int newColor) {
|
private void animateColorChange(final int newColor) {
|
||||||
|
slidingUpPanelLayout.setBackgroundColor(lastColor);
|
||||||
|
Animator backgroundAnimator;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
int x = (int) (playbackControlsFragment.playPauseFab.getX() + playbackControlsFragment.playPauseFab.getWidth() / 2 + playbackControlsFragment.getView().getX());
|
int x = (int) (playbackControlsFragment.playPauseFab.getX() + playbackControlsFragment.playPauseFab.getWidth() / 2 + playbackControlsFragment.getView().getX());
|
||||||
int y = (int) (playbackControlsFragment.playPauseFab.getY() + playbackControlsFragment.playPauseFab.getHeight() / 2 + playbackControlsFragment.getView().getY());
|
int y = (int) (playbackControlsFragment.playPauseFab.getY() + playbackControlsFragment.playPauseFab.getHeight() / 2 + playbackControlsFragment.getView().getY());
|
||||||
float startRadius = 0;
|
float startRadius = 0;
|
||||||
float endRadius = Math.max(colorBackground.getWidth(), colorBackground.getHeight());
|
float endRadius = Math.max(colorBackground.getWidth(), colorBackground.getHeight());
|
||||||
slidingUpPanelLayout.setBackgroundColor(lastColor);
|
|
||||||
colorBackground.setBackgroundColor(newColor);
|
colorBackground.setBackgroundColor(newColor);
|
||||||
ViewAnimationUtils.createCircularReveal(colorBackground, x, y, startRadius, endRadius).setDuration(1000).start();
|
backgroundAnimator = ViewAnimationUtils.createCircularReveal(colorBackground, x, y, startRadius, endRadius);
|
||||||
|
} else {
|
||||||
|
backgroundAnimator = ViewUtil.createBackgroundColorTransition(colorBackground, lastColor, newColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Animator subHeaderAnimator = ViewUtil.createTextColorTransition(playerQueueSubheader, lastColor, newColor);
|
||||||
|
|
||||||
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
|
animatorSet.playTogether(backgroundAnimator, subHeaderAnimator);
|
||||||
|
animatorSet.setDuration(1000).start();
|
||||||
|
|
||||||
lastColor = newColor;
|
lastColor = newColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.sothree.slidinguppanel.SlidingUpPanelLayout
|
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/player_sliding_layout"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/tools"
|
||||||
xmlns:sothree="http://schemas.android.com/apk/res-auto"
|
xmlns:sothree="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/player_sliding_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
|
|
@ -80,11 +79,31 @@
|
||||||
app:cardElevation="@dimen/card_elevation"
|
app:cardElevation="@dimen/card_elevation"
|
||||||
app:cardUseCompatPadding="false">
|
app:cardUseCompatPadding="false">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include android:id="@+id/current_song" layout="@layout/item_list" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/player_queue_subheader"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="Up next"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp" />
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/player_recycler_view"
|
android:id="@+id/player_recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/player_album_art_frame"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/player_album_art_frame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_above="@id/player_footer_frame"
|
android:layout_above="@id/player_footer_frame"
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:padding="72dp"
|
|
||||||
android:id="@+id/player_favorite_icon"
|
android:id="@+id/player_favorite_icon"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:padding="72dp"
|
||||||
android:src="@drawable/ic_favorite_red_a400_96dp"
|
android:src="@drawable/ic_favorite_red_a400_96dp"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue