summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java94
-rw-r--r--packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsFlatLayout.java4
4 files changed, 81 insertions, 41 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt
index aed7cd316bc7..f22ff437e4db 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt
@@ -31,6 +31,13 @@ interface ControlsUiController {
fun show(parent: ViewGroup, dismissGlobalActions: Runnable)
fun hide()
+
+ /**
+ * Request all open dialogs be closed. Set [immediately] to true to dismiss without
+ * animations.
+ */
+ fun closeDialogs(immediately: Boolean)
+
fun onRefreshState(componentName: ComponentName, controls: List<Control>)
fun onActionResponse(
componentName: ComponentName,
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
index 38e732517c79..b2083a78729e 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
@@ -517,15 +517,24 @@ class ControlsUiControllerImpl @Inject constructor (
}
}
- override fun hide() {
- Log.d(ControlsUiController.TAG, "hide()")
- hidden = true
- popup?.dismissImmediate()
+ override fun closeDialogs(immediately: Boolean) {
+ if (immediately) {
+ popup?.dismissImmediate()
+ } else {
+ popup?.dismiss()
+ }
+ popup = null
controlViewsById.forEach {
it.value.dismiss()
}
controlActionCoordinator.closeDialogs()
+ }
+
+ override fun hide() {
+ hidden = true
+
+ closeDialogs(true)
controlsController.get().unsubscribe()
parent.removeAllViews()
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index cf9e1412f3bd..cf3538c592d9 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -23,6 +23,10 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOM
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.Dialog;
@@ -2174,24 +2178,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
mShowing = true;
mHadTopUi = mNotificationShadeWindowController.getForceHasTopUi();
mNotificationShadeWindowController.setForceHasTopUi(true);
- mBackgroundDrawable.setAlpha(0);
- mContainer.setTranslationX(mGlobalActionsLayout.getAnimationOffsetX());
- mContainer.setTranslationY(mGlobalActionsLayout.getAnimationOffsetY());
- mContainer.setAlpha(0);
- mContainer.animate()
- .alpha(1)
- .translationX(0)
- .translationY(0)
- .setDuration(450)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .setUpdateListener(animation -> {
- float animatedValue = animation.getAnimatedFraction();
- int alpha = (int) (animatedValue * mScrimAlpha * 255);
- mBackgroundDrawable.setAlpha(alpha);
- mDepthController.updateGlobalDialogVisibility(animatedValue,
- mGlobalActionsLayout);
- })
- .start();
+
ViewGroup root = (ViewGroup) mGlobalActionsLayout.getRootView();
root.setOnApplyWindowInsetsListener((v, windowInsets) -> {
if (mUseControlsLayout) {
@@ -2205,29 +2192,66 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
if (mControlsUiController != null) {
mControlsUiController.show(mControlsView, this::dismissForControlsActivity);
}
+
+ mBackgroundDrawable.setAlpha(0);
+ float xOffset = mGlobalActionsLayout.getAnimationOffsetX();
+ ObjectAnimator alphaAnimator =
+ ObjectAnimator.ofFloat(mContainer, "transitionAlpha", 0f, 1f);
+ alphaAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
+ alphaAnimator.setDuration(183);
+ alphaAnimator.addUpdateListener((animation) -> {
+ float animatedValue = animation.getAnimatedFraction();
+ int alpha = (int) (animatedValue * mScrimAlpha * 255);
+ mBackgroundDrawable.setAlpha(alpha);
+ mDepthController.updateGlobalDialogVisibility(animatedValue,
+ mGlobalActionsLayout);
+ });
+
+ ObjectAnimator xAnimator =
+ ObjectAnimator.ofFloat(mContainer, "translationX", xOffset, 0f);
+ alphaAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
+ alphaAnimator.setDuration(350);
+
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(alphaAnimator, xAnimator);
+ animatorSet.start();
}
@Override
public void dismiss() {
dismissWithAnimation(() -> {
mContainer.setTranslationX(0);
- mContainer.setTranslationY(0);
- mContainer.setAlpha(1);
- mContainer.animate()
- .alpha(0)
- .translationX(mGlobalActionsLayout.getAnimationOffsetX())
- .translationY(mGlobalActionsLayout.getAnimationOffsetY())
- .setDuration(450)
- .withEndAction(this::completeDismiss)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .setUpdateListener(animation -> {
- float animatedValue = 1f - animation.getAnimatedFraction();
- int alpha = (int) (animatedValue * mScrimAlpha * 255);
- mBackgroundDrawable.setAlpha(alpha);
- mDepthController.updateGlobalDialogVisibility(animatedValue,
- mGlobalActionsLayout);
- })
- .start();
+ ObjectAnimator alphaAnimator =
+ ObjectAnimator.ofFloat(mContainer, "transitionAlpha", 1f, 0f);
+ alphaAnimator.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);
+ alphaAnimator.setDuration(233);
+ alphaAnimator.addUpdateListener((animation) -> {
+ float animatedValue = 1f - animation.getAnimatedFraction();
+ int alpha = (int) (animatedValue * mScrimAlpha * 255);
+ mBackgroundDrawable.setAlpha(alpha);
+ mDepthController.updateGlobalDialogVisibility(animatedValue,
+ mGlobalActionsLayout);
+ });
+
+ float xOffset = mGlobalActionsLayout.getAnimationOffsetX();
+ ObjectAnimator xAnimator =
+ ObjectAnimator.ofFloat(mContainer, "translationX", 0f, xOffset);
+ alphaAnimator.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);
+ alphaAnimator.setDuration(350);
+
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(alphaAnimator, xAnimator);
+ animatorSet.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ completeDismiss();
+ }
+ });
+
+ animatorSet.start();
+
+ // close first, as popup windows will not fade during the animation
+ dismissOverflow(false);
+ if (mControlsUiController != null) mControlsUiController.closeDialogs(false);
});
}
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsFlatLayout.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsFlatLayout.java
index 2f32d972449e..c7612d41c45d 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsFlatLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsFlatLayout.java
@@ -90,11 +90,11 @@ public class GlobalActionsFlatLayout extends GlobalActionsLayout {
@Override
public float getAnimationOffsetX() {
- return 0;
+ return getAnimationDistance();
}
@Override
public float getAnimationOffsetY() {
- return -getAnimationDistance();
+ return 0f;
}
}