Merge "Fix brightness animation in split shade" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
41e02db201
@@ -409,21 +409,8 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mAllowFancy) {
|
if (mAllowFancy) {
|
||||||
// Make brightness appear static position and alpha in through second half.
|
animateBrightnessSlider(firstPageBuilder);
|
||||||
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;
|
|
||||||
}
|
|
||||||
mFirstPageAnimator = firstPageBuilder
|
mFirstPageAnimator = firstPageBuilder
|
||||||
.setListener(this)
|
.setListener(this)
|
||||||
.build();
|
.build();
|
||||||
@@ -474,20 +461,53 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
|||||||
.addFloat(tileLayout, "alpha", 0, 1).build();
|
.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() {
|
private void updateQQSFooterAnimation() {
|
||||||
int[] qsPosition = new int[2];
|
int translationY = getRelativeTranslationY(mQSFooterActions, mQQSFooterActions);
|
||||||
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();
|
|
||||||
mQQSFooterActionsAnimator = new TouchAnimator.Builder()
|
mQQSFooterActionsAnimator = new TouchAnimator.Builder()
|
||||||
.addFloat(mQQSFooterActions, "translationY", 0, translationY)
|
.addFloat(mQQSFooterActions, "translationY", 0, translationY)
|
||||||
.build();
|
.build();
|
||||||
mAnimatedQsViews.add(mQSFooterActions);
|
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) {
|
private boolean isIconInAnimatedRow(int count) {
|
||||||
if (mPagedLayout == null) {
|
if (mPagedLayout == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -258,10 +258,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
|||||||
return mView.isLayoutRtl();
|
return mView.isLayoutRtl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getBrightnessView() {
|
|
||||||
return mView.getBrightnessView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public void setPageListener(PagedTileLayout.PageListener listener) {
|
public void setPageListener(PagedTileLayout.PageListener listener) {
|
||||||
mView.setPageListener(listener);
|
mView.setPageListener(listener);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.annotation.Nullable;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.metrics.LogMaker;
|
import android.metrics.LogMaker;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
@@ -405,6 +406,10 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
|||||||
mUsingHorizontalLayoutChangedListener = listener;
|
mUsingHorizontalLayoutChangedListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public View getBrightnessView() {
|
||||||
|
return mView.getBrightnessView();
|
||||||
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public static final class TileRecord extends QSPanel.Record {
|
public static final class TileRecord extends QSPanel.Record {
|
||||||
public QSTile tile;
|
public QSTile tile;
|
||||||
|
|||||||
Reference in New Issue
Block a user