Merge "Fix visibility bugs in QS user detail panel" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
11a4f9a67e
@@ -225,16 +225,7 @@ public class QSDetail extends LinearLayout {
|
||||
mQsPanelCallback.onScanStateChanged(false);
|
||||
}
|
||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
|
||||
if (mShouldAnimate) {
|
||||
animateDetailVisibleDiff(x, y, visibleDiff, listener);
|
||||
} else {
|
||||
if (showingDetail) {
|
||||
showImmediately();
|
||||
} else {
|
||||
hideImmediately();
|
||||
}
|
||||
}
|
||||
animateDetailVisibleDiff(x, y, visibleDiff, listener);
|
||||
}
|
||||
|
||||
protected void animateDetailVisibleDiff(int x, int y, boolean visibleDiff, AnimatorListener listener) {
|
||||
@@ -242,27 +233,16 @@ public class QSDetail extends LinearLayout {
|
||||
mAnimatingOpen = mDetailAdapter != null;
|
||||
if (mFullyExpanded || mDetailAdapter != null) {
|
||||
setAlpha(1);
|
||||
mClipper.animateCircularClip(x, y, mDetailAdapter != null, listener);
|
||||
mClipper.updateCircularClip(mShouldAnimate, x, y, mDetailAdapter != null, listener);
|
||||
} else {
|
||||
animate().alpha(0)
|
||||
.setDuration(FADE_DURATION)
|
||||
.setDuration(mShouldAnimate ? FADE_DURATION : 0)
|
||||
.setListener(listener)
|
||||
.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showImmediately() {
|
||||
setVisibility(VISIBLE);
|
||||
mClipper.cancelAnimator();
|
||||
mClipper.showBackground();
|
||||
}
|
||||
|
||||
public void hideImmediately() {
|
||||
mClipper.cancelAnimator();
|
||||
setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
protected void setupDetailFooter(DetailAdapter adapter) {
|
||||
final Intent settingsIntent = adapter.getSettingsIntent();
|
||||
mDetailSettingsButton.setVisibility(settingsIntent != null ? VISIBLE : GONE);
|
||||
|
||||
@@ -37,6 +37,19 @@ public class QSDetailClipper {
|
||||
}
|
||||
|
||||
public void animateCircularClip(int x, int y, boolean in, AnimatorListener listener) {
|
||||
updateCircularClip(true /* animate */, x, y, in, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param animate whether or not animation has a duration of 0. Either way, {@code listener}
|
||||
* will be called.
|
||||
* @param x x position where animation should originate
|
||||
* @param y y position where animation should originate
|
||||
* @param in whether animating in or out
|
||||
* @param listener Animation listener. Called whether or not {@code animate} is true.
|
||||
*/
|
||||
public void updateCircularClip(boolean animate, int x, int y, boolean in,
|
||||
AnimatorListener listener) {
|
||||
if (mAnimator != null) {
|
||||
mAnimator.cancel();
|
||||
}
|
||||
@@ -58,15 +71,16 @@ public class QSDetailClipper {
|
||||
} else {
|
||||
mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, innerR);
|
||||
}
|
||||
mAnimator.setDuration((long)(mAnimator.getDuration() * 1.5));
|
||||
mAnimator.setDuration(animate ? (long) (mAnimator.getDuration() * 1.5) : 0);
|
||||
if (listener != null) {
|
||||
mAnimator.addListener(listener);
|
||||
}
|
||||
if (in) {
|
||||
mBackground.startTransition((int)(mAnimator.getDuration() * 0.6));
|
||||
mBackground.startTransition(animate ? (int) (mAnimator.getDuration() * 0.6) : 0);
|
||||
mAnimator.addListener(mVisibleOnStart);
|
||||
} else {
|
||||
mDetail.postDelayed(mReverseBackground, (long)(mAnimator.getDuration() * 0.65));
|
||||
mDetail.postDelayed(mReverseBackground,
|
||||
animate ? (long) (mAnimator.getDuration() * 0.65) : 0);
|
||||
mAnimator.addListener(mGoneOnEnd);
|
||||
}
|
||||
mAnimator.start();
|
||||
|
||||
Reference in New Issue
Block a user