Fix brightness animation in split shade
Implementing moving QQS brightness slider into position of QS slider in QSAnimator. In split shade most of QS slider animation is disabled as that slider becomes visible only at the end of the transition. Test: Open split shade -> expand quick settings -> admire brightness slider moving to the new position Bug: 196957888 Change-Id: I63bb6f01723d85b1b8080b1d4ccbaa15db4a0ba5
This commit is contained in:
@@ -405,21 +405,8 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
}
|
||||
|
||||
if (mAllowFancy) {
|
||||
// Make brightness appear static position and alpha in through second half.
|
||||
View brightness = mQsPanelController.getBrightnessView();
|
||||
if (brightness != null) {
|
||||
firstPageBuilder.addFloat(brightness, "translationY",
|
||||
brightness.getMeasuredHeight() * 0.5f, 0);
|
||||
mBrightnessAnimator = new TouchAnimator.Builder()
|
||||
.addFloat(brightness, "alpha", 0, 1)
|
||||
.addFloat(brightness, "sliderScaleY", 0.3f, 1)
|
||||
.setInterpolator(Interpolators.ALPHA_IN)
|
||||
.setStartDelay(0.3f)
|
||||
.build();
|
||||
mAllViews.add(brightness);
|
||||
} else {
|
||||
mBrightnessAnimator = null;
|
||||
}
|
||||
animateBrightnessSlider(firstPageBuilder);
|
||||
|
||||
mFirstPageAnimator = firstPageBuilder
|
||||
.setListener(this)
|
||||
.build();
|
||||
@@ -470,20 +457,53 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
.addFloat(tileLayout, "alpha", 0, 1).build();
|
||||
}
|
||||
|
||||
private void animateBrightnessSlider(Builder firstPageBuilder) {
|
||||
View qsBrightness = mQsPanelController.getBrightnessView();
|
||||
View qqsBrightness = mQuickQSPanelController.getBrightnessView();
|
||||
if (qqsBrightness != null && qqsBrightness.getVisibility() == View.VISIBLE) {
|
||||
// animating in split shade mode
|
||||
mAnimatedQsViews.add(qsBrightness);
|
||||
mAllViews.add(qqsBrightness);
|
||||
int translationY = getRelativeTranslationY(qsBrightness, qqsBrightness);
|
||||
mBrightnessAnimator = new Builder()
|
||||
// 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
|
||||
// portrait orientation before
|
||||
.addFloat(qsBrightness, "sliderScaleY", 0.3f, 1)
|
||||
.addFloat(qqsBrightness, "translationY", 0, translationY)
|
||||
.build();
|
||||
} else if (qsBrightness != null) {
|
||||
firstPageBuilder.addFloat(qsBrightness, "translationY",
|
||||
qsBrightness.getMeasuredHeight() * 0.5f, 0);
|
||||
mBrightnessAnimator = new Builder()
|
||||
.addFloat(qsBrightness, "alpha", 0, 1)
|
||||
.addFloat(qsBrightness, "sliderScaleY", 0.3f, 1)
|
||||
.setInterpolator(Interpolators.ALPHA_IN)
|
||||
.setStartDelay(0.3f)
|
||||
.build();
|
||||
mAllViews.add(qsBrightness);
|
||||
} else {
|
||||
mBrightnessAnimator = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateQQSFooterAnimation() {
|
||||
int[] qsPosition = new int[2];
|
||||
int[] qqsPosition = new int[2];
|
||||
View commonView = mQs.getView();
|
||||
getRelativePositionInt(qsPosition, mQSFooterActions, commonView);
|
||||
getRelativePositionInt(qqsPosition, mQQSFooterActions, commonView);
|
||||
int translationY = (qsPosition[1] - qqsPosition[1])
|
||||
- mQuickStatusBarHeader.getOffsetTranslation();
|
||||
int translationY = getRelativeTranslationY(mQSFooterActions, mQQSFooterActions);
|
||||
mQQSFooterActionsAnimator = new TouchAnimator.Builder()
|
||||
.addFloat(mQQSFooterActions, "translationY", 0, translationY)
|
||||
.build();
|
||||
mAnimatedQsViews.add(mQSFooterActions);
|
||||
}
|
||||
|
||||
private int getRelativeTranslationY(View view1, View view2) {
|
||||
int[] qsPosition = new int[2];
|
||||
int[] qqsPosition = new int[2];
|
||||
View commonView = mQs.getView();
|
||||
getRelativePositionInt(qsPosition, view1, commonView);
|
||||
getRelativePositionInt(qqsPosition, view2, commonView);
|
||||
return (qsPosition[1] - qqsPosition[1]) - mQuickStatusBarHeader.getOffsetTranslation();
|
||||
}
|
||||
|
||||
private boolean isIconInAnimatedRow(int count) {
|
||||
if (mPagedLayout == null) {
|
||||
return false;
|
||||
|
||||
@@ -254,10 +254,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
||||
return mView.isLayoutRtl();
|
||||
}
|
||||
|
||||
public View getBrightnessView() {
|
||||
return mView.getBrightnessView();
|
||||
}
|
||||
|
||||
/** */
|
||||
public void setPageListener(PagedTileLayout.PageListener listener) {
|
||||
mView.setPageListener(listener);
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.annotation.Nullable;
|
||||
import android.content.ComponentName;
|
||||
import android.content.res.Configuration;
|
||||
import android.metrics.LogMaker;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
@@ -405,6 +406,10 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
||||
mUsingHorizontalLayoutChangedListener = listener;
|
||||
}
|
||||
|
||||
public View getBrightnessView() {
|
||||
return mView.getBrightnessView();
|
||||
}
|
||||
|
||||
/** */
|
||||
public static final class TileRecord extends QSPanel.Record {
|
||||
public QSTile tile;
|
||||
|
||||
Reference in New Issue
Block a user