Merge "Add wallpaper zoom to areas that have blur" into ub-launcher3-master

This commit is contained in:
Lucas Dupin authored and Android (Google) Code Review committed 2020-03-18 21:59:33 +00:00
commit e73d415bcc
20 files changed
+141 -146

No files matched your search

+8 -8
View File
@@ -124,7 +124,7 @@ import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.AllAppsSwipeController;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.uioverrides.DepthController;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -326,14 +326,14 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
private boolean mDeferOverlayCallbacks;
private final Runnable mDeferredOverlayCallbacks = this::checkIfOverlayStillDeferred;
private BackgroundBlurController mBackgroundBlurController =
new BackgroundBlurController(this);
private DepthController mDepthController =
new DepthController(this);
private final ViewTreeObserver.OnDrawListener mOnDrawListener =
new ViewTreeObserver.OnDrawListener() {
@Override
public void onDraw() {
getBackgroundBlurController().setSurfaceToLauncher(mDragLayer);
getDepthController().setSurfaceToLauncher(mDragLayer);
mDragLayer.post(() -> mDragLayer.getViewTreeObserver().removeOnDrawListener(
this));
}
@@ -956,7 +956,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
NotificationListener.removeNotificationsChangedListener();
getStateManager().moveToRestState();
getBackgroundBlurController().setSurfaceToLauncher(null);
getDepthController().setSurfaceToLauncher(null);
// Workaround for b/78520668, explicitly trim memory once UI is hidden
onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
@@ -2717,7 +2717,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
protected StateHandler[] createStateHandlers() {
return new StateHandler[] { getAllAppsController(), getWorkspace(),
getBackgroundBlurController() };
getDepthController() };
}
public TouchController[] createTouchControllers() {
@@ -2754,8 +2754,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
return Stream.of(APP_INFO, WIDGETS, INSTALL);
}
public BackgroundBlurController getBackgroundBlurController() {
return mBackgroundBlurController;
public DepthController getDepthController() {
return mDepthController;
}
public static Launcher getLauncher(Context context) {
+6 -4
View File
@@ -271,11 +271,13 @@ public abstract class LauncherState {
}
/**
* The amount of blur to apply to the background of either the app or Launcher surface in this
* state.
* The amount of blur and wallpaper zoom to apply to the background of either the app
* or Launcher surface in this state. Should be a number between 0 and 1, inclusive.
*
* 0 means completely zoomed in, without blurs. 1 is zoomed out, with blurs.
*/
public int getBackgroundBlurRadius(Context context) {
return 0;
public float getDepth(Context context) {
return 0f;
}
public String getDescription(Launcher launcher) {
@@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.graphics.IconShape.getShape;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -47,7 +46,6 @@ import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PropertyResetListener;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.util.Themes;
import java.util.List;
@@ -222,14 +220,6 @@ public class FolderAnimationManager {
Animator z = getAnimator(mFolder, View.TRANSLATION_Z, -mFolder.getElevation(), 0);
play(a, z, mIsOpening ? midDuration : 0, midDuration);
BackgroundBlurController blurController = mLauncher.getBackgroundBlurController();
int stateBackgroundBlur = mLauncher.getStateManager().getState()
.getBackgroundBlurRadius(mLauncher);
int folderBackgroundBlurAdjustment = blurController.getFolderBackgroundBlurAdjustment();
play(a, ObjectAnimator.ofInt(blurController, BACKGROUND_BLUR, mIsOpening
? stateBackgroundBlur + folderBackgroundBlurAdjustment
: stateBackgroundBlur));
// Store clip variables
CellLayout cellLayout = mContent.getCurrentCellLayout();
boolean folderClipChildren = mFolder.getClipChildren();