Fixed play/pause button offset too far to the right in landscape mode.

This commit is contained in:
Karim Abou Zeid 2015-08-27 11:12:21 +02:00
commit 6773342198
2 changed files with 32 additions and 12 deletions

View file

@ -25,6 +25,12 @@
<p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p>
<h3>Version 0.9.44 beta4</h3>
<ol>
<li><b>FIX:</b> Play/pause button offset too far to the right in landscape mode.</li>
</ol>
<h3>Version 0.9.44 beta3</h3> <h3>Version 0.9.44 beta3</h3>
<ol> <ol>

View file

@ -80,7 +80,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)} but wrap your layout with
* {@link #wrapSlidingMusicPanelAndFab(int)} first and then return it in {@link #createContentView()} * {@link #wrapSlidingMusicPanelAndFab(int)} first and then return it in {@link #createContentView()}
*/ */
@ -197,14 +197,21 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
progressViewsUpdateHandler = new MusicProgressViewsUpdateHandler(this); progressViewsUpdateHandler = new MusicProgressViewsUpdateHandler(this);
slidingUpPanelLayout.post(new Runnable() { // 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() {
@Override @Override
public void run() { public void run() {
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) { dummyFab.post(new Runnable() {
mediaControllerContainer.setVisibility(View.VISIBLE); @Override
onPanelSlide(slidingUpPanelLayout, 1); public void run() {
onPanelExpanded(slidingUpPanelLayout); playPauseButton.requestLayout();
} if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
mediaControllerContainer.setVisibility(View.VISIBLE);
onPanelSlide(slidingUpPanelLayout, 1);
onPanelExpanded(slidingUpPanelLayout);
}
}
});
} }
}); });
} }
@ -401,11 +408,18 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
initFabColorAnimatorIfNecessary(); initFabColorAnimatorIfNecessary();
initMiniPlayerAlphaAnimatorIfNecessary(); initMiniPlayerAlphaAnimatorIfNecessary();
int durationProgress = (int) (SLIDING_PANEL_ANIMATION_STEPS * slideOffset); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
fabXAnimator.setCurrentPlayTime(durationProgress); fabXAnimator.setCurrentFraction(slideOffset);
fabYAnimator.setCurrentPlayTime(durationProgress); fabYAnimator.setCurrentFraction(slideOffset);
fabColorAnimator.setCurrentPlayTime(durationProgress); fabColorAnimator.setCurrentFraction(slideOffset);
miniPlayerAlphaAnimator.setCurrentPlayTime(durationProgress); miniPlayerAlphaAnimator.setCurrentFraction(slideOffset);
} else {
int durationProgress = (int) (SLIDING_PANEL_ANIMATION_STEPS * slideOffset);
fabXAnimator.setCurrentPlayTime(durationProgress);
fabYAnimator.setCurrentPlayTime(durationProgress);
fabColorAnimator.setCurrentPlayTime(durationProgress);
miniPlayerAlphaAnimator.setCurrentPlayTime(durationProgress);
}
} }
@Override @Override