Fixed the FAB animation getting stuck in the middle on older versions of Android.
This commit is contained in:
parent
e80a1317f1
commit
b98bfa1480
2 changed files with 6 additions and 5 deletions
|
|
@ -165,11 +165,12 @@ public class PlaybackControlsFragment extends Fragment implements MusicServiceEv
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpPlayPauseFab() {
|
private void setUpPlayPauseFab() {
|
||||||
updatePlayPauseDrawableState(false);
|
|
||||||
playPauseFab.setImageDrawable(playerFabPlayPauseDrawable);
|
|
||||||
final int fabColor = Color.WHITE;
|
final int fabColor = Color.WHITE;
|
||||||
TintHelper.setTintAuto(playPauseFab, fabColor, true);
|
TintHelper.setTintAuto(playPauseFab, fabColor, true);
|
||||||
// because of our custom drawable we have to set the tint manually
|
|
||||||
|
updatePlayPauseDrawableState(false);
|
||||||
|
// Note: set the drawable AFTER TintHelper.setTintAuto() is called
|
||||||
|
playPauseFab.setImageDrawable(playerFabPlayPauseDrawable);
|
||||||
playPauseFab.getDrawable().mutate().setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
|
playPauseFab.getDrawable().mutate().setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
|
||||||
playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
||||||
playPauseFab.post(new Runnable() {
|
playPauseFab.post(new Runnable() {
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ public class PlayPauseDrawable extends Drawable {
|
||||||
rightPauseBar.lineTo(2 * barWidth + barDist, 0);
|
rightPauseBar.lineTo(2 * barWidth + barDist, 0);
|
||||||
rightPauseBar.close();
|
rightPauseBar.close();
|
||||||
|
|
||||||
canvas.save();
|
final int saveCount = canvas.save();
|
||||||
|
|
||||||
// Translate the play button a tiny bit to the right so it looks more centered.
|
// Translate the play button a tiny bit to the right so it looks more centered.
|
||||||
canvas.translate(lerp(0, pauseBarHeight / 8f, progress), 0);
|
canvas.translate(lerp(0, pauseBarHeight / 8f, progress), 0);
|
||||||
|
|
@ -123,7 +123,7 @@ public class PlayPauseDrawable extends Drawable {
|
||||||
canvas.drawPath(leftPauseBar, paint);
|
canvas.drawPath(leftPauseBar, paint);
|
||||||
canvas.drawPath(rightPauseBar, paint);
|
canvas.drawPath(rightPauseBar, paint);
|
||||||
|
|
||||||
canvas.restore();
|
canvas.restoreToCount(saveCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue