Merge "Hook up zoom to GlobalActionsDialog" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a5fab0fcea
@@ -99,7 +99,7 @@ import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
|
||||
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
|
||||
import com.android.systemui.statusbar.BlurUtils;
|
||||
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
||||
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
|
||||
import com.android.systemui.statusbar.phone.ScrimController;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
@@ -162,7 +162,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
private final IActivityManager mIActivityManager;
|
||||
private final TelecomManager mTelecomManager;
|
||||
private final MetricsLogger mMetricsLogger;
|
||||
private final BlurUtils mBlurUtils;
|
||||
private final NotificationShadeDepthController mDepthController;
|
||||
|
||||
private ArrayList<Action> mItems;
|
||||
private ActionsDialog mDialog;
|
||||
@@ -207,7 +207,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
KeyguardStateController keyguardStateController, UserManager userManager,
|
||||
TrustManager trustManager, IActivityManager iActivityManager,
|
||||
@Nullable TelecomManager telecomManager, MetricsLogger metricsLogger,
|
||||
BlurUtils blurUtils, SysuiColorExtractor colorExtractor,
|
||||
NotificationShadeDepthController depthController, SysuiColorExtractor colorExtractor,
|
||||
IStatusBarService statusBarService,
|
||||
NotificationShadeWindowController notificationShadeWindowController,
|
||||
ControlsUiController controlsUiController, IWindowManager iWindowManager,
|
||||
@@ -229,7 +229,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
mIActivityManager = iActivityManager;
|
||||
mTelecomManager = telecomManager;
|
||||
mMetricsLogger = metricsLogger;
|
||||
mBlurUtils = blurUtils;
|
||||
mDepthController = depthController;
|
||||
mSysuiColorExtractor = colorExtractor;
|
||||
mStatusBarService = statusBarService;
|
||||
mNotificationShadeWindowController = notificationShadeWindowController;
|
||||
@@ -437,7 +437,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
: null;
|
||||
|
||||
ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, panelViewController,
|
||||
mBlurUtils, mSysuiColorExtractor, mStatusBarService,
|
||||
mDepthController, mSysuiColorExtractor, mStatusBarService,
|
||||
mNotificationShadeWindowController,
|
||||
shouldShowControls() ? mControlsUiController : null);
|
||||
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
|
||||
@@ -1570,20 +1570,21 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
private ResetOrientationData mResetOrientationData;
|
||||
private boolean mHadTopUi;
|
||||
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
||||
private final BlurUtils mBlurUtils;
|
||||
private final NotificationShadeDepthController mDepthController;
|
||||
|
||||
private ControlsUiController mControlsUiController;
|
||||
private ViewGroup mControlsView;
|
||||
|
||||
ActionsDialog(Context context, MyAdapter adapter,
|
||||
GlobalActionsPanelPlugin.PanelViewController plugin, BlurUtils blurUtils,
|
||||
GlobalActionsPanelPlugin.PanelViewController plugin,
|
||||
NotificationShadeDepthController depthController,
|
||||
SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
|
||||
NotificationShadeWindowController notificationShadeWindowController,
|
||||
ControlsUiController controlsUiController) {
|
||||
super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
|
||||
mContext = context;
|
||||
mAdapter = adapter;
|
||||
mBlurUtils = blurUtils;
|
||||
mDepthController = depthController;
|
||||
mColorExtractor = sysuiColorExtractor;
|
||||
mStatusBarService = statusBarService;
|
||||
mNotificationShadeWindowController = notificationShadeWindowController;
|
||||
@@ -1792,8 +1793,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
float animatedValue = animation.getAnimatedFraction();
|
||||
int alpha = (int) (animatedValue * mScrimAlpha * 255);
|
||||
mBackgroundDrawable.setAlpha(alpha);
|
||||
mBlurUtils.applyBlur(mGlobalActionsLayout.getViewRootImpl(),
|
||||
mBlurUtils.blurRadiusOfRatio(animatedValue));
|
||||
mDepthController.updateGlobalDialogVisibility(animatedValue,
|
||||
mGlobalActionsLayout);
|
||||
})
|
||||
.start();
|
||||
if (mControlsUiController != null) {
|
||||
@@ -1822,8 +1823,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
float animatedValue = 1f - animation.getAnimatedFraction();
|
||||
int alpha = (int) (animatedValue * mScrimAlpha * 255);
|
||||
mBackgroundDrawable.setAlpha(alpha);
|
||||
mBlurUtils.applyBlur(mGlobalActionsLayout.getViewRootImpl(),
|
||||
mBlurUtils.blurRadiusOfRatio(animatedValue));
|
||||
mDepthController.updateGlobalDialogVisibility(animatedValue,
|
||||
mGlobalActionsLayout);
|
||||
})
|
||||
.start();
|
||||
dismissPanel();
|
||||
|
||||
@@ -58,6 +58,7 @@ class NotificationShadeDepthController @Inject constructor(
|
||||
}
|
||||
|
||||
lateinit var root: View
|
||||
private var blurRoot: View? = null
|
||||
private var keyguardAnimator: Animator? = null
|
||||
private var notificationAnimator: Animator? = null
|
||||
private var updateScheduled: Boolean = false
|
||||
@@ -72,6 +73,7 @@ class NotificationShadeDepthController @Inject constructor(
|
||||
return shadeBlurRadius.toFloat()
|
||||
}
|
||||
})
|
||||
private val zoomInterpolator = Interpolators.ACCELERATE_DECELERATE
|
||||
private var shadeBlurRadius = 0
|
||||
set(value) {
|
||||
if (field == value) return
|
||||
@@ -84,6 +86,7 @@ class NotificationShadeDepthController @Inject constructor(
|
||||
field = value
|
||||
scheduleUpdate()
|
||||
}
|
||||
private var globalDialogVisibility = 0f
|
||||
|
||||
/**
|
||||
* Callback that updates the window blur value and is called only once per frame.
|
||||
@@ -91,9 +94,12 @@ class NotificationShadeDepthController @Inject constructor(
|
||||
private val updateBlurCallback = Choreographer.FrameCallback {
|
||||
updateScheduled = false
|
||||
|
||||
val blur = max(shadeBlurRadius, wakeAndUnlockBlurRadius)
|
||||
blurUtils.applyBlur(root.viewRootImpl, blur)
|
||||
wallpaperManager.setWallpaperZoomOut(root.windowToken, blurUtils.ratioOfBlurRadius(blur))
|
||||
val blur = max(shadeBlurRadius,
|
||||
max(wakeAndUnlockBlurRadius, blurUtils.blurRadiusOfRatio(globalDialogVisibility)))
|
||||
blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur)
|
||||
val rawZoom = max(blurUtils.ratioOfBlurRadius(blur), globalDialogVisibility)
|
||||
wallpaperManager.setWallpaperZoomOut(root.windowToken,
|
||||
zoomInterpolator.getInterpolation(rawZoom))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,14 +168,23 @@ class NotificationShadeDepthController @Inject constructor(
|
||||
shadeSpring.animateToFinalPosition(newBlur.toFloat())
|
||||
}
|
||||
|
||||
private fun scheduleUpdate() {
|
||||
private fun scheduleUpdate(viewToBlur: View? = null) {
|
||||
if (updateScheduled) {
|
||||
return
|
||||
}
|
||||
updateScheduled = true
|
||||
blurRoot = viewToBlur
|
||||
choreographer.postFrameCallback(updateBlurCallback)
|
||||
}
|
||||
|
||||
fun updateGlobalDialogVisibility(visibility: Float, dialogView: View) {
|
||||
if (visibility == globalDialogVisibility) {
|
||||
return
|
||||
}
|
||||
globalDialogVisibility = visibility
|
||||
scheduleUpdate(dialogView)
|
||||
}
|
||||
|
||||
override fun dump(fd: FileDescriptor, pw: PrintWriter, args: Array<out String>) {
|
||||
IndentingPrintWriter(pw, " ").let {
|
||||
it.println("StatusBarWindowBlurController:")
|
||||
|
||||
Reference in New Issue
Block a user