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>
<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>
<ol>

View file

@ -80,7 +80,7 @@ import butterknife.ButterKnife;
/**
* @author Karim Abou Zeid (kabouzeid)
* <p>
* <p/>
* Do not use {@link #setContentView(int)} but wrap your layout with
* {@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);
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
public void run() {
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
mediaControllerContainer.setVisibility(View.VISIBLE);
onPanelSlide(slidingUpPanelLayout, 1);
onPanelExpanded(slidingUpPanelLayout);
}
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);
}
}
});
}
});
}
@ -401,11 +408,18 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
initFabColorAnimatorIfNecessary();
initMiniPlayerAlphaAnimatorIfNecessary();
int durationProgress = (int) (SLIDING_PANEL_ANIMATION_STEPS * slideOffset);
fabXAnimator.setCurrentPlayTime(durationProgress);
fabYAnimator.setCurrentPlayTime(durationProgress);
fabColorAnimator.setCurrentPlayTime(durationProgress);
miniPlayerAlphaAnimator.setCurrentPlayTime(durationProgress);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
fabXAnimator.setCurrentFraction(slideOffset);
fabYAnimator.setCurrentFraction(slideOffset);
fabColorAnimator.setCurrentFraction(slideOffset);
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