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,9 +197,14 @@ 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() {
dummyFab.post(new Runnable() {
@Override
public void run() {
playPauseButton.requestLayout();
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) { if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
mediaControllerContainer.setVisibility(View.VISIBLE); mediaControllerContainer.setVisibility(View.VISIBLE);
onPanelSlide(slidingUpPanelLayout, 1); onPanelSlide(slidingUpPanelLayout, 1);
@ -208,6 +213,8 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
} }
}); });
} }
});
}
protected abstract View createContentView(); protected abstract View createContentView();
@ -401,12 +408,19 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
initFabColorAnimatorIfNecessary(); initFabColorAnimatorIfNecessary();
initMiniPlayerAlphaAnimatorIfNecessary(); initMiniPlayerAlphaAnimatorIfNecessary();
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); int durationProgress = (int) (SLIDING_PANEL_ANIMATION_STEPS * slideOffset);
fabXAnimator.setCurrentPlayTime(durationProgress); fabXAnimator.setCurrentPlayTime(durationProgress);
fabYAnimator.setCurrentPlayTime(durationProgress); fabYAnimator.setCurrentPlayTime(durationProgress);
fabColorAnimator.setCurrentPlayTime(durationProgress); fabColorAnimator.setCurrentPlayTime(durationProgress);
miniPlayerAlphaAnimator.setCurrentPlayTime(durationProgress); miniPlayerAlphaAnimator.setCurrentPlayTime(durationProgress);
} }
}
@Override @Override
public void onPanelCollapsed(View view) { public void onPanelCollapsed(View view) {