Merge changes Ibf05654c,I85cef48f into tm-qpr-dev am: e56320b84b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19928267

Change-Id: I12aa62b3f62a2563f0e0dd5ca54a4e5fae9909b1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mike Schneider
2022-09-15 05:04:19 +00:00
committed by Automerger Merge Worker
3 changed files with 51 additions and 43 deletions

View File

@@ -520,7 +520,7 @@
<dimen name="qs_tile_margin_vertical">@dimen/qs_tile_margin_horizontal</dimen> <dimen name="qs_tile_margin_vertical">@dimen/qs_tile_margin_horizontal</dimen>
<dimen name="qs_tile_margin_top_bottom">4dp</dimen> <dimen name="qs_tile_margin_top_bottom">4dp</dimen>
<dimen name="qs_brightness_margin_top">8dp</dimen> <dimen name="qs_brightness_margin_top">8dp</dimen>
<dimen name="qs_brightness_margin_bottom">24dp</dimen> <dimen name="qs_brightness_margin_bottom">16dp</dimen>
<dimen name="qqs_layout_margin_top">16dp</dimen> <dimen name="qqs_layout_margin_top">16dp</dimen>
<dimen name="qqs_layout_padding_bottom">24dp</dimen> <dimen name="qqs_layout_padding_bottom">24dp</dimen>

View File

@@ -99,7 +99,7 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
// slider, as well as animating the alpha of the QS tile layout (as we are tracking QQS tiles) // slider, as well as animating the alpha of the QS tile layout (as we are tracking QQS tiles)
@Nullable @Nullable
private TouchAnimator mFirstPageAnimator; private TouchAnimator mFirstPageAnimator;
// TranslationX animator for QQS/QS tiles // TranslationX animator for QQS/QS tiles. Only used on the first page!
private TouchAnimator mTranslationXAnimator; private TouchAnimator mTranslationXAnimator;
// TranslationY animator for QS tiles (and their components) in the first page // TranslationY animator for QS tiles (and their components) in the first page
private TouchAnimator mTranslationYAnimator; private TouchAnimator mTranslationYAnimator;
@@ -107,13 +107,14 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
private TouchAnimator mQQSTranslationYAnimator; private TouchAnimator mQQSTranslationYAnimator;
// Animates alpha of permanent views (QS tile layout, QQS tiles) when not in first page // Animates alpha of permanent views (QS tile layout, QQS tiles) when not in first page
private TouchAnimator mNonfirstPageAlphaAnimator; private TouchAnimator mNonfirstPageAlphaAnimator;
// TranslatesY the QS Tile layout using QS.getHeightDiff()
private TouchAnimator mQSTileLayoutTranslatorAnimator;
// This animates fading of media player // This animates fading of media player
private TouchAnimator mAllPagesDelayedAnimator; private TouchAnimator mAllPagesDelayedAnimator;
// Animator for brightness slider(s) // Brightness slider translation driver, uses mQSExpansionPathInterpolator.yInterpolator
@Nullable @Nullable
private TouchAnimator mBrightnessAnimator; private TouchAnimator mBrightnessTranslationAnimator;
// Brightness slider opacity driver. Uses linear interpolator.
@Nullable
private TouchAnimator mBrightnessOpacityAnimator;
// Animator for Footer actions in QQS // Animator for Footer actions in QQS
private TouchAnimator mQQSFooterActionsAnimator; private TouchAnimator mQQSFooterActionsAnimator;
// Height animator for QQS tiles (height changing from QQS size to QS size) // Height animator for QQS tiles (height changing from QQS size to QS size)
@@ -137,7 +138,6 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
private final QSTileHost mHost; private final QSTileHost mHost;
private final Executor mExecutor; private final Executor mExecutor;
private boolean mShowCollapsedOnKeyguard; private boolean mShowCollapsedOnKeyguard;
private boolean mTranslateWhileExpanding;
private int mQQSTop; private int mQQSTop;
private int[] mTmpLoc1 = new int[2]; private int[] mTmpLoc1 = new int[2];
@@ -298,13 +298,6 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
QSTileLayout tileLayout = mQsPanelController.getTileLayout(); QSTileLayout tileLayout = mQsPanelController.getTileLayout();
mAllViews.add((View) tileLayout); mAllViews.add((View) tileLayout);
int heightDiff = mQs.getHeightDiff();
if (!mTranslateWhileExpanding) {
heightDiff *= SHORT_PARALLAX_AMOUNT;
}
mQSTileLayoutTranslatorAnimator = new Builder()
.addFloat(tileLayout, "translationY", heightDiff, 0)
.build();
mLastQQSTileHeight = 0; mLastQQSTileHeight = 0;
@@ -407,12 +400,7 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
mAnimatedQsViews.add(tileView); mAnimatedQsViews.add(tileView);
mAllViews.add(quickTileView); mAllViews.add(quickTileView);
mAllViews.add(quickTileView.getSecondaryLabel()); mAllViews.add(quickTileView.getSecondaryLabel());
} else if (isIconInAnimatedRow(count)) { } else if (!isIconInAnimatedRow(count)) {
firstPageBuilder.addFloat(tileView, "translationY", -heightDiff, 0);
mAllViews.add(tileIcon);
} else {
// Pretend there's a corresponding QQS tile (for the position) that we are // Pretend there's a corresponding QQS tile (for the position) that we are
// expanding from. // expanding from.
SideLabelTileLayout qqsLayout = SideLabelTileLayout qqsLayout =
@@ -442,7 +430,7 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
} }
} }
animateBrightnessSlider(firstPageBuilder); animateBrightnessSlider();
mFirstPageAnimator = firstPageBuilder mFirstPageAnimator = firstPageBuilder
// Fade in the tiles/labels as we reach the final position. // Fade in the tiles/labels as we reach the final position.
@@ -568,7 +556,9 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
return new Pair<>(animator, builder.build()); return new Pair<>(animator, builder.build());
} }
private void animateBrightnessSlider(Builder firstPageBuilder) { private void animateBrightnessSlider() {
mBrightnessTranslationAnimator = null;
mBrightnessOpacityAnimator = null;
View qsBrightness = mQsPanelController.getBrightnessView(); View qsBrightness = mQsPanelController.getBrightnessView();
View qqsBrightness = mQuickQSPanelController.getBrightnessView(); View qqsBrightness = mQuickQSPanelController.getBrightnessView();
if (qqsBrightness != null && qqsBrightness.getVisibility() == View.VISIBLE) { if (qqsBrightness != null && qqsBrightness.getVisibility() == View.VISIBLE) {
@@ -576,25 +566,45 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
mAnimatedQsViews.add(qsBrightness); mAnimatedQsViews.add(qsBrightness);
mAllViews.add(qqsBrightness); mAllViews.add(qqsBrightness);
int translationY = getRelativeTranslationY(qsBrightness, qqsBrightness); int translationY = getRelativeTranslationY(qsBrightness, qqsBrightness);
mBrightnessAnimator = new Builder() mBrightnessTranslationAnimator = new Builder()
// we need to animate qs brightness even if animation will not be visible, // we need to animate qs brightness even if animation will not be visible,
// as we might start from sliderScaleY set to 0.3 if device was in collapsed QS // as we might start from sliderScaleY set to 0.3 if device was in collapsed QS
// portrait orientation before // portrait orientation before
.addFloat(qsBrightness, "sliderScaleY", 0.3f, 1) .addFloat(qsBrightness, "sliderScaleY", 0.3f, 1)
.addFloat(qqsBrightness, "translationY", 0, translationY) .addFloat(qqsBrightness, "translationY", 0, translationY)
.setInterpolator(mQSExpansionPathInterpolator.getYInterpolator())
.build(); .build();
} else if (qsBrightness != null) { } else if (qsBrightness != null) {
firstPageBuilder.addFloat(qsBrightness, "translationY", // The brightness slider's visible bottom edge must maintain a constant margin from the
qsBrightness.getMeasuredHeight() * 0.5f, 0); // QS tiles during transition. Thus the slider must (1) perform the same vertical
mBrightnessAnimator = new Builder() // translation as the tiles, and (2) compensate for the slider scaling.
// For (1), compute the distance via the vertical distance between QQS and QS tile
// layout top.
View quickSettingsRootView = mQs.getView();
View qsTileLayout = (View) mQsPanelController.getTileLayout();
View qqsTileLayout = (View) mQuickQSPanelController.getTileLayout();
getRelativePosition(mTmpLoc1, qsTileLayout, quickSettingsRootView);
getRelativePosition(mTmpLoc2, qqsTileLayout, quickSettingsRootView);
int tileMovement = mTmpLoc2[1] - mTmpLoc1[1];
// For (2), the slider scales to the vertical center, so compensate with half the
// height at full collapse.
float scaleCompensation = qsBrightness.getMeasuredHeight() * 0.5f;
mBrightnessTranslationAnimator = new Builder()
.addFloat(qsBrightness, "translationY", scaleCompensation + tileMovement, 0)
.addFloat(qsBrightness, "sliderScaleY", 0, 1)
.setInterpolator(mQSExpansionPathInterpolator.getYInterpolator())
.build();
// While the slider's position and unfurl is animated throughouth the motion, the
// fade in happens independently.
mBrightnessOpacityAnimator = new Builder()
.addFloat(qsBrightness, "alpha", 0, 1) .addFloat(qsBrightness, "alpha", 0, 1)
.addFloat(qsBrightness, "sliderScaleY", 0.3f, 1) .setStartDelay(0.2f)
.setInterpolator(Interpolators.ALPHA_IN) .setEndDelay(1 - 0.5f)
.setStartDelay(0.3f)
.build(); .build();
mAllViews.add(qsBrightness); mAllViews.add(qsBrightness);
} else {
mBrightnessAnimator = null;
} }
} }
@@ -676,11 +686,13 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
if (mQQSTileHeightAnimator != null) { if (mQQSTileHeightAnimator != null) {
mQQSTileHeightAnimator.setPosition(position); mQQSTileHeightAnimator.setPosition(position);
} }
mQSTileLayoutTranslatorAnimator.setPosition(position);
mQQSTranslationYAnimator.setPosition(position); mQQSTranslationYAnimator.setPosition(position);
mAllPagesDelayedAnimator.setPosition(position); mAllPagesDelayedAnimator.setPosition(position);
if (mBrightnessAnimator != null) { if (mBrightnessOpacityAnimator != null) {
mBrightnessAnimator.setPosition(position); mBrightnessOpacityAnimator.setPosition(position);
}
if (mBrightnessTranslationAnimator != null) {
mBrightnessTranslationAnimator.setPosition(position);
} }
if (mQQSFooterActionsAnimator != null) { if (mQQSFooterActionsAnimator != null) {
mQQSFooterActionsAnimator.setPosition(position); mQQSFooterActionsAnimator.setPosition(position);
@@ -774,13 +786,6 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
setCurrentPosition(); setCurrentPosition();
}; };
/**
* True whe QS will be pulled from the top, false when it will be clipped.
*/
public void setTranslateWhileExpanding(boolean shouldTranslate) {
mTranslateWhileExpanding = shouldTranslate;
}
private static class HeightExpansionAnimator { private static class HeightExpansionAnimator {
private final List<View> mViews = new ArrayList<>(); private final List<View> mViews = new ArrayList<>();
private final ValueAnimator mAnimator; private final ValueAnimator mAnimator;

View File

@@ -573,7 +573,6 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
@Override @Override
public void setInSplitShade(boolean inSplitShade) { public void setInSplitShade(boolean inSplitShade) {
mInSplitShade = inSplitShade; mInSplitShade = inSplitShade;
mQSAnimator.setTranslateWhileExpanding(inSplitShade);
updateShowCollapsedOnKeyguard(); updateShowCollapsedOnKeyguard();
updateQsState(); updateQsState();
} }
@@ -669,7 +668,11 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
mQSPanelController.setRevealExpansion(expansion); mQSPanelController.setRevealExpansion(expansion);
mQSPanelController.getTileLayout().setExpansion(expansion, proposedTranslation); mQSPanelController.getTileLayout().setExpansion(expansion, proposedTranslation);
mQuickQSPanelController.getTileLayout().setExpansion(expansion, proposedTranslation); mQuickQSPanelController.getTileLayout().setExpansion(expansion, proposedTranslation);
mQSPanelScrollView.setTranslationY(translationScaleY * heightDiff);
float qsScrollViewTranslation =
onKeyguard && !mShowCollapsedOnKeyguard ? panelTranslationY : 0;
mQSPanelScrollView.setTranslationY(qsScrollViewTranslation);
if (fullyCollapsed) { if (fullyCollapsed) {
mQSPanelScrollView.setScrollY(0); mQSPanelScrollView.setScrollY(0);
} }