Merge "Remove reliance on surface to update depth" into sc-dev
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index caf52e3..7aae38c 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -27,12 +27,11 @@
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.app.ActivityOptions;
+import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
-import android.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
-import android.os.IBinder;
import android.view.View;
import androidx.annotation.Nullable;
@@ -41,7 +40,6 @@
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.proxy.ProxyActivityStarter;
import com.android.launcher3.proxy.StartActivityParams;
@@ -73,7 +71,6 @@
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
-import java.util.HashMap;
import java.util.List;
import java.util.stream.Stream;
@@ -240,8 +237,9 @@
}
@Override
- public void onDisplayInfoChanged(DisplayController.Info info, int flags) {
- super.onDisplayInfoChanged(info, flags);
+ public void onDisplayInfoChanged(Context context, DisplayController.Info info,
+ int flags) {
+ super.onDisplayInfoChanged(context, info, flags);
if ((flags & CHANGE_SIZE) != 0) {
addTaskbarIfNecessary();
}
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 62ab95a..5b1b59b 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -110,7 +110,7 @@
private static final String TAG = "QuickstepTransition";
private static final boolean ENABLE_SHELL_STARTING_SURFACE =
- SystemProperties.getBoolean("persist.debug.shell_starting_surface", false);
+ SystemProperties.getBoolean("persist.debug.shell_starting_surface", true);
/** Duration of status bar animations. */
public static final int STATUS_BAR_TRANSITION_DURATION = 120;
diff --git a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
index b4aa596..5ba1fe1 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
@@ -15,12 +15,11 @@
*/
package com.android.launcher3.uioverrides;
-import static com.android.launcher3.graphics.IconShape.getShape;
-
import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
@@ -37,6 +36,7 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.graphics.IconPalette;
+import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -58,9 +58,13 @@
private final DeviceProfile mDeviceProfile;
private final Paint mIconRingPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Path mRingPath = new Path();
- private boolean mIsPinned = false;
- private final int mNormalizedIconRadius;
+ private final int mNormalizedIconSize;
+ private final Path mShapePath;
+ private final Matrix mTmpMatrix = new Matrix();
+
private final BlurMaskFilter mShadowFilter;
+
+ private boolean mIsPinned = false;
private int mPlateColor;
boolean mDrawForDrag = false;
@@ -75,24 +79,18 @@
public PredictedAppIcon(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mDeviceProfile = ActivityContext.lookupContext(context).getDeviceProfile();
- mNormalizedIconRadius = IconNormalizer.getNormalizedCircleSize(getIconSize()) / 2;
+ mNormalizedIconSize = IconNormalizer.getNormalizedCircleSize(getIconSize());
int shadowSize = context.getResources().getDimensionPixelSize(
R.dimen.blur_size_thin_outline);
mShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.OUTER);
+ mShapePath = GraphicsUtils.getShapePath(mNormalizedIconSize);
}
@Override
public void onDraw(Canvas canvas) {
int count = canvas.save();
if (!mIsPinned) {
- boolean isBadged = false;
- if (getTag() instanceof WorkspaceItemInfo) {
- WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
- isBadged = !Process.myUserHandle().equals(info.user)
- || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT
- || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
- }
- drawEffect(canvas, isBadged);
+ drawEffect(canvas);
canvas.translate(getWidth() * RING_EFFECT_RATIO, getHeight() * RING_EFFECT_RATIO);
canvas.scale(1 - 2 * RING_EFFECT_RATIO, 1 - 2 * RING_EFFECT_RATIO);
}
@@ -161,33 +159,58 @@
}
private int getOutlineOffsetX() {
- return (getMeasuredWidth() / 2) - mNormalizedIconRadius;
+ return (getMeasuredWidth() - mNormalizedIconSize) / 2;
}
private int getOutlineOffsetY() {
if (mDisplay != DISPLAY_TASKBAR) {
return getPaddingTop() + mDeviceProfile.folderIconOffsetYPx;
}
- return (getMeasuredHeight() / 2) - mNormalizedIconRadius;
+ return (getMeasuredHeight() - mNormalizedIconSize) / 2;
}
- private void drawEffect(Canvas canvas, boolean isBadged) {
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ updateRingPath();
+ }
+
+ @Override
+ public void setTag(Object tag) {
+ super.setTag(tag);
+ updateRingPath();
+ }
+
+ private void updateRingPath() {
+ boolean isBadged = false;
+ if (getTag() instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
+ isBadged = !Process.myUserHandle().equals(info.user)
+ || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT
+ || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
+ }
+
+ mRingPath.reset();
+ mTmpMatrix.setTranslate(getOutlineOffsetX(), getOutlineOffsetY());
+
+ mRingPath.addPath(mShapePath, mTmpMatrix);
+ if (isBadged) {
+ float outlineSize = mNormalizedIconSize * RING_EFFECT_RATIO;
+ float iconSize = getIconSize() * (1 - 2 * RING_EFFECT_RATIO);
+ float badgeSize = LauncherIcons.getBadgeSizeForIconSize((int) iconSize) + outlineSize;
+ float scale = badgeSize / mNormalizedIconSize;
+ mTmpMatrix.postTranslate(mNormalizedIconSize, mNormalizedIconSize);
+ mTmpMatrix.preScale(scale, scale);
+ mTmpMatrix.preTranslate(-mNormalizedIconSize, -mNormalizedIconSize);
+ mRingPath.addPath(mShapePath, mTmpMatrix);
+ }
+ }
+
+ private void drawEffect(Canvas canvas) {
// Don't draw ring effect if item is about to be dragged.
if (mDrawForDrag) {
return;
}
- mRingPath.reset();
- getShape().addToPath(mRingPath, getOutlineOffsetX(), getOutlineOffsetY(),
- mNormalizedIconRadius);
- if (isBadged) {
- float outlineSize = mNormalizedIconRadius * RING_EFFECT_RATIO * 2;
- float iconSize = getIconSize() * (1 - 2 * RING_EFFECT_RATIO);
- float badgeSize = LauncherIcons.getBadgeSizeForIconSize((int) iconSize) + outlineSize;
- float badgeInset = mNormalizedIconRadius * 2 - badgeSize;
- getShape().addToPath(mRingPath, getOutlineOffsetX() + badgeInset,
- getOutlineOffsetY() + badgeInset, badgeSize / 2);
-
- }
mIconRingPaint.setColor(RING_SHADOW_COLOR);
mIconRingPaint.setMaskFilter(mShadowFilter);
canvas.drawPath(mRingPath, mIconRingPaint);
@@ -249,8 +272,10 @@
*/
@Override
public void drawUnderItem(Canvas canvas) {
- getShape().drawShape(canvas, mIcon.getOutlineOffsetX(), mIcon.getOutlineOffsetY(),
- mIcon.mNormalizedIconRadius, mOutlinePaint);
+ canvas.save();
+ canvas.translate(mIcon.getOutlineOffsetX(), mIcon.getOutlineOffsetY());
+ canvas.drawPath(mIcon.mShapePath, mOutlinePaint);
+ canvas.restore();
}
/**
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 6cf12a3..b4f1330 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -241,7 +241,7 @@
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
mDisplayController.removeChangeListener(this);
mDisplayController.addChangeListener(this);
- onDisplayInfoChanged(mDisplayController.getInfo(), CHANGE_ALL);
+ onDisplayInfoChanged(mContext, mDisplayController.getInfo(), CHANGE_ALL);
if (newMode == NO_BUTTON) {
mExclusionListener.register();
@@ -254,7 +254,7 @@
}
@Override
- public void onDisplayInfoChanged(Info info, int flags) {
+ public void onDisplayInfoChanged(Context context, Info info, int flags) {
if (info.id != getDisplayId() || flags == CHANGE_FRAME_DELAY) {
// ignore displays that aren't running launcher and frame refresh rate changes
return;
diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
index d4ad176..f4688a1 100644
--- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java
+++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
@@ -225,7 +225,7 @@
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
mDisplayController.removeChangeListener(this);
mDisplayController.addChangeListener(this);
- onDisplayInfoChanged(mDisplayController.getInfo(), CHANGE_ALL);
+ onDisplayInfoChanged(mContext, mDisplayController.getInfo(), CHANGE_ALL);
mOrientationTouchTransformer.setNavigationMode(newMode, mDisplayController.getInfo(),
mContext.getResources());
@@ -243,7 +243,7 @@
}
@Override
- public void onDisplayInfoChanged(Info info, int flags) {
+ public void onDisplayInfoChanged(Context context, Info info, int flags) {
if (info.id != mDisplayId|| flags == CHANGE_FRAME_DELAY) {
// ignore displays that aren't running launcher and frame refresh rate changes
return;
diff --git a/res/color-night-v31/widgets_picker_surface.xml b/res/color-night-v31/widgets_picker_surface.xml
new file mode 100644
index 0000000..fbc9e43
--- /dev/null
+++ b/res/color-night-v31/widgets_picker_surface.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2021, 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.
+*/
+-->
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_800" />
+</selector>
diff --git a/res/color-v31/widgets_picker_surface.xml b/res/color-v31/widgets_picker_surface.xml
new file mode 100644
index 0000000..30f3032
--- /dev/null
+++ b/res/color-v31/widgets_picker_surface.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2021, 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.
+*/
+-->
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="98"/>
+</selector>
diff --git a/res/color/widgets_picker_surface.xml b/res/color/widgets_picker_surface.xml
new file mode 100644
index 0000000..6150110
--- /dev/null
+++ b/res/color/widgets_picker_surface.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2021, 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.
+*/
+-->
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?android:attr/colorBackgroundFloating" />
+</selector>
diff --git a/res/drawable/widgets_list_bottom_ripple.xml b/res/drawable/widgets_list_bottom_ripple.xml
index 3a26091..72262d4 100644
--- a/res/drawable/widgets_list_bottom_ripple.xml
+++ b/res/drawable/widgets_list_bottom_ripple.xml
@@ -30,7 +30,7 @@
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle">
- <solid android:color="?android:attr/colorBackground" />
+ <solid android:color="@color/widgets_picker_surface" />
<corners
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
android:topRightRadius="@dimen/widget_list_content_corner_radius"
diff --git a/res/drawable/widgets_list_middle_ripple.xml b/res/drawable/widgets_list_middle_ripple.xml
index da025d7..1136bea 100644
--- a/res/drawable/widgets_list_middle_ripple.xml
+++ b/res/drawable/widgets_list_middle_ripple.xml
@@ -31,7 +31,7 @@
<item android:id="@android:id/background">
<shape android:shape="rectangle">
- <solid android:color="?android:attr/colorBackground" />
+ <solid android:color="@color/widgets_picker_surface" />
<corners
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
android:topRightRadius="@dimen/widget_list_content_corner_radius"
diff --git a/res/drawable/widgets_list_single_item_ripple.xml b/res/drawable/widgets_list_single_item_ripple.xml
index b8b6f42..a82918e 100644
--- a/res/drawable/widgets_list_single_item_ripple.xml
+++ b/res/drawable/widgets_list_single_item_ripple.xml
@@ -30,7 +30,7 @@
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle">
- <solid android:color="?android:attr/colorBackground" />
+ <solid android:color="@color/widgets_picker_surface" />
<corners
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
diff --git a/res/drawable/widgets_list_top_ripple.xml b/res/drawable/widgets_list_top_ripple.xml
index 6efc3e1..4ad185c 100644
--- a/res/drawable/widgets_list_top_ripple.xml
+++ b/res/drawable/widgets_list_top_ripple.xml
@@ -31,7 +31,7 @@
<item android:id="@android:id/background">
<shape android:shape="rectangle">
- <solid android:color="?android:attr/colorBackground" />
+ <solid android:color="@color/widgets_picker_surface" />
<corners
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
diff --git a/res/drawable/widgets_recommendation_background.xml b/res/drawable/widgets_recommendation_background.xml
new file mode 100644
index 0000000..b59de27
--- /dev/null
+++ b/res/drawable/widgets_recommendation_background.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2021, 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.
+*/
+-->
+<shape android:shape="rectangle"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/widgets_picker_surface" />
+ <corners android:radius="@dimen/widget_list_top_bottom_corner_radius"/>
+</shape>
\ No newline at end of file
diff --git a/res/layout/widgets_full_sheet.xml b/res/layout/widgets_full_sheet.xml
index 172284b..a01aa2c 100644
--- a/res/layout/widgets_full_sheet.xml
+++ b/res/layout/widgets_full_sheet.xml
@@ -25,7 +25,7 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?android:attr/colorBackgroundFloating"
+ android:background="?android:attr/colorBackground"
android:elevation="4dp">
<TextView
diff --git a/res/layout/widgets_full_sheet_search_and_recommendations.xml b/res/layout/widgets_full_sheet_search_and_recommendations.xml
index e5df175..e322c6c 100644
--- a/res/layout/widgets_full_sheet_search_and_recommendations.xml
+++ b/res/layout/widgets_full_sheet_search_and_recommendations.xml
@@ -20,7 +20,8 @@
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:layout_marginBottom="16dp"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:clipToPadding="false">
<View
android:id="@+id/collapse_handle"
android:layout_width="48dp"
@@ -44,6 +45,8 @@
android:id="@+id/recommended_widget_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="@drawable/widgets_recommendation_background"
+ android:paddingVertical="8dp"
android:layout_marginTop="16dp"
- android:visibility="gone" />
+ android:visibility="gone"/>
</LinearLayout>
diff --git a/res/layout/widgets_list_row_header.xml b/res/layout/widgets_list_row_header.xml
index 8259c16..f4b4130 100644
--- a/res/layout/widgets_list_row_header.xml
+++ b/res/layout/widgets_list_row_header.xml
@@ -19,7 +19,7 @@
android:id="@+id/widgets_list_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="8dp"
+ android:layout_marginHorizontal="16dp"
android:background="@drawable/widgets_list_middle_ripple"
android:layout_marginBottom="@dimen/widget_list_entry_bottom_margin"
android:paddingVertical="@dimen/widget_list_header_view_vertical_padding"
diff --git a/res/layout/widgets_table_container.xml b/res/layout/widgets_table_container.xml
index 0b5f0b9..e63483d 100644
--- a/res/layout/widgets_table_container.xml
+++ b/res/layout/widgets_table_container.xml
@@ -18,6 +18,6 @@
android:id="@+id/widgets_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="8dp"
+ android:layout_marginHorizontal="16dp"
android:background="@drawable/widgets_list_middle_ripple"
android:layout_marginBottom="@dimen/widget_list_entry_bottom_margin"/>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index 2e17d44..24aabc5 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -130,7 +130,7 @@
<string name="action_add_to_workspace" msgid="8902165848117513641">"Добавить на главный экран"</string>
<string name="action_move_here" msgid="2170188780612570250">"Переместить элемент сюда"</string>
<string name="item_added_to_workspace" msgid="4211073925752213539">"Элемент добавлен на главный экран"</string>
- <string name="item_removed" msgid="851119963877842327">"Элемент удален"</string>
+ <string name="item_removed" msgid="851119963877842327">"Элемент удален."</string>
<string name="undo" msgid="4151576204245173321">"Отменить"</string>
<string name="action_move" msgid="4339390619886385032">"Переместить элемент"</string>
<string name="move_to_empty_cell" msgid="2833711483015685619">"Переместить в ячейку <xliff:g id="NUMBER_0">%1$s</xliff:g> <xliff:g id="NUMBER_1">%2$s</xliff:g>"</string>
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index 24aac10..87afd6b 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -17,9 +17,11 @@
*/
-->
<resources>
+ <color name="popup_color_neutral_light">@android:color/system_neutral1_0</color>
<color name="popup_color_primary_light">@android:color/system_neutral1_50</color>
<color name="popup_color_secondary_light">@android:color/system_neutral2_100</color>
<color name="popup_color_tertiary_light">@android:color/system_neutral2_300</color>
+ <color name="popup_color_neutral_dark">@android:color/system_neutral1_1000</color>
<color name="popup_color_primary_dark">@android:color/system_neutral1_800</color>
<color name="popup_color_secondary_dark">@android:color/system_neutral1_900</color>
<color name="popup_color_tertiary_dark">@android:color/system_neutral2_700</color>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index dbb40d5..7fe53d5 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -22,6 +22,7 @@
<attr name="allAppsInterimScrimAlpha" format="integer" />
<attr name="allAppsNavBarScrimColor" format="color" />
<attr name="allAppsTheme" format="reference" />
+ <attr name="popupColorNeutral" format="color" />
<attr name="popupColorPrimary" format="color" />
<attr name="popupColorSecondary" format="color" />
<attr name="popupColorTertiary" format="color" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 7d48adf..8a2cada 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -41,9 +41,11 @@
<color name="gesture_tutorial_action_button_label_color">#FF000000</color>
<color name="gesture_tutorial_primary_color">#B7F29F</color> <!-- Light Green -->
+ <color name="popup_color_neutral_light">#FFF</color>
<color name="popup_color_primary_light">#FFF</color>
<color name="popup_color_secondary_light">#F1F3F4</color>
<color name="popup_color_tertiary_light">#E0E0E0</color> <!-- Gray 300 -->
+ <color name="popup_color_neutral_dark">#3C4043</color> <!-- Gray 800 -->
<color name="popup_color_primary_dark">#3C4043</color> <!-- Gray 800 -->
<color name="popup_color_secondary_dark">#202124</color>
<color name="popup_color_tertiary_dark">#757575</color> <!-- Gray 600 -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 37b7e2d..bae1485 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -35,6 +35,7 @@
<item name="allAppsInterimScrimAlpha">46</item>
<item name="allAppsNavBarScrimColor">#66FFFFFF</item>
<item name="allAppsTheme">@style/AllAppsTheme</item>
+ <item name="popupColorNeutral">@color/popup_color_neutral_light</item>
<item name="popupColorPrimary">@color/popup_color_primary_light</item>
<item name="popupColorSecondary">@color/popup_color_secondary_light</item>
<item name="popupColorTertiary">@color/popup_color_tertiary_light</item>
@@ -99,6 +100,7 @@
<item name="allAppsInterimScrimAlpha">102</item>
<item name="allAppsNavBarScrimColor">#80000000</item>
<item name="allAppsTheme">@style/AllAppsTheme.Dark</item>
+ <item name="popupColorNeutral">@color/popup_color_neutral_dark</item>
<item name="popupColorPrimary">@color/popup_color_primary_dark</item>
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index cc9f594..4c5f9f2 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -21,6 +21,7 @@
import android.app.ActivityOptions;
import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.Intent;
import android.content.pm.LauncherApps;
import android.content.res.Configuration;
@@ -296,7 +297,7 @@
}
@Override
- public void onDisplayInfoChanged(Info info, int flags) {
+ public void onDisplayInfoChanged(Context context, Info info, int flags) {
if ((flags & CHANGE_ROTATION) != 0 && mDeviceProfile.updateIsSeascape(this)) {
reapplyUi();
}
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index d333b49..2ace796 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -16,7 +16,6 @@
package com.android.launcher3;
-import static com.android.launcher3.graphics.IconShape.getShape;
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
@@ -26,16 +25,13 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
-import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.os.Process;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.util.Property;
@@ -50,7 +46,6 @@
import androidx.annotation.UiThread;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.folder.FolderIcon;
@@ -60,7 +55,6 @@
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.icons.PlaceHolderIconDrawable;
import com.android.launcher3.icons.cache.HandlerRunnable;
import com.android.launcher3.model.data.AppInfo;
@@ -97,11 +91,6 @@
private float mScaleForReorderBounce = 1f;
- protected final Paint mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- private final Path mHighlightPath = new Path();
- protected int mHighlightColor = Color.TRANSPARENT;
- private final BlurMaskFilter mHighlightShadowFilter;
-
private static final Property<BubbleTextView, Float> DOT_SCALE_PROPERTY
= new Property<BubbleTextView, Float>(Float.TYPE, "dotScale") {
@Override
@@ -220,10 +209,6 @@
setEllipsize(TruncateAt.END);
setAccessibilityDelegate(mActivity.getAccessibilityDelegate());
setTextAlpha(1f);
-
- int shadowSize = context.getResources().getDimensionPixelSize(
- R.dimen.blur_size_click_shadow);
- mHighlightShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.INNER);
}
@Override
@@ -451,41 +436,10 @@
@Override
public void onDraw(Canvas canvas) {
- if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mHighlightColor != Color.TRANSPARENT) {
- int count = canvas.save();
- drawFocusHighlight(canvas);
- canvas.restoreToCount(count);
- }
super.onDraw(canvas);
drawDotIfNecessary(canvas);
}
- protected void drawFocusHighlight(Canvas canvas) {
- boolean isBadged = getTag() instanceof ItemInfo && !Process.myUserHandle().equals(
- ((ItemInfo) getTag()).user);
- float insetScale = (HIGHLIGHT_SCALE - 1) / 2;
- canvas.translate(-getIconSize() * insetScale, -insetScale * getIconSize());
- float outlineSize = getIconSize() * HIGHLIGHT_SCALE;
- mHighlightPath.reset();
- mHighlightPaint.reset();
- getIconBounds(mDotParams.iconBounds);
- getShape().addToPath(mHighlightPath, mDotParams.iconBounds.left, mDotParams.iconBounds.top,
- outlineSize / 2);
- if (isBadged) {
- float borderSize = outlineSize - getIconSize();
- float badgeSize = LauncherIcons.getBadgeSizeForIconSize(getIconSize()) + borderSize;
- float badgeInset = outlineSize - badgeSize;
- getShape().addToPath(mHighlightPath, mDotParams.iconBounds.left + badgeInset,
- mDotParams.iconBounds.top + badgeInset, badgeSize / 2);
- }
- mHighlightPaint.setMaskFilter(mHighlightShadowFilter);
- mHighlightPaint.setColor(mDotParams.color);
- canvas.drawPath(mHighlightPath, mHighlightPaint);
- mHighlightPaint.setMaskFilter(null);
- mHighlightPaint.setColor(mHighlightColor);
- canvas.drawPath(mHighlightPath, mHighlightPaint);
- }
-
/**
* Draws the notification dot in the top right corner of the icon bounds.
*
@@ -921,11 +875,9 @@
@Override
public SafeCloseable prepareDrawDragView() {
- int highlightColor = mHighlightColor;
- mHighlightColor = Color.TRANSPARENT;
resetIconScale();
setForceHideDot(true);
- return () -> mHighlightColor = highlightColor;
+ return () -> { };
}
private void resetIconScale() {
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index a6fc0f3..fd97936 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
@@ -38,8 +39,8 @@
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.DotRenderer;
+import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.DisplayController;
@@ -54,6 +55,7 @@
private static final float TABLET_MIN_DPS = 600;
private static final float LARGE_TABLET_MIN_DPS = 720;
+ private static final int DEFAULT_DOT_SIZE = 100;
public final InvariantDeviceProfile inv;
private final Info mInfo;
@@ -366,11 +368,10 @@
updateWorkspacePadding();
// This is done last, after iconSizePx is calculated above.
- mDotRendererWorkSpace = new DotRenderer(iconSizePx, IconShape.getShapePath(),
- IconShape.DEFAULT_PATH_SIZE);
+ Path dotPath = GraphicsUtils.getShapePath(DEFAULT_DOT_SIZE);
+ mDotRendererWorkSpace = new DotRenderer(iconSizePx, dotPath, DEFAULT_DOT_SIZE);
mDotRendererAllApps = iconSizePx == allAppsIconSizePx ? mDotRendererWorkSpace :
- new DotRenderer(allAppsIconSizePx, IconShape.getShapePath(),
- IconShape.DEFAULT_PATH_SIZE);
+ new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE);
}
private void setCellLayoutBorderSpacing(int borderSpacing) {
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 11dc0c4..1332e14 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -203,9 +203,9 @@
.apply();
DisplayController.INSTANCE.get(context).addChangeListener(
- (info, flags) -> {
+ (displayContext, info, flags) -> {
if ((flags & (CHANGE_SIZE | CHANGE_DENSITY)) != 0) {
- onConfigChanged(context);
+ onConfigChanged(displayContext);
}
});
mOverlayMonitor = new OverlayMonitor(context);
@@ -226,7 +226,7 @@
*/
public InvariantDeviceProfile(Context context, Display display) {
// Ensure that the main device profile is initialized
- InvariantDeviceProfile originalProfile = INSTANCE.get(context);
+ INSTANCE.get(context);
String gridName = getCurrentGridName(context);
// Get the display info based on default display and interpolate it to existing display
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a54c791..36d3625 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1197,7 +1197,7 @@
// Setup the drag controller (drop targets have to be added in reverse order in priority)
mDropTargetBar.setup(mDragController);
- mAllAppsController.setupViews(mAppsView);
+ mAllAppsController.setupViews(mAppsView, mScrimView);
}
/**
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index ed854dc..41962a4 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -36,7 +36,6 @@
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM;
@@ -165,10 +164,6 @@
SysUiScrim sysUiScrim = mLauncher.getDragLayer().getSysUiScrim();
propertySetter.setFloat(sysUiScrim, SYSUI_PROGRESS,
state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
-
- propertySetter.setViewAlpha(mLauncher.getScrimView(),
- state.getWorkspaceScrimAlpha(mLauncher),
- config.getInterpolator(ANIM_WORKSPACE_SCRIM_FADE, LINEAR));
}
public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index c61c0d6..5c1bffb 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -43,6 +43,7 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
+import com.android.launcher3.views.ScrimView;
/**
* Handles AllApps view transition.
@@ -70,10 +71,11 @@
controller.setProgress(progress);
}
};
+ private final Launcher mLauncher;
private AllAppsContainerView mAppsView;
+ private ScrimView mScrimView;
- private final Launcher mLauncher;
private boolean mIsVerticalLayout;
// Animation in this class is controlled by a single variable {@link mProgress}.
@@ -121,6 +123,8 @@
*/
public void setProgress(float progress) {
mProgress = progress;
+ //Note: Take inverted progress so progress=0 maps to a transparent scrim
+ mScrimView.setProgress(1 - progress);
mAppsView.setTranslationY(mProgress * mShiftRange);
}
@@ -185,8 +189,12 @@
return AnimationSuccessListener.forRunnable(this::onProgressAnimationEnd);
}
- public void setupViews(AllAppsContainerView appsView) {
+ /**
+ * Setup views
+ */
+ public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
mAppsView = appsView;
+ mScrimView = scrimView;
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && Utilities.ATLEAST_R) {
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
diff --git a/src/com/android/launcher3/graphics/IconShape.java b/src/com/android/launcher3/graphics/IconShape.java
index b208a40..2da679c 100644
--- a/src/com/android/launcher3/graphics/IconShape.java
+++ b/src/com/android/launcher3/graphics/IconShape.java
@@ -37,20 +37,14 @@
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.util.AttributeSet;
-import android.util.SparseArray;
-import android.util.TypedValue;
import android.util.Xml;
import android.view.View;
import android.view.ViewOutlineProvider;
-import androidx.annotation.Nullable;
-
import com.android.launcher3.R;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.IconNormalizer;
-import com.android.launcher3.util.IntArray;
-import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ClipPathView;
import org.xmlpull.v1.XmlPullParser;
@@ -66,30 +60,16 @@
public abstract class IconShape {
private static IconShape sInstance = new Circle();
- private static Path sShapePath;
private static float sNormalizationScale = ICON_VISIBLE_AREA_FACTOR;
- public static final int DEFAULT_PATH_SIZE = 100;
-
public static IconShape getShape() {
return sInstance;
}
- public static Path getShapePath() {
- if (sShapePath == null) {
- Path p = new Path();
- getShape().addToPath(p, 0, 0, DEFAULT_PATH_SIZE * 0.5f);
- sShapePath = p;
- }
- return sShapePath;
- }
-
public static float getNormalizationScale() {
return sNormalizationScale;
}
- private SparseArray<TypedValue> mAttrs;
-
public boolean enableShapeDetection(){
return false;
};
@@ -102,11 +82,6 @@
public abstract <T extends View & ClipPathView> Animator createRevealAnimator(T target,
Rect startRect, Rect endRect, float endRadius, boolean isReversed);
- @Nullable
- public TypedValue getAttrValue(int attr) {
- return mAttrs == null ? null : mAttrs.get(attr);
- }
-
/**
* Abstract shape where the reveal animation is a derivative of a round rect animation
*/
@@ -410,7 +385,6 @@
final int depth = parser.getDepth();
int[] radiusAttr = new int[] {R.attr.folderIconRadius};
- IntArray keysToIgnore = new IntArray(0);
while (((type = parser.next()) != XmlPullParser.END_TAG ||
parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
@@ -421,7 +395,6 @@
IconShape shape = getShapeDefinition(parser.getName(), a.getFloat(0, 1));
a.recycle();
- shape.mAttrs = Themes.createValueMap(context, attrs, keysToIgnore);
result.add(shape);
}
}
@@ -467,8 +440,6 @@
}
// Initialize shape properties
- drawable.setBounds(0, 0, DEFAULT_PATH_SIZE, DEFAULT_PATH_SIZE);
- sShapePath = new Path(drawable.getIconMask());
sNormalizationScale = IconNormalizer.normalizeAdaptiveIcon(drawable, size, null);
}
}
diff --git a/src/com/android/launcher3/graphics/PreloadIconDrawable.java b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
index ac0ec5f..13ae866 100644
--- a/src/com/android/launcher3/graphics/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
@@ -17,9 +17,6 @@
package com.android.launcher3.graphics;
-import static com.android.launcher3.graphics.IconShape.DEFAULT_PATH_SIZE;
-import static com.android.launcher3.graphics.IconShape.getShapePath;
-
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -39,6 +36,7 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.icons.FastBitmapDrawable;
+import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.util.Themes;
@@ -62,6 +60,7 @@
}
};
+ private static final int DEFAULT_PATH_SIZE = 100;
private static final float PROGRESS_WIDTH = 7;
private static final float PROGRESS_GAP = 2;
private static final int MAX_PAINT_ALPHA = 255;
@@ -132,7 +131,7 @@
boolean isDarkMode) {
super(info.bitmap);
mItem = info;
- mShapePath = getShapePath();
+ mShapePath = GraphicsUtils.getShapePath(DEFAULT_PATH_SIZE);
mScaledTrackPath = new Path();
mScaledProgressPath = new Path();
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 3736538..c19dfe9 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -16,6 +16,7 @@
package com.android.launcher3.popup;
+import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS;
@@ -48,12 +49,14 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.LauncherAnimUtils;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.RevealOutlineAnimation;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.shortcuts.DeepShortcutView;
+import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
@@ -65,7 +68,8 @@
*
* @param <T> The activity on with the popup shows
*/
-public abstract class ArrowPopup<T extends BaseDraggingActivity> extends AbstractFloatingView {
+public abstract class ArrowPopup<T extends StatefulActivity<LauncherState>>
+ extends AbstractFloatingView {
// +1 for system shortcut view
private static final int MAX_NUM_CHILDREN = MAX_SHORTCUTS + 1;
@@ -139,14 +143,21 @@
mRoundedBottom.setCornerRadii(new float[] { smallerRadius, smallerRadius, smallerRadius,
smallerRadius, mOutlineRadius, mOutlineRadius, mOutlineRadius, mOutlineRadius});
- int primaryColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
- int secondaryColor = Themes.getAttrColor(context, R.attr.popupColorSecondary);
- ArgbEvaluator argb = new ArgbEvaluator();
- mColors = new int[MAX_NUM_CHILDREN];
- // Interpolate between the two colors, exclusive.
- float step = 1f / (MAX_NUM_CHILDREN + 1);
- for (int i = 0; i < mColors.length; ++i) {
- mColors[i] = (int) argb.evaluate((i + 1) * step, primaryColor, secondaryColor);
+ boolean isAboveAnotherSurface = getTopOpenViewWithType(mLauncher, TYPE_FOLDER) != null
+ || mLauncher.getStateManager().getState() == LauncherState.ALL_APPS;
+ if (isAboveAnotherSurface) {
+ mColors = new int[] { Themes.getAttrColor(context, R.attr.popupColorNeutral) };
+ } else {
+ int primaryColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
+ int secondaryColor = Themes.getAttrColor(context, R.attr.popupColorSecondary);
+ ArgbEvaluator argb = new ArgbEvaluator();
+ mColors = new int[MAX_NUM_CHILDREN];
+ // Interpolate between the two colors, exclusive.
+ float step = 1f / (MAX_NUM_CHILDREN + 1);
+ for (int i = 0; i < mColors.length; ++i) {
+ mColors[i] =
+ (int) argb.evaluate((i + 1) * step, primaryColor, secondaryColor);
+ }
}
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index c282ae8..1659e6d 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -46,6 +46,7 @@
import com.android.launcher3.DropTarget;
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
@@ -60,10 +61,10 @@
import com.android.launcher3.notification.NotificationInfo;
import com.android.launcher3.notification.NotificationItemView;
import com.android.launcher3.notification.NotificationKeyData;
-import com.android.launcher3.notification.NotificationMainView;
import com.android.launcher3.popup.PopupDataProvider.PopupDataChangeListener;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
+import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.ShortcutUtil;
@@ -81,8 +82,8 @@
*
* @param <T> The activity on with the popup shows
*/
-public class PopupContainerWithArrow<T extends BaseDraggingActivity> extends ArrowPopup<T>
- implements DragSource, DragController.DragListener {
+public class PopupContainerWithArrow<T extends StatefulActivity<LauncherState>>
+ extends ArrowPopup<T> implements DragSource, DragController.DragListener {
private final List<DeepShortcutView> mShortcuts = new ArrayList<>();
private final PointF mInterceptTouchDown = new PointF();
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 07c89b9..75c089e 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -87,7 +87,7 @@
new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
}
- mInfo = createInfo(display);
+ mInfo = new Info(getContext(display), display);
mDM.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
}
@@ -125,7 +125,13 @@
*/
public interface DisplayInfoChangeListener {
- void onDisplayInfoChanged(Info info, int flags);
+ /**
+ * Invoked when display info has changed.
+ * @param context updated context associated with the display.
+ * @param info updated display information.
+ * @param flags bitmask indicating type of change.
+ */
+ void onDisplayInfoChanged(Context context, Info info, int flags);
}
/**
@@ -172,14 +178,15 @@
return mInfo;
}
- private Info createInfo(Display display) {
- return new Info(mContext.createDisplayContext(display), display);
+ private Context getContext(Display display) {
+ return Utilities.ATLEAST_S ? mWindowContext : mContext.createDisplayContext(display);
}
@AnyThread
private void handleInfoChange(Display display) {
Info oldInfo = mInfo;
- Info newInfo = createInfo(display);
+ Context context = getContext(display);
+ Info newInfo = new Info(context, display);
int change = 0;
if (newInfo.hasDifferentSize(oldInfo)) {
change |= CHANGE_SIZE;
@@ -197,13 +204,13 @@
if (change != 0) {
mInfo = newInfo;
final int flags = change;
- MAIN_EXECUTOR.execute(() -> notifyChange(flags));
+ MAIN_EXECUTOR.execute(() -> notifyChange(context, flags));
}
}
- private void notifyChange(int flags) {
+ private void notifyChange(Context context, int flags) {
for (int i = mListeners.size() - 1; i >= 0; i--) {
- mListeners.get(i).onDisplayInfoChanged(mInfo, flags);
+ mListeners.get(i).onDisplayInfoChanged(context, mInfo, flags);
}
}
diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java
index c9424de..9b809ae 100644
--- a/src/com/android/launcher3/views/ScrimView.java
+++ b/src/com/android/launcher3/views/ScrimView.java
@@ -15,18 +15,21 @@
*/
package com.android.launcher3.views;
+import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
+import android.view.animation.Interpolator;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
+import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
@@ -36,9 +39,22 @@
public class ScrimView extends View implements Insettable {
private static final float STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD = 0.9f;
+
+ private static final float TINT_DECAY_MULTIPLIER = .5f;
+
+ //min progress for scrim to become visible
+ private static final float SCRIM_VISIBLE_THRESHOLD = .1f;
+ //max progress where scrim alpha animates.
+ private static final float SCRIM_SOLID_THRESHOLD = .5f;
+ private final Interpolator mScrimInterpolator = Interpolators.clampToProgress(ACCEL,
+ SCRIM_VISIBLE_THRESHOLD,
+ SCRIM_SOLID_THRESHOLD);
+
private final boolean mIsScrimDark;
private SystemUiController mSystemUiController;
+ private float mProgress;
+
public ScrimView(Context context, AttributeSet attrs) {
super(context, attrs);
mIsScrimDark = ColorUtils.calculateLuminance(
@@ -47,17 +63,23 @@
}
@Override
- public void setInsets(Rect insets) { }
+ public void setInsets(Rect insets) {
+ }
@Override
public boolean hasOverlappingRendering() {
return false;
}
- @Override
- protected boolean onSetAlpha(int alpha) {
- updateSysUiColors();
- return super.onSetAlpha(alpha);
+ /**
+ * Set progress of scrim animation.
+ * Note: progress should range from 0 for transparent to 1 for solid
+ */
+ public void setProgress(float progress) {
+ if (mProgress != progress) {
+ mProgress = progress;
+ setAlpha(mScrimInterpolator.getInterpolation(progress));
+ }
}
@Override
diff --git a/src/com/android/launcher3/widget/picker/WidgetsDiffReporter.java b/src/com/android/launcher3/widget/picker/WidgetsDiffReporter.java
index 2366609..42896ba 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsDiffReporter.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsDiffReporter.java
@@ -181,8 +181,8 @@
}
if (newRow instanceof WidgetsListSearchHeaderEntry
&& curRow instanceof WidgetsListSearchHeaderEntry) {
- return ((WidgetsListSearchHeaderEntry) newRow).hasEntryUpdated()
- || !curRow.equals(newRow);
+ // Always refresh search header entries to reset rounded corners in their view holder.
+ return true;
}
return false;
}