Fixed NPE when updating the play-pause buttons drawable.
This commit is contained in:
parent
fa40a6915c
commit
afcb4b102c
1 changed files with 4 additions and 4 deletions
|
|
@ -39,9 +39,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicStateActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpPlayPauseButton() {
|
private void setUpPlayPauseButton() {
|
||||||
if (playPauseDrawable == null) {
|
updateFabState(false);
|
||||||
playPauseDrawable = new PlayPauseDrawable(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
getPlayPauseFab().setImageDrawable(playPauseDrawable);
|
getPlayPauseFab().setImageDrawable(playPauseDrawable);
|
||||||
final int accentColor = ThemeSingleton.get().positiveColor;
|
final int accentColor = ThemeSingleton.get().positiveColor;
|
||||||
|
|
@ -52,7 +50,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicStateActivity
|
||||||
getPlayPauseFab().getDrawable().clearColorFilter();
|
getPlayPauseFab().getDrawable().clearColorFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFabState(false);
|
|
||||||
final GestureDetector gestureDetector = new GestureDetector(this, new SmallOnGestureListener() {
|
final GestureDetector gestureDetector = new GestureDetector(this, new SmallOnGestureListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||||
|
|
@ -99,6 +96,9 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicStateActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateFabState(boolean animate) {
|
protected void updateFabState(boolean animate) {
|
||||||
|
if (playPauseDrawable == null) {
|
||||||
|
playPauseDrawable = new PlayPauseDrawable(this);
|
||||||
|
}
|
||||||
if (MusicPlayerRemote.isPlaying()) {
|
if (MusicPlayerRemote.isPlaying()) {
|
||||||
playPauseDrawable.setPause(animate);
|
playPauseDrawable.setPause(animate);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue