summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2019-07-31 15:50:44 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-07-31 15:50:44 -0700
commitdd53ba50659b6545bbd5503bcb105632fbe1e740 (patch)
treef6cc66a0b291d2e9f1c22cb56886e575c00a1c87 /src/com
parentee96d7506584b1af2f7e75c4566cc053de0441f9 (diff)
parent70f539cd45f940ffda90f5d56a174376e10e2192 (diff)
downloadandroid_packages_apps_Trebuchet-dd53ba50659b6545bbd5503bcb105632fbe1e740.tar.gz
android_packages_apps_Trebuchet-dd53ba50659b6545bbd5503bcb105632fbe1e740.tar.bz2
android_packages_apps_Trebuchet-dd53ba50659b6545bbd5503bcb105632fbe1e740.zip
Merge changes Ib3e373c2,Ia5d6f545 into ub-launcher3-qt-r1-dev am: 1343f03e2e
am: 70f539cd45 Change-Id: Ifddcba1cd63950424f88ad1d8e01fa9a11f73a2e
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher3/LauncherState.java4
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java12
-rw-r--r--src/com/android/launcher3/allapps/FloatingHeaderRow.java4
-rw-r--r--src/com/android/launcher3/allapps/FloatingHeaderView.java18
-rw-r--r--src/com/android/launcher3/allapps/PluginHeaderRow.java6
-rw-r--r--src/com/android/launcher3/anim/AnimatorSetBuilder.java2
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java33
-rw-r--r--src/com/android/launcher3/graphics/OverviewScrim.java70
-rw-r--r--src/com/android/launcher3/graphics/Scrim.java97
-rw-r--r--src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java74
-rw-r--r--src/com/android/launcher3/touch/AbstractStateChangeTouchController.java1
11 files changed, 239 insertions, 82 deletions
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index dcfd272b4..6e2626b61 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -243,6 +243,10 @@ public class LauncherState {
return 0;
}
+ public float getOverviewScrimAlpha(Launcher launcher) {
+ return 0;
+ }
+
public String getDescription(Launcher launcher) {
return launcher.getWorkspace().getCurrentPageDescription();
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index a64374bc3..5b3beeca7 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -7,6 +7,7 @@ import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.VERTICAL_SWIPE_INDICATOR;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_FADE;
+import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_HEADER_FADE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
@@ -208,13 +209,14 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
PropertySetter setter = config == null ? NO_ANIM_PROPERTY_SETTER
: config.getPropertySetter(builder);
boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0;
- boolean hasContent = (visibleElements & ALL_APPS_CONTENT) != 0;
+ boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0;
Interpolator allAppsFade = builder.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR);
- setter.setViewAlpha(mAppsView.getContentView(), hasContent ? 1 : 0, allAppsFade);
- setter.setViewAlpha(mAppsView.getScrollBar(), hasContent ? 1 : 0, allAppsFade);
- mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasContent, setter,
- allAppsFade);
+ Interpolator headerFade = builder.getInterpolator(ANIM_ALL_APPS_HEADER_FADE, allAppsFade);
+ setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade);
+ setter.setViewAlpha(mAppsView.getScrollBar(), hasAllAppsContent ? 1 : 0, allAppsFade);
+ mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasAllAppsContent,
+ setter, headerFade, allAppsFade);
mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade);
setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA,
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderRow.java b/src/com/android/launcher3/allapps/FloatingHeaderRow.java
index 922e4f1a3..f899587bc 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderRow.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderRow.java
@@ -46,8 +46,8 @@ public interface FloatingHeaderRow {
*/
boolean hasVisibleContent();
- void setContentVisibility(boolean hasHeaderExtra, boolean hasContent,
- PropertySetter setter, Interpolator fadeInterpolator);
+ void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent,
+ PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade);
/**
* Scrolls the content vertically.
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index 66dced99d..42a0eee77 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -27,6 +27,10 @@ import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
@@ -40,10 +44,6 @@ import com.android.systemui.plugins.PluginListener;
import java.util.ArrayList;
import java.util.Map;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.RecyclerView;
-
public class FloatingHeaderView extends LinearLayout implements
ValueAnimator.AnimatorUpdateListener, PluginListener<AllAppsRow>, Insettable,
OnHeightUpdatedListener {
@@ -363,14 +363,14 @@ public class FloatingHeaderView extends LinearLayout implements
p.y = getTop() - mCurrentRV.getTop() - mParent.getTop();
}
- public void setContentVisibility(boolean hasHeader, boolean hasContent, PropertySetter setter,
- Interpolator fadeInterpolator) {
+ public void setContentVisibility(boolean hasHeader, boolean hasAllAppsContent,
+ PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) {
for (FloatingHeaderRow row : mAllRows) {
- row.setContentVisibility(hasHeader, hasContent, setter, fadeInterpolator);
+ row.setContentVisibility(hasHeader, hasAllAppsContent, setter, headerFade, allAppsFade);
}
- allowTouchForwarding(hasContent);
- setter.setFloat(mTabLayout, ALPHA, hasContent ? 1 : 0, fadeInterpolator);
+ allowTouchForwarding(hasAllAppsContent);
+ setter.setFloat(mTabLayout, ALPHA, hasAllAppsContent ? 1 : 0, headerFade);
}
protected void allowTouchForwarding(boolean allow) {
diff --git a/src/com/android/launcher3/allapps/PluginHeaderRow.java b/src/com/android/launcher3/allapps/PluginHeaderRow.java
index b283ff405..535ef54bc 100644
--- a/src/com/android/launcher3/allapps/PluginHeaderRow.java
+++ b/src/com/android/launcher3/allapps/PluginHeaderRow.java
@@ -64,10 +64,10 @@ public class PluginHeaderRow implements FloatingHeaderRow {
}
@Override
- public void setContentVisibility(boolean hasHeaderExtra, boolean hasContent,
- PropertySetter setter, Interpolator fadeInterpolator) {
+ public void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent,
+ PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) {
// Don't use setViewAlpha as we want to control the visibility ourselves.
- setter.setFloat(mView, ALPHA, hasContent ? 1 : 0, fadeInterpolator);
+ setter.setFloat(mView, ALPHA, hasAllAppsContent ? 1 : 0, headerFade);
}
@Override
diff --git a/src/com/android/launcher3/anim/AnimatorSetBuilder.java b/src/com/android/launcher3/anim/AnimatorSetBuilder.java
index 52a896eda..cd30dea9c 100644
--- a/src/com/android/launcher3/anim/AnimatorSetBuilder.java
+++ b/src/com/android/launcher3/anim/AnimatorSetBuilder.java
@@ -39,6 +39,8 @@ public class AnimatorSetBuilder {
public static final int ANIM_OVERVIEW_TRANSLATE_Y = 8;
public static final int ANIM_OVERVIEW_FADE = 9;
public static final int ANIM_ALL_APPS_FADE = 10;
+ public static final int ANIM_OVERVIEW_SCRIM_FADE = 11;
+ public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
public static final int FLAG_DONT_ANIMATE_OVERVIEW = 1 << 0;
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 6ba015b2e..b59164ae0 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -48,12 +48,13 @@ import com.android.launcher3.CellLayout;
import com.android.launcher3.DropTargetBar;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Workspace;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
+import com.android.launcher3.graphics.OverviewScrim;
+import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.graphics.WorkspaceAndHotseatScrim;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.uioverrides.UiFactory;
@@ -92,7 +93,8 @@ public class DragLayer extends BaseDragLayer<Launcher> {
// Related to adjacent page hints
private final ViewGroupFocusHelper mFocusIndicatorHelper;
- private final WorkspaceAndHotseatScrim mScrim;
+ private final WorkspaceAndHotseatScrim mWorkspaceScrim;
+ private final OverviewScrim mOverviewScrim;
/**
* Used to create a new DragLayer from XML.
@@ -108,12 +110,13 @@ public class DragLayer extends BaseDragLayer<Launcher> {
setChildrenDrawingOrderEnabled(true);
mFocusIndicatorHelper = new ViewGroupFocusHelper(this);
- mScrim = new WorkspaceAndHotseatScrim(this);
+ mWorkspaceScrim = new WorkspaceAndHotseatScrim(this);
+ mOverviewScrim = new OverviewScrim(this);
}
public void setup(DragController dragController, Workspace workspace) {
mDragController = dragController;
- mScrim.setWorkspace(workspace);
+ mWorkspaceScrim.setWorkspace(workspace);
recreateControllers();
}
@@ -529,25 +532,39 @@ public class DragLayer extends BaseDragLayer<Launcher> {
@Override
protected void dispatchDraw(Canvas canvas) {
// Draw the background below children.
- mScrim.draw(canvas);
+ mWorkspaceScrim.draw(canvas);
+ mOverviewScrim.updateCurrentScrimmedView(this);
mFocusIndicatorHelper.draw(canvas);
super.dispatchDraw(canvas);
}
@Override
+ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
+ if (child == mOverviewScrim.getScrimmedView()) {
+ mOverviewScrim.draw(canvas);
+ }
+ return super.drawChild(canvas, child, drawingTime);
+ }
+
+ @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
- mScrim.setSize(w, h);
+ mWorkspaceScrim.setSize(w, h);
}
@Override
public void setInsets(Rect insets) {
super.setInsets(insets);
- mScrim.onInsetsChanged(insets);
+ mWorkspaceScrim.onInsetsChanged(insets);
+ mOverviewScrim.onInsetsChanged(insets);
}
public WorkspaceAndHotseatScrim getScrim() {
- return mScrim;
+ return mWorkspaceScrim;
+ }
+
+ public OverviewScrim getOverviewScrim() {
+ return mOverviewScrim;
}
@Override
diff --git a/src/com/android/launcher3/graphics/OverviewScrim.java b/src/com/android/launcher3/graphics/OverviewScrim.java
new file mode 100644
index 000000000..d707403ed
--- /dev/null
+++ b/src/com/android/launcher3/graphics/OverviewScrim.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.graphics;
+
+import static android.view.View.VISIBLE;
+
+import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
+import static com.android.launcher3.LauncherState.OVERVIEW;
+
+import android.graphics.Rect;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+/**
+ * View scrim which draws behind overview (recent apps).
+ */
+public class OverviewScrim extends Scrim {
+
+ private @NonNull View mStableScrimmedView;
+ // Might be higher up if mStableScrimmedView is invisible.
+ private @Nullable View mCurrentScrimmedView;
+
+ public OverviewScrim(View view) {
+ super(view);
+ mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
+
+ onExtractedColorsChanged(mWallpaperColorInfo);
+ }
+
+ public void onInsetsChanged(Rect insets) {
+ mStableScrimmedView = (OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0
+ ? mLauncher.getHotseat()
+ : mLauncher.getOverviewPanel();
+ }
+
+ public void updateCurrentScrimmedView(ViewGroup root) {
+ // Find the lowest view that is at or above the view we want to show the scrim behind.
+ mCurrentScrimmedView = mStableScrimmedView;
+ int currentIndex = root.indexOfChild(mCurrentScrimmedView);
+ final int childCount = root.getChildCount();
+ while (mCurrentScrimmedView.getVisibility() != VISIBLE && currentIndex < childCount) {
+ currentIndex++;
+ mCurrentScrimmedView = root.getChildAt(currentIndex);
+ }
+ }
+
+ /**
+ * @return The view to draw the scrim behind.
+ */
+ public View getScrimmedView() {
+ return mCurrentScrimmedView;
+ }
+}
diff --git a/src/com/android/launcher3/graphics/Scrim.java b/src/com/android/launcher3/graphics/Scrim.java
new file mode 100644
index 000000000..5c14f8d20
--- /dev/null
+++ b/src/com/android/launcher3/graphics/Scrim.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.graphics;
+
+import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
+
+import android.graphics.Canvas;
+import android.util.Property;
+import android.view.View;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.uioverrides.WallpaperColorInfo;
+
+/**
+ * Contains general scrim properties such as wallpaper-extracted color that subclasses can use.
+ */
+public class Scrim implements View.OnAttachStateChangeListener,
+ WallpaperColorInfo.OnChangeListener {
+
+ public static Property<Scrim, Float> SCRIM_PROGRESS =
+ new Property<Scrim, Float>(Float.TYPE, "scrimProgress") {
+ @Override
+ public Float get(Scrim scrim) {
+ return scrim.mScrimProgress;
+ }
+
+ @Override
+ public void set(Scrim scrim, Float value) {
+ scrim.setScrimProgress(value);
+ }
+ };
+
+ protected final Launcher mLauncher;
+ protected final WallpaperColorInfo mWallpaperColorInfo;
+ protected final View mRoot;
+
+ protected float mScrimProgress;
+ protected int mScrimColor;
+ protected int mScrimAlpha = 0;
+
+ public Scrim(View view) {
+ mRoot = view;
+ mLauncher = Launcher.getLauncher(view.getContext());
+ mWallpaperColorInfo = WallpaperColorInfo.getInstance(mLauncher);
+
+ view.addOnAttachStateChangeListener(this);
+ }
+
+ public void draw(Canvas canvas) {
+ canvas.drawColor(setColorAlphaBound(mScrimColor, mScrimAlpha));
+ }
+
+ private void setScrimProgress(float progress) {
+ if (mScrimProgress != progress) {
+ mScrimProgress = progress;
+ mScrimAlpha = Math.round(255 * mScrimProgress);
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onViewAttachedToWindow(View view) {
+ mWallpaperColorInfo.addOnChangeListener(this);
+ onExtractedColorsChanged(mWallpaperColorInfo);
+ }
+
+ @Override
+ public void onViewDetachedFromWindow(View view) {
+ mWallpaperColorInfo.removeOnChangeListener(this);
+ }
+
+ @Override
+ public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) {
+ mScrimColor = wallpaperColorInfo.getMainColor();
+ if (mScrimAlpha > 0) {
+ invalidate();
+ }
+ }
+
+ public void invalidate() {
+ mRoot.invalidate();
+ }
+}
diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
index c0aa75f28..6740fa16e 100644
--- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
+++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
@@ -40,34 +40,19 @@ import android.util.DisplayMetrics;
import android.util.Property;
import android.view.View;
+import androidx.core.graphics.ColorUtils;
+
import com.android.launcher3.CellLayout;
-import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.ResourceUtils;
import com.android.launcher3.Workspace;
import com.android.launcher3.uioverrides.WallpaperColorInfo;
import com.android.launcher3.util.Themes;
-import androidx.core.graphics.ColorUtils;
-
/**
* View scrim which draws behind hotseat and workspace
*/
-public class WorkspaceAndHotseatScrim implements
- View.OnAttachStateChangeListener, WallpaperColorInfo.OnChangeListener {
-
- public static Property<WorkspaceAndHotseatScrim, Float> SCRIM_PROGRESS =
- new Property<WorkspaceAndHotseatScrim, Float>(Float.TYPE, "scrimProgress") {
- @Override
- public Float get(WorkspaceAndHotseatScrim scrim) {
- return scrim.mScrimProgress;
- }
-
- @Override
- public void set(WorkspaceAndHotseatScrim scrim, Float value) {
- scrim.setScrimProgress(value);
- }
- };
+public class WorkspaceAndHotseatScrim extends Scrim {
public static Property<WorkspaceAndHotseatScrim, Float> SYSUI_PROGRESS =
new Property<WorkspaceAndHotseatScrim, Float>(Float.TYPE, "sysUiProgress") {
@@ -117,9 +102,6 @@ public class WorkspaceAndHotseatScrim implements
private static final int ALPHA_MASK_WIDTH_DP = 2;
private final Rect mHighlightRect = new Rect();
- private final Launcher mLauncher;
- private final WallpaperColorInfo mWallpaperColorInfo;
- private final View mRoot;
private Workspace mWorkspace;
@@ -132,11 +114,6 @@ public class WorkspaceAndHotseatScrim implements
private final Drawable mTopScrim;
- private int mFullScrimColor;
-
- private float mScrimProgress;
- private int mScrimAlpha = 0;
-
private float mSysUiProgress = 1;
private boolean mHideSysUiScrim;
@@ -144,9 +121,7 @@ public class WorkspaceAndHotseatScrim implements
private float mSysUiAnimMultiplier = 1;
public WorkspaceAndHotseatScrim(View view) {
- mRoot = view;
- mLauncher = Launcher.getLauncher(view.getContext());
- mWallpaperColorInfo = WallpaperColorInfo.getInstance(mLauncher);
+ super(view);
mMaskHeight = ResourceUtils.pxFromDp(ALPHA_MASK_BITMAP_DP,
view.getResources().getDisplayMetrics());
@@ -154,7 +129,6 @@ public class WorkspaceAndHotseatScrim implements
mBottomMask = mTopScrim == null ? null : createDitheredAlphaMask();
mHideSysUiScrim = mTopScrim == null;
- view.addOnAttachStateChangeListener(this);
onExtractedColorsChanged(mWallpaperColorInfo);
}
@@ -176,7 +150,7 @@ public class WorkspaceAndHotseatScrim implements
canvas.clipRect(mHighlightRect, Region.Op.DIFFERENCE);
}
- canvas.drawColor(setColorAlphaBound(mFullScrimColor, mScrimAlpha));
+ super.draw(canvas);
canvas.restore();
}
@@ -190,11 +164,8 @@ public class WorkspaceAndHotseatScrim implements
mSysUiAnimMultiplier = 0;
reapplySysUiAlphaNoInvalidate();
- ObjectAnimator anim = ObjectAnimator.ofFloat(this, SYSUI_ANIM_MULTIPLIER, 1);
- anim.setAutoCancel(true);
- anim.setDuration(600);
- anim.setStartDelay(mLauncher.getWindow().getTransitionBackgroundFadeDuration());
- anim.start();
+ animateToSysuiMultiplier(1, 600,
+ mLauncher.getWindow().getTransitionBackgroundFadeDuration());
mAnimateScrimOnNextDraw = false;
}
@@ -207,24 +178,24 @@ public class WorkspaceAndHotseatScrim implements
}
}
+ public void animateToSysuiMultiplier(float toMultiplier, long duration,
+ long startDelay) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(this, SYSUI_ANIM_MULTIPLIER, toMultiplier);
+ anim.setAutoCancel(true);
+ anim.setDuration(duration);
+ anim.setStartDelay(startDelay);
+ anim.start();
+ }
+
public void onInsetsChanged(Rect insets) {
mDrawTopScrim = mTopScrim != null && insets.top > 0;
mDrawBottomScrim = mBottomMask != null &&
!mLauncher.getDeviceProfile().isVerticalBarLayout();
}
- private void setScrimProgress(float progress) {
- if (mScrimProgress != progress) {
- mScrimProgress = progress;
- mScrimAlpha = Math.round(255 * mScrimProgress);
- invalidate();
- }
- }
-
@Override
public void onViewAttachedToWindow(View view) {
- mWallpaperColorInfo.addOnChangeListener(this);
- onExtractedColorsChanged(mWallpaperColorInfo);
+ super.onViewAttachedToWindow(view);
if (mTopScrim != null) {
IntentFilter filter = new IntentFilter(ACTION_SCREEN_OFF);
@@ -235,7 +206,7 @@ public class WorkspaceAndHotseatScrim implements
@Override
public void onViewDetachedFromWindow(View view) {
- mWallpaperColorInfo.removeOnChangeListener(this);
+ super.onViewDetachedFromWindow(view);
if (mTopScrim != null) {
mRoot.getContext().unregisterReceiver(mReceiver);
}
@@ -248,10 +219,7 @@ public class WorkspaceAndHotseatScrim implements
mBottomMaskPaint.setColor(ColorUtils.compositeColors(DARK_SCRIM_COLOR,
wallpaperColorInfo.getMainColor()));
reapplySysUiAlpha();
- mFullScrimColor = wallpaperColorInfo.getMainColor();
- if (mScrimAlpha > 0) {
- invalidate();
- }
+ super.onExtractedColorsChanged(wallpaperColorInfo);
}
public void setSize(int w, int h) {
@@ -291,10 +259,6 @@ public class WorkspaceAndHotseatScrim implements
}
}
- public void invalidate() {
- mRoot.invalidate();
- }
-
public Bitmap createDitheredAlphaMask() {
DisplayMetrics dm = mLauncher.getResources().getDisplayMetrics();
int width = ResourceUtils.pxFromDp(ALPHA_MASK_WIDTH_DP, dm);
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 49f515ad4..054534417 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -518,6 +518,7 @@ public abstract class AbstractStateChangeTouchController
logReachedState(logAction, targetState);
}
mLauncher.getStateManager().goToState(targetState, false /* animated */);
+ mLauncher.getDragLayer().getScrim().animateToSysuiMultiplier(1, 0, 0);
}
private void logReachedState(int logAction, LauncherState targetState) {