Fade in quick settings when shade opens
Call stack for previous QQS slide-in animation:
- PVC #setExpandedHeightInternal #onHeightUpdated
- NPVC #onHeightUpdated #updateHeader #updateQsExpansion
- QSFragment #setQsExpanson (which calls NPVC #getHeaderTranslation,
which moved QQS down/up on shade open/close)
This change uses the setup above and fades QQS in/out
depending on whether the header translation is 0.
Bug: 172289889
Test: open shade, qqs fades in
close shade, qqs fades out
Change-Id: I5b48a450cc2da6dab8c997c9a6a395d54c2b9067
This commit is contained in:
@@ -29,6 +29,7 @@ import com.android.systemui.qs.QSPanel.QSTileLayout;
|
||||
import com.android.systemui.qs.TouchAnimator.Builder;
|
||||
import com.android.systemui.qs.TouchAnimator.Listener;
|
||||
import com.android.systemui.qs.dagger.QSScope;
|
||||
import com.android.systemui.statusbar.CrossFadeHelper;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
import com.android.systemui.tuner.TunerService.Tunable;
|
||||
|
||||
@@ -49,7 +50,9 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
private static final String MOVE_FULL_ROWS = "sysui_qs_move_whole_rows";
|
||||
|
||||
public static final float EXPANDED_TILE_DELAY = .86f;
|
||||
|
||||
private static final long QQS_FADE_IN_DURATION = 200L;
|
||||
// Fade out faster than fade in to finish before QQS hides.
|
||||
private static final long QQS_FADE_OUT_DURATION = 50L;
|
||||
|
||||
private final ArrayList<View> mAllViews = new ArrayList<>();
|
||||
/**
|
||||
@@ -77,6 +80,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
private TouchAnimator mBrightnessAnimator;
|
||||
private boolean mNeedsAnimatorUpdate = false;
|
||||
|
||||
private boolean mToShowing;
|
||||
private boolean mOnKeyguard;
|
||||
|
||||
private boolean mAllowFancy;
|
||||
@@ -133,6 +137,18 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
}
|
||||
}
|
||||
|
||||
void startAlphaAnimation(boolean show) {
|
||||
if (show == mToShowing) {
|
||||
return;
|
||||
}
|
||||
mToShowing = show;
|
||||
if (show) {
|
||||
CrossFadeHelper.fadeIn(mQs.getView(), QQS_FADE_IN_DURATION, 0 /* delay */);
|
||||
} else {
|
||||
CrossFadeHelper.fadeOut(mQs.getView(), QQS_FADE_OUT_DURATION, 0 /* delay */,
|
||||
null /* endRunnable */);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not the keyguard is currently being shown with a collapsed header.
|
||||
|
||||
@@ -91,6 +91,11 @@ public class QSContainerImpl extends FrameLayout {
|
||||
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void onMediaVisibilityChanged(boolean qsVisible) {
|
||||
mAnimateBottomOnNextLayout = qsVisible;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
|
||||
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
boolean sizeChanged = (oldTop - oldBottom) != (top - bottom);
|
||||
if (sizeChanged) {
|
||||
setQsExpansion(mLastQSExpansion, mLastQSExpansion);
|
||||
setQsExpansion(mLastQSExpansion, mLastHeaderTranslation);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -391,6 +391,9 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
|
||||
@Override
|
||||
public void setQsExpansion(float expansion, float headerTranslation) {
|
||||
if (DEBUG) Log.d(TAG, "setQSExpansion " + expansion + " " + headerTranslation);
|
||||
if (mQSAnimator != null) {
|
||||
mQSAnimator.startAlphaAnimation(headerTranslation == 0 /* show */);
|
||||
}
|
||||
mContainer.setExpansion(expansion);
|
||||
final float translationScaleY = expansion - 1;
|
||||
boolean onKeyguardAndExpanded = isKeyguardShowing() && !mShowCollapsedOnKeyguard;
|
||||
|
||||
Reference in New Issue
Block a user