Ignore. Not working work in progress commit.
This commit is contained in:
parent
f8bbd3e8e3
commit
0ade999094
17 changed files with 93 additions and 200 deletions
|
|
@ -21,7 +21,6 @@ import com.kabouzeid.gramophone.interfaces.CabHolder;
|
|||
import com.kabouzeid.gramophone.loader.AlbumSongLoader;
|
||||
import com.kabouzeid.gramophone.model.Album;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||
|
|
@ -219,8 +218,6 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
Pair.create(image,
|
||||
activity.getResources().getString(R.string.transition_album_art)
|
||||
)};
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
albumPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews(albumPairs);
|
||||
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).id, albumPairs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.kabouzeid.gramophone.interfaces.CabHolder;
|
|||
import com.kabouzeid.gramophone.loader.ArtistSongLoader;
|
||||
import com.kabouzeid.gramophone.model.Artist;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||
|
|
@ -208,8 +207,6 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
Pair.create(image,
|
||||
activity.getResources().getString(R.string.transition_artist_image)
|
||||
)};
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
artistPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews(artistPairs);
|
||||
NavigationUtil.goToArtist(activity, dataSet.get(getAdapterPosition()).id, artistPairs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
|||
import com.kabouzeid.gramophone.helper.menu.SongMenuHelper;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
|
|
@ -106,8 +105,6 @@ public class ArtistSongAdapter extends ArrayAdapter<Song> implements MaterialCab
|
|||
Pair[] albumPairs = new Pair[]{
|
||||
Pair.create(albumArt, activity.getResources().getString(R.string.transition_album_art))
|
||||
};
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
albumPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews(albumPairs);
|
||||
NavigationUtil.goToAlbum(activity, song.albumId, albumPairs);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import android.view.View;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -54,8 +53,6 @@ public class SmartPlaylistSongAdapter extends SongAdapter {
|
|||
Pair[] albumPairs = new Pair[]{
|
||||
Pair.create(image, activity.getString(R.string.transition_album_art))
|
||||
};
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
albumPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews(albumPairs);
|
||||
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).albumId, albumPairs);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
|||
import com.kabouzeid.gramophone.helper.menu.SongMenuHelper;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||
|
|
@ -237,8 +236,6 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
Pair[] albumPairs = new Pair[]{
|
||||
Pair.create(image, activity.getResources().getString(R.string.transition_album_art))
|
||||
};
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
albumPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews(albumPairs);
|
||||
NavigationUtil.goToAlbum(activity, getSong().albumId, albumPairs);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.kabouzeid.gramophone.helper.menu;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
|
@ -15,7 +14,6 @@ import com.kabouzeid.gramophone.dialogs.SongDetailDialog;
|
|||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.interfaces.PaletteColorHolder;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.ui.activities.tageditor.AbsTagEditorActivity;
|
||||
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
|
|
@ -58,16 +56,10 @@ public class SongMenuHelper {
|
|||
SongDetailDialog.create(song).show(activity.getSupportFragmentManager(), "SONG_DETAILS");
|
||||
return true;
|
||||
case R.id.action_go_to_album:
|
||||
Pair[] albumPairs = null;
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
albumPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews();
|
||||
NavigationUtil.goToAlbum(activity, song.albumId, albumPairs);
|
||||
NavigationUtil.goToAlbum(activity, song.albumId);
|
||||
return true;
|
||||
case R.id.action_go_to_artist:
|
||||
Pair[] artistPairs = null;
|
||||
if (activity instanceof AbsSlidingMusicPanelActivity)
|
||||
artistPairs = ((AbsSlidingMusicPanelActivity) activity).addPlayPauseFabToSharedViews();
|
||||
NavigationUtil.goToArtist(activity, song.artistId, artistPairs);
|
||||
NavigationUtil.goToArtist(activity, song.artistId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class FloatingActionButtonProperties {
|
|||
@Override
|
||||
public void set(FloatingActionButton object, Integer value) {
|
||||
object.setBackgroundTintList(ColorStateList.valueOf(value));
|
||||
object.getDrawable().setColorFilter(ColorUtil.getPrimaryTextColorForBackground(object.getContext(), value), PorterDuff.Mode.SRC_IN);
|
||||
object.getDrawable().mutate().setColorFilter(ColorUtil.getPrimaryTextColorForBackground(object.getContext(), value), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
|
@ -360,8 +359,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
|||
startActivityForResult(intent, TAG_EDITOR_REQUEST);
|
||||
return true;
|
||||
case R.id.action_go_to_artist:
|
||||
Pair[] artistPairs = addPlayPauseFabToSharedViews();
|
||||
NavigationUtil.goToArtist(this, album.artistId, artistPairs);
|
||||
NavigationUtil.goToArtist(this, album.artistId);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.kabouzeid.gramophone.ui.activities.base;
|
|||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
|
@ -24,7 +23,6 @@ import android.support.annotation.LayoutRes;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.TypedValue;
|
||||
|
|
@ -96,20 +94,20 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
private static final int FAB_CIRCULAR_REVEAL_ANIMATION_TIME = 1000;
|
||||
|
||||
@Bind(R.id.play_pause_fab)
|
||||
FloatingActionButton playPauseButton;
|
||||
@Bind(R.id.sliding_layout)
|
||||
SlidingUpPanelLayout slidingUpPanelLayout;
|
||||
|
||||
@Bind(R.id.mini_player)
|
||||
FrameLayout miniPlayer;
|
||||
LinearLayout miniPlayer;
|
||||
@Bind(R.id.mini_player_title)
|
||||
TextView miniPlayerTitle;
|
||||
@Bind(R.id.mini_player_image)
|
||||
ImageView miniPlayerImage;
|
||||
@Bind(R.id.mini_player_play_pause_button)
|
||||
ImageView miniPlayerPlayPauseButton;
|
||||
|
||||
@Bind(R.id.player_dummy_fab)
|
||||
View dummyFab;
|
||||
@Bind(R.id.player_play_pause_fab)
|
||||
FloatingActionButton playerPlayPauseFab;
|
||||
|
||||
@Bind(R.id.player_title)
|
||||
TextView songTitle;
|
||||
|
|
@ -131,8 +129,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
RelativeLayout mediaControllerContainer;
|
||||
@Bind(R.id.player_media_controller_container_background)
|
||||
View mediaControllerContainerBackground;
|
||||
@Bind(R.id.player_footer_frame)
|
||||
LinearLayout footerFrame;
|
||||
@Bind(R.id.player_album_art_background)
|
||||
ImageView albumArtBackground;
|
||||
@Bind(R.id.player_image)
|
||||
|
|
@ -174,8 +170,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
private AnimatorSet colorTransitionAnimator;
|
||||
|
||||
private ArgbEvaluator argbEvaluator = new ArgbEvaluator();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -185,7 +179,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
initAppearanceVarsFromSharedPrefs();
|
||||
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
|
||||
|
||||
setUpPlayPauseButton();
|
||||
setUpPlayPauseButtons();
|
||||
setUpMiniPlayer();
|
||||
setUpSlidingPanel();
|
||||
|
||||
|
|
@ -198,21 +192,14 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
progressViewsUpdateHandler = new MusicProgressViewsUpdateHandler(this);
|
||||
|
||||
// I know the nested post calls are ugly, but this is necessary for the fab to be in the right position!
|
||||
playPauseButton.post(new Runnable() {
|
||||
slidingUpPanelLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dummyFab.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
playPauseButton.requestLayout();
|
||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
mediaControllerContainer.setVisibility(View.VISIBLE);
|
||||
onPanelSlide(slidingUpPanelLayout, 1);
|
||||
onPanelExpanded(slidingUpPanelLayout);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
mediaControllerContainer.setVisibility(View.VISIBLE);
|
||||
onPanelSlide(slidingUpPanelLayout, 1);
|
||||
onPanelExpanded(slidingUpPanelLayout);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -245,7 +232,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
hideBottomBarIfQueueIsEmpty();
|
||||
hideBottomBar(MusicPlayerRemote.getPlayingQueue().isEmpty());
|
||||
super.onServiceConnected(name, service);
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +289,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
updateRepeatState();
|
||||
updateShuffleState();
|
||||
setUpProgressSliderTint();
|
||||
setUpPlayPauseButtonTint();
|
||||
setUpPlayerPlayPauseFabTint();
|
||||
break;
|
||||
case PreferenceUtil.HIDE_BOTTOM_BAR:
|
||||
recreate();
|
||||
|
|
@ -310,46 +297,32 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
}
|
||||
}
|
||||
|
||||
private void setUpPlayPauseButton() {
|
||||
updateFabState(false);
|
||||
|
||||
playPauseButton.setImageDrawable(playPauseDrawable);
|
||||
|
||||
setUpPlayPauseButtonTint();
|
||||
|
||||
final GestureDetector gestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||
toggleSlidingPanel();
|
||||
return true;
|
||||
private View.OnClickListener playPauseButtonOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (MusicPlayerRemote.isPlaying()) {
|
||||
MusicPlayerRemote.pauseSong();
|
||||
} else {
|
||||
MusicPlayerRemote.resumePlaying();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
playPauseButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (MusicPlayerRemote.getPosition() != -1) {
|
||||
if (MusicPlayerRemote.isPlaying()) {
|
||||
MusicPlayerRemote.pauseSong();
|
||||
} else {
|
||||
MusicPlayerRemote.resumePlaying();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
private void setUpPlayPauseButtons() {
|
||||
updatePlayPauseDrawableState(false);
|
||||
|
||||
playPauseButton.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, @NonNull MotionEvent event) {
|
||||
gestureDetector.onTouchEvent(event);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
miniPlayerPlayPauseButton.setImageDrawable(playPauseDrawable);
|
||||
playerPlayPauseFab.setImageDrawable(getDrawable(R.drawable.ic_keyboard_arrow_up_white_24dp));
|
||||
setUpPlayerPlayPauseFabTint();
|
||||
miniPlayerPlayPauseButton.getDrawable().mutate().setColorFilter(ColorUtil.resolveColor(this, android.R.attr.textColorSecondary), PorterDuff.Mode.SRC_IN);
|
||||
|
||||
miniPlayerPlayPauseButton.setOnClickListener(playPauseButtonOnClickListener);
|
||||
playerPlayPauseFab.setOnClickListener(playPauseButtonOnClickListener);
|
||||
}
|
||||
|
||||
private void setUpPlayPauseButtonTint() {
|
||||
int fabColor = colorPlaybackControls && slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED ? lastPlaybackControlsColor : getThemeColorAccent();
|
||||
FloatingActionButtonProperties.COLOR.set(playPauseButton, fabColor);
|
||||
private void setUpPlayerPlayPauseFabTint() {
|
||||
int fabColor = colorPlaybackControls ? lastPlaybackControlsColor : getThemeColorAccent();
|
||||
FloatingActionButtonProperties.COLOR.set(playerPlayPauseFab, fabColor);
|
||||
}
|
||||
|
||||
private static class FlingPlayBackController implements View.OnTouchListener {
|
||||
|
|
@ -394,7 +367,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
setMiniPlayerColor(ColorUtil.resolveColor(this, R.attr.cardBackgroundColor));
|
||||
|
||||
miniPlayerImage.setImageDrawable(Util.getTintedDrawable(this, R.drawable.ic_equalizer_white_24dp,
|
||||
miniPlayerImage.setImageDrawable(Util.getTintedDrawable(this, R.drawable.ic_keyboard_arrow_up_white_24dp,
|
||||
ColorUtil.resolveColor(this, android.R.attr.textColorSecondary)));
|
||||
}
|
||||
|
||||
|
|
@ -412,8 +385,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
@Override
|
||||
public void onPanelSlide(View view, @FloatRange(from = 0, to = 1) float slideOffset) {
|
||||
setFabPositionProgress(slideOffset);
|
||||
setFabColorProgress(slideOffset);
|
||||
setMiniPlayerAlphaProgress(slideOffset);
|
||||
}
|
||||
|
||||
|
|
@ -436,11 +407,11 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (mediaControllerContainer.getVisibility() == View.INVISIBLE) {
|
||||
int cx = (dummyFab.getLeft() + dummyFab.getRight()) / 2;
|
||||
int cy = (dummyFab.getTop() + dummyFab.getBottom()) / 2;
|
||||
int cx = (playerPlayPauseFab.getLeft() + playerPlayPauseFab.getRight()) / 2;
|
||||
int cy = (playerPlayPauseFab.getTop() + playerPlayPauseFab.getBottom()) / 2;
|
||||
int finalRadius = Math.max(mediaControllerContainer.getWidth(), mediaControllerContainer.getHeight());
|
||||
|
||||
final Animator animator = ViewAnimationUtils.createCircularReveal(mediaControllerContainer, cx, cy, dummyFab.getWidth() / 2, finalRadius);
|
||||
final Animator animator = ViewAnimationUtils.createCircularReveal(mediaControllerContainer, cx, cy, playerPlayPauseFab.getWidth() / 2, finalRadius);
|
||||
animator.setInterpolator(new DecelerateInterpolator());
|
||||
animator.setDuration(FAB_CIRCULAR_REVEAL_ANIMATION_TIME);
|
||||
animator.start();
|
||||
|
|
@ -463,29 +434,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
private void setMiniPlayerAlphaProgress(@FloatRange(from = 0, to = 1) float progress) {
|
||||
float alpha = 1 - progress;
|
||||
miniPlayer.setAlpha(alpha);
|
||||
// necessary to make the views below clickable
|
||||
miniPlayer.setVisibility(alpha == 0 ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
private void setFabPositionProgress(@FloatRange(from = 0, to = 1) float progress) {
|
||||
float newXTranslation = (dummyFab.getX() + mediaControllerContainer.getX() + footerFrame.getX() - playPauseButton.getLeft()) * progress;
|
||||
float newYTranslation = (dummyFab.getY() + mediaControllerContainer.getY() + footerFrame.getY() - playPauseButton.getTop()) * progress;
|
||||
|
||||
playPauseButton.setTranslationX(newXTranslation);
|
||||
playPauseButton.setTranslationY(newYTranslation);
|
||||
}
|
||||
|
||||
private void setFabColorProgress(@FloatRange(from = 0, to = 1) float progress) {
|
||||
int startColor = getThemeColorAccent();
|
||||
int endColor;
|
||||
if (colorPlaybackControls) {
|
||||
endColor = lastPlaybackControlsColor;
|
||||
} else {
|
||||
endColor = startColor;
|
||||
}
|
||||
int newFabColor = (int) argbEvaluator.evaluate(progress, startColor, endColor);
|
||||
FloatingActionButtonProperties.COLOR.set(playPauseButton, newFabColor);
|
||||
}
|
||||
|
||||
private void toggleSlidingPanel() {
|
||||
if (slidingUpPanelLayout.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
|
||||
|
|
@ -520,7 +472,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
return getResources().getDimensionPixelSize(R.dimen.bottom_offset_fab_activity) - slidingUpPanelLayout.getPanelHeight();
|
||||
}
|
||||
|
||||
protected void updateFabState(boolean animate) {
|
||||
protected void updatePlayPauseDrawableState(boolean animate) {
|
||||
if (playPauseDrawable == null) {
|
||||
playPauseDrawable = new PlayPauseDrawable(this);
|
||||
}
|
||||
|
|
@ -531,22 +483,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
}
|
||||
}
|
||||
|
||||
public final Pair[] addPlayPauseFabToSharedViews(@Nullable final Pair... sharedElements) {
|
||||
Pair[] sharedViewsWithFab;
|
||||
if (sharedElements != null) {
|
||||
sharedViewsWithFab = new Pair[sharedElements.length + 1];
|
||||
System.arraycopy(sharedElements, 0, sharedViewsWithFab, 0, sharedElements.length);
|
||||
} else {
|
||||
sharedViewsWithFab = new Pair[1];
|
||||
}
|
||||
sharedViewsWithFab[sharedViewsWithFab.length - 1] = Pair.create((View) playPauseButton, getString(R.string.transition_fab));
|
||||
return sharedViewsWithFab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayStateChanged() {
|
||||
super.onPlayStateChanged();
|
||||
updateFabState(true);
|
||||
updatePlayPauseDrawableState(true);
|
||||
}
|
||||
|
||||
protected View wrapSlidingMusicPanelAndFab(@LayoutRes int resId) {
|
||||
|
|
@ -850,23 +790,13 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
}
|
||||
|
||||
private void updateCurrentSong() {
|
||||
hideBottomBarIfQueueIsEmpty();
|
||||
hideBottomBar(MusicPlayerRemote.getPlayingQueue().isEmpty());
|
||||
getCurrentSong();
|
||||
updateMiniPlayerAndHeaderText();
|
||||
setUpAlbumArtAndApplyPalette();
|
||||
updatePlayerMenu();
|
||||
}
|
||||
|
||||
private void hideBottomBarIfQueueIsEmpty() {
|
||||
if (MusicPlayerRemote.getPlayingQueue().isEmpty()) {
|
||||
playPauseButton.setVisibility(View.GONE);
|
||||
hideBottomBar(true);
|
||||
} else {
|
||||
playPauseButton.setVisibility(View.VISIBLE);
|
||||
hideBottomBar(PreferenceUtil.getInstance(this).hideBottomBar());
|
||||
}
|
||||
}
|
||||
|
||||
private void getCurrentSong() {
|
||||
song = MusicPlayerRemote.getCurrentSong();
|
||||
}
|
||||
|
|
@ -991,7 +921,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
updateRepeatState();
|
||||
updateShuffleState();
|
||||
setUpProgressSliderTint();
|
||||
setUpPlayPauseButtonTint();
|
||||
setUpPlayerPlayPauseFabTint();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1098,10 +1028,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
SongDetailDialog.create(song).show(getSupportFragmentManager(), "SONG_DETAIL");
|
||||
return true;
|
||||
case R.id.action_go_to_album:
|
||||
NavigationUtil.goToAlbum(this, song.albumId, addPlayPauseFabToSharedViews());
|
||||
NavigationUtil.goToAlbum(this, song.albumId);
|
||||
return true;
|
||||
case R.id.action_go_to_artist:
|
||||
NavigationUtil.goToArtist(this, song.artistId, addPlayPauseFabToSharedViews());
|
||||
NavigationUtil.goToArtist(this, song.artistId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 185 B |
Binary file not shown.
|
After Width: | Height: | Size: 153 B |
Binary file not shown.
|
After Width: | Height: | Size: 216 B |
Binary file not shown.
|
After Width: | Height: | Size: 335 B |
Binary file not shown.
|
After Width: | Height: | Size: 375 B |
|
|
@ -1,35 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
android:id="@+id/mini_player"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/mini_player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/mini_player_height"
|
||||
android:clickable="true"
|
||||
android:focusable="false">
|
||||
android:focusable="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mini_player_image"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_margin="16dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mini_player_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="88dp"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="88dp"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
||||
|
||||
</FrameLayout>
|
||||
<ImageView
|
||||
android:id="@+id/mini_player_play_pause_button"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="16dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -176,11 +176,9 @@
|
|||
android:src="@drawable/ic_shuffle_white_36dp" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/player_dummy_fab"
|
||||
android:id="@+id/player_play_pause_fab"
|
||||
style="@style/PlayPauseFab"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="0dp"
|
||||
android:visibility="invisible" />
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +1,31 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sothree="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/sliding_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom"
|
||||
sothree:umanoDragView="@+id/player_container"
|
||||
sothree:umanoPanelHeight="@dimen/mini_player_height"
|
||||
sothree:umanoParalaxOffset="0dp"
|
||||
sothree:umanoShadowHeight="@dimen/card_elevation">
|
||||
|
||||
<com.sothree.slidinguppanel.SlidingUpPanelLayout
|
||||
android:id="@+id/sliding_layout"
|
||||
<FrameLayout
|
||||
android:id="@+id/content_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/player_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom"
|
||||
sothree:umanoDragView="@+id/player_container"
|
||||
sothree:umanoPanelHeight="@dimen/mini_player_height"
|
||||
sothree:umanoParalaxOffset="0dp"
|
||||
sothree:umanoShadowHeight="@dimen/card_elevation">
|
||||
android:background="?android:colorBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="false">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<include layout="@layout/player" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/player_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:colorBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="false">
|
||||
<include layout="@layout/mini_player" />
|
||||
|
||||
<include layout="@layout/player" />
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/mini_player" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/play_pause_fab"
|
||||
style="@style/PlayPauseFab"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginBottom="@dimen/fab_margin_bottom"
|
||||
android:layout_marginLeft="@dimen/fab_margin_top_left_right"
|
||||
android:layout_marginRight="@dimen/fab_margin_top_left_right"
|
||||
android:layout_marginTop="@dimen/fab_margin_top_left_right" />
|
||||
|
||||
</FrameLayout>
|
||||
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue