Adds Blur and BlurFallback styles for All Apps.
Technically these styles can be used throughout Launcher, e.g. Widget Picker and Folders, but this CL only applies it to All Apps. At a high level, views wishing to apply transparency to show blur should use these new attr values rather than colors directly. When blur changes, e.g. starting or stopping battery saver, the style is re-applied and revelant views are invalidated. For Launcher, this is handled by DepthController, and for Taskbar it's handled by a CrossWindowBlurListener. Also updated the Private Space animation slightly to account for the translucent decorators (specifically, we can't use the mask view to cover them when blur is enabled). Screenshots: https://drive.google.com/drive/folders/1tU472KHotgEBpT-Ec9VOBWPBf_YdVqv2?resourcekey=0-ebf7W8O6iDJ4UVMtRzTABg&usp=sharing Private Space animations: https://drive.google.com/file/d/1h5pn8Xb17TPcbujr7uSAJNTq8kwNZoIp/view?usp=drive_link&resourcekey=0-TzpaJ16Gg8_QJctBx4oiIg Private Space QS Tile animations: https://drive.google.com/file/d/1dCuqnqd5z2kSBEakGobMlEkMwFDBWRbJ/view?usp=drive_link&resourcekey=0-qRVFPb-a6OzaZQOf4x86Jw Bug: 371343636 Test: Manual Flag: com.android.launcher3.all_apps_blur Change-Id: Ia9f581f50d1adc0830569656bdeb751deb710a9c
This commit is contained in:
1 parent
ef95172183
commit
16a024df71
37 files changed
+330
-166
No files matched your search
@@ -20,6 +20,7 @@ import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.touch.AllAppsSwipeController.ALL_APPS_FADE_MANUAL;
|
||||
import static com.android.launcher3.touch.AllAppsSwipeController.SCRIM_FADE_MANUAL;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.content.Context;
|
||||
@@ -28,6 +29,7 @@ import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
@@ -47,11 +49,14 @@ import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** Wrapper for taskbar all apps with slide-in behavior. */
|
||||
public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverlayContext>
|
||||
implements Insettable, DeviceProfile.OnDeviceProfileChangeListener {
|
||||
private final Handler mHandler;
|
||||
private final int mMaxBlurRadius;
|
||||
private final Consumer<Boolean> mWindowBlurListener = blursEnabled -> invalidate();
|
||||
|
||||
private TaskbarAllAppsContainerView mAppsView;
|
||||
private float mShiftRange;
|
||||
@@ -214,6 +219,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
dispatcher.registerOnBackInvokedCallback(
|
||||
OnBackInvokedDispatcher.PRIORITY_DEFAULT, this);
|
||||
}
|
||||
CrossWindowBlurListeners.getInstance().addListener(MAIN_EXECUTOR, mWindowBlurListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -226,6 +232,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
if (dispatcher != null) {
|
||||
dispatcher.unregisterOnBackInvokedCallback(this);
|
||||
}
|
||||
CrossWindowBlurListeners.getInstance().removeListener(mWindowBlurListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -249,13 +256,11 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
if (!mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
if (mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()
|
||||
&& !Flags.allAppsBlur()) {
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
if (Flags.allAppsBlur()) {
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColorOverBlur);
|
||||
}
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user