Fixed a critical bug in the music service. Properly hide and show the bottom bar depending on whether the playlist is empty or not.
This commit is contained in:
parent
af4987b679
commit
de31396b67
2 changed files with 8 additions and 7 deletions
|
|
@ -552,7 +552,8 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
|
|
||||||
public void openQueue(@Nullable final ArrayList<Song> playingQueue, final int startPosition, final boolean startPlaying) {
|
public void openQueue(@Nullable final ArrayList<Song> playingQueue, final int startPosition, final boolean startPlaying) {
|
||||||
if (playingQueue != null && !playingQueue.isEmpty() && startPosition >= 0 && startPosition < playingQueue.size()) {
|
if (playingQueue != null && !playingQueue.isEmpty() && startPosition >= 0 && startPosition < playingQueue.size()) {
|
||||||
originalPlayingQueue = playingQueue;
|
// it is important to copy the playing queue here first as we might add/remove songs later
|
||||||
|
originalPlayingQueue = new ArrayList<>(playingQueue);
|
||||||
this.playingQueue = new ArrayList<>(originalPlayingQueue);
|
this.playingQueue = new ArrayList<>(originalPlayingQueue);
|
||||||
|
|
||||||
int position = startPosition;
|
int position = startPosition;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import butterknife.ButterKnife;
|
||||||
/**
|
/**
|
||||||
* @author Karim Abou Zeid (kabouzeid)
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
* <p/>
|
* <p/>
|
||||||
* Do not use {@link #setContentView(int)} but wrap your layout with
|
* Do not use {@link #setContentView(int)}. Instead wrap your layout with
|
||||||
* {@link #wrapSlidingMusicPanel(int)} first and then return it in {@link #createContentView()}
|
* {@link #wrapSlidingMusicPanel(int)} first and then return it in {@link #createContentView()}
|
||||||
*/
|
*/
|
||||||
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity implements SlidingUpPanelLayout.PanelSlideListener, PlayerFragment.Callbacks {
|
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity implements SlidingUpPanelLayout.PanelSlideListener, PlayerFragment.Callbacks {
|
||||||
|
|
@ -71,8 +71,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
});
|
});
|
||||||
slidingUpPanelLayout.setPanelSlideListener(this);
|
slidingUpPanelLayout.setPanelSlideListener(this);
|
||||||
|
|
||||||
hideBottomBar(MusicPlayerRemote.getPlayingQueue().isEmpty());
|
|
||||||
|
|
||||||
playerFragment.onHide();
|
playerFragment.onHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,9 +153,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
|
|
||||||
public void hideBottomBar(final boolean hide) {
|
public void hideBottomBar(final boolean hide) {
|
||||||
if (hide) {
|
if (hide) {
|
||||||
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
slidingUpPanelLayout.setPanelHeight(0);
|
||||||
} else if (getPanelState() == SlidingUpPanelLayout.PanelState.HIDDEN) {
|
|
||||||
collapsePanel();
|
collapsePanel();
|
||||||
|
} else {
|
||||||
|
slidingUpPanelLayout.setPanelHeight(getResources().getDimensionPixelSize(R.dimen.mini_player_height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +170,8 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (playerFragment.onBackPressed()) return;
|
if (slidingUpPanelLayout.getPanelHeight() != 0 && playerFragment.onBackPressed())
|
||||||
|
return;
|
||||||
if (getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
if (getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||||
collapsePanel();
|
collapsePanel();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue