Adds all_apps_blur flag.
This enables blur both for Taskbar and Launcher, but in slightly different ways. For Taskbar All Apps, we apply blur to the overlay window, and for Launcher All Apps, we utilize the existing DepthController to blur the wallpaper window. For similicity, we currently fade out workspace/hotseat to avoid awkward view + window blurs which don't look that good. This is not the POR, but I think it achieves most of the effect and will help us get some blur exposure. Separately I will continue to investigate options such as blurring workspace in a clever way so it feels blended with the wallpaper, reusing the Taskbar window and connecting it to LauncherState, or using a SurfaceView (though I spent quite some time trying this and it seemed the same as the original issue). In both cases, we use a 20-30% opacity scrim with a set color, and a panel that blends 40% opacity of a dark/light color with 10% white. Also updated some incorrect isTablet checks which really should have been checking shouldShowAllAppsOnSheet(), which includes the all_apps_sheet_for_handheld flag. Demo: https://drive.google.com/file/d/1Ov9Dg3R9YHNfisfxNf97ZIhlDeEA1IWj/view?usp=sharing&resourcekey=0-l_SDpqpS4HtOb10a3b_jNg Other upcoming improvements: interpolator tweaks, colors of things inside the app panel (tabs, private space, search results, etc). Bug: 400827727 Bug: 371343636 Test: Manual Flag: com.android.launcher3.all_apps_blur Change-Id: Ic7063cd822f39a5977715b5477f825bf11e57bdf
This commit is contained in:
1 parent
ccbc78735f
commit
ccb3a5c25c
19 files changed
+189
-30
No files matched your search
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static com.android.app.animation.Interpolators.DECELERATED_EASE;
|
||||
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;
|
||||
|
||||
@@ -35,6 +37,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
@@ -48,9 +51,11 @@ import com.android.launcher3.views.AbstractSlideInView;
|
||||
public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverlayContext>
|
||||
implements Insettable, DeviceProfile.OnDeviceProfileChangeListener {
|
||||
private final Handler mHandler;
|
||||
private final int mMaxBlurRadius;
|
||||
|
||||
private TaskbarAllAppsContainerView mAppsView;
|
||||
private float mShiftRange;
|
||||
private int mBlurRadius;
|
||||
private @Nullable Runnable mShowOnFullyAttachedToWindowRunnable;
|
||||
|
||||
// Initialized in init.
|
||||
@@ -64,6 +69,8 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mHandler = new Handler(Looper.myLooper());
|
||||
mMaxBlurRadius = getResources().getDimensionPixelSize(
|
||||
R.dimen.max_depth_blur_radius_enhanced);
|
||||
}
|
||||
|
||||
void init(TaskbarAllAppsCallbacks callbacks) {
|
||||
@@ -99,6 +106,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
if (!animate) {
|
||||
mAllAppsCallbacks.onAllAppsTransitionEnd(true);
|
||||
setTranslationShift(TRANSLATION_SHIFT_OPENED);
|
||||
mBlurRadius = mMaxBlurRadius;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,6 +131,16 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
animation.setViewAlpha(mAppsView, 1 - mToTranslationShift, allAppsFadeInterpolator);
|
||||
}
|
||||
|
||||
if (Flags.allAppsBlur()) {
|
||||
Interpolator blurInterpolator = isOpening ? LINEAR : DECELERATED_EASE;
|
||||
animation.addOnFrameListener(a -> {
|
||||
float blurProgress =
|
||||
isOpening ? a.getAnimatedFraction() : 1 - a.getAnimatedFraction();
|
||||
mBlurRadius =
|
||||
(int) (mMaxBlurRadius * blurInterpolator.getInterpolation(blurProgress));
|
||||
});
|
||||
}
|
||||
|
||||
mAllAppsCallbacks.onAllAppsAnimationPending(animation, isOpening);
|
||||
}
|
||||
|
||||
@@ -219,6 +237,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
// to pass extra bottom offset to background scrim to fill the bottom gap during predictive
|
||||
// back swipe.
|
||||
mAppsView.drawOnScrimWithBottomOffset(canvas, getBottomOffsetPx());
|
||||
mActivityContext.getOverlayController().setBackgroundBlurRadius(mBlurRadius);
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@@ -230,9 +249,13 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
return mActivityContext.getDeviceProfile().isPhone
|
||||
? Themes.getAttrColor(context, R.attr.allAppsScrimColor)
|
||||
: context.getColor(R.color.widgets_picker_scrim);
|
||||
if (!mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
}
|
||||
if (Flags.allAppsBlur()) {
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColorOverBlur);
|
||||
}
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -254,6 +277,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
public void onDeviceProfileChanged(DeviceProfile dp) {
|
||||
setShiftRange(dp.allAppsShiftRange);
|
||||
setTranslationShift(TRANSLATION_SHIFT_OPENED);
|
||||
mBlurRadius = mMaxBlurRadius;
|
||||
}
|
||||
|
||||
private void setShiftRange(float shiftRange) {
|
||||
|
||||
Reference in new issue
Block a user