Merge "Improve global actions dialog animation" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-21 23:57:36 +00:00
committed by Android (Google) Code Review

View File

@@ -129,7 +129,6 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.EmergencyDialerConstants;
import com.android.systemui.util.RingerModeTracker;
import com.android.systemui.util.leak.RotationUtils;
import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolator;
import java.util.ArrayList;
import java.util.List;
@@ -1899,6 +1898,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
private ControlsUiController mControlsUiController;
private ViewGroup mControlsView;
private ViewGroup mContainer;
ActionsDialog(Context context, MyAdapter adapter, MyOverflowAdapter overflowAdapter,
GlobalActionsPanelPlugin.PanelViewController plugin,
@@ -2051,6 +2051,11 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
});
mGlobalActionsLayout.setRotationListener(this::onRotate);
mGlobalActionsLayout.setAdapter(mAdapter);
mContainer = findViewById(com.android.systemui.R.id.global_actions_container);
// Some legacy dialog layouts don't have the outer container
if (mContainer == null) {
mContainer = mGlobalActionsLayout;
}
mOverflowPopup = createPowerOverflowPopup();
@@ -2177,10 +2182,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
mHadTopUi = mNotificationShadeWindowController.getForceHasTopUi();
mNotificationShadeWindowController.setForceHasTopUi(true);
mBackgroundDrawable.setAlpha(0);
mGlobalActionsLayout.setTranslationX(mGlobalActionsLayout.getAnimationOffsetX());
mGlobalActionsLayout.setTranslationY(mGlobalActionsLayout.getAnimationOffsetY());
mGlobalActionsLayout.setAlpha(0);
mGlobalActionsLayout.animate()
mContainer.setTranslationX(mGlobalActionsLayout.getAnimationOffsetX());
mContainer.setTranslationY(mGlobalActionsLayout.getAnimationOffsetY());
mContainer.setAlpha(0);
mContainer.animate()
.alpha(1)
.translationX(0)
.translationY(0)
@@ -2212,16 +2217,16 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
@Override
public void dismiss() {
dismissWithAnimation(() -> {
mGlobalActionsLayout.setTranslationX(0);
mGlobalActionsLayout.setTranslationY(0);
mGlobalActionsLayout.setAlpha(1);
mGlobalActionsLayout.animate()
mContainer.setTranslationX(0);
mContainer.setTranslationY(0);
mContainer.setAlpha(1);
mContainer.animate()
.alpha(0)
.translationX(mGlobalActionsLayout.getAnimationOffsetX())
.translationY(mGlobalActionsLayout.getAnimationOffsetY())
.setDuration(550)
.setDuration(450)
.withEndAction(this::completeDismiss)
.setInterpolator(new LogAccelerateInterpolator())
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.setUpdateListener(animation -> {
float animatedValue = 1f - animation.getAnimatedFraction();
int alpha = (int) (animatedValue * mScrimAlpha * 255);