Merge "Forces a back region for sandbox even if gesture nav is disabled." into sc-dev
diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
index 67e9d89..9077675 100644
--- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
+++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
@@ -170,9 +170,9 @@
public void checkPermissions() {
ContentResolver contentResolver = mApplicationContext.getContentResolver();
boolean structureEnabled = Settings.Secure.getInt(contentResolver,
- Settings.Secure.ASSIST_STRUCTURE_ENABLED, 0) != 0;
+ Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0;
boolean screenshotEnabled = Settings.Secure.getInt(contentResolver,
- Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 0) != 0;
+ Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0;
mAssistPermissionsEnabled = structureEnabled && screenshotEnabled;
}
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 1b54211..de9b361 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -783,7 +783,7 @@
final FloatingWidgetView floatingView = FloatingWidgetView.getFloatingWidgetView(mLauncher,
v, widgetBackgroundBounds,
new Size(windowTargetBounds.width(), windowTargetBounds.height()),
- finalWindowRadius);
+ finalWindowRadius, appTargetsAreTranslucent);
final float initialWindowRadius = supportsRoundedCornersOnWindows(mLauncher.getResources())
? floatingView.getInitialCornerRadius() : 0;
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index d04bfe9..bcf6687 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -1047,7 +1047,7 @@
}
protected abstract HomeAnimationFactory createHomeAnimationFactory(
- ArrayList<IBinder> launchCookies, long duration);
+ ArrayList<IBinder> launchCookies, long duration, boolean isTargetTranslucent);
private final TaskStackChangeListener mActivityRestartListener = new TaskStackChangeListener() {
@Override
@@ -1091,7 +1091,9 @@
final ArrayList<IBinder> cookies = runningTaskTarget != null
? runningTaskTarget.taskInfo.launchCookies
: new ArrayList<>();
- HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(cookies, duration);
+ boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent;
+ HomeAnimationFactory homeAnimFactory =
+ createHomeAnimationFactory(cookies, duration, isTranslucent);
mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome()
&& runningTaskTarget != null
&& runningTaskTarget.taskInfo.pictureInPictureParams != null
diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
index 9846ee7..2d81429 100644
--- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -129,7 +129,7 @@
@Override
protected HomeAnimationFactory createHomeAnimationFactory(ArrayList<IBinder> launchCookies,
- long duration) {
+ long duration, boolean isTargetTranslucent) {
mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration);
ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
Intent intent = new Intent(mGestureState.getHomeIntent());
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index 46cd8a2..267227d 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -80,7 +80,7 @@
@Override
protected HomeAnimationFactory createHomeAnimationFactory(ArrayList<IBinder> launchCookies,
- long duration) {
+ long duration, boolean isTargetTranslucent) {
if (mActivity == null) {
mStateCallback.addChangeListener(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
isPresent -> mRecentsView.startHome());
@@ -103,7 +103,8 @@
return new LauncherHomeAnimationFactory();
}
if (workspaceView instanceof LauncherAppWidgetHostView) {
- return createWidgetHomeAnimationFactory((LauncherAppWidgetHostView) workspaceView);
+ return createWidgetHomeAnimationFactory((LauncherAppWidgetHostView) workspaceView,
+ isTargetTranslucent);
}
return createIconHomeAnimationFactory(workspaceView);
}
@@ -235,7 +236,7 @@
}
private HomeAnimationFactory createWidgetHomeAnimationFactory(
- LauncherAppWidgetHostView hostView) {
+ LauncherAppWidgetHostView hostView, boolean isTargetTranslucent) {
RectF backgroundLocation = new RectF();
Rect crop = new Rect();
@@ -243,7 +244,7 @@
Size windowSize = new Size(crop.width(), crop.height());
FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity,
hostView, backgroundLocation, windowSize,
- mTaskViewSimulator.getCurrentCornerRadius());
+ mTaskViewSimulator.getCurrentCornerRadius(), isTargetTranslucent);
return new LauncherHomeAnimationFactory() {
diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
index ed54f10..121e094 100644
--- a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
+++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
@@ -57,6 +57,7 @@
private Runnable mEndRunnable;
private Runnable mFastFinishRunnable;
private Runnable mOnTargetChangeRunnable;
+ private boolean mAppTargetIsTranslucent;
public FloatingWidgetView(Context context) {
this(context, null);
@@ -142,10 +143,12 @@
}
private void init(DragLayer dragLayer, LauncherAppWidgetHostView originalView,
- RectF widgetBackgroundPosition, Size windowSize, float windowCornerRadius) {
+ RectF widgetBackgroundPosition, Size windowSize, float windowCornerRadius,
+ boolean appTargetIsTranslucent) {
mAppWidgetView = originalView;
mAppWidgetView.beginDeferringUpdates();
mBackgroundPosition = widgetBackgroundPosition;
+ mAppTargetIsTranslucent = appTargetIsTranslucent;
mEndRunnable = () -> finish(dragLayer);
mAppWidgetBackgroundView = RoundedCornerEnforcement.findBackground(mAppWidgetView);
@@ -155,11 +158,13 @@
getRelativePosition(mAppWidgetBackgroundView, dragLayer, mBackgroundPosition);
getRelativePosition(mAppWidgetBackgroundView, mAppWidgetView, mBackgroundOffset);
- mBackgroundView.init(mAppWidgetView, mAppWidgetBackgroundView, windowCornerRadius);
- // Layout call before GhostView creation so that the overlaid view isn't clipped
- layout(0, 0, windowSize.getWidth(), windowSize.getHeight());
- mForegroundOverlayView = GhostView.addGhost(mAppWidgetView, this);
- positionViews();
+ if (!mAppTargetIsTranslucent) {
+ mBackgroundView.init(mAppWidgetView, mAppWidgetBackgroundView, windowCornerRadius);
+ // Layout call before GhostView creation so that the overlaid view isn't clipped
+ layout(0, 0, windowSize.getWidth(), windowSize.getHeight());
+ mForegroundOverlayView = GhostView.addGhost(mAppWidgetView, this);
+ positionViews();
+ }
mListenerView.setListener(this::fastFinish);
dragLayer.addView(mListenerView);
@@ -179,7 +184,7 @@
*/
public void update(RectF backgroundPosition, float floatingWidgetAlpha, float foregroundAlpha,
float fallbackBackgroundAlpha, float cornerRadiusProgress) {
- if (isUninitialized()) return;
+ if (isUninitialized() || mAppTargetIsTranslucent) return;
setAlpha(floatingWidgetAlpha);
mBackgroundView.update(cornerRadiusProgress, fallbackBackgroundAlpha);
mAppWidgetView.setAlpha(foregroundAlpha);
@@ -203,13 +208,16 @@
backgroundParams.height = (int) mBackgroundPosition.height();
mBackgroundView.setLayoutParams(backgroundParams);
- sTmpMatrix.reset();
- float foregroundScale = mBackgroundPosition.width() / mAppWidgetBackgroundView.getWidth();
- sTmpMatrix.setTranslate(-mBackgroundOffset.left - mAppWidgetView.getLeft(),
- -mBackgroundOffset.top - mAppWidgetView.getTop());
- sTmpMatrix.postScale(foregroundScale, foregroundScale);
- sTmpMatrix.postTranslate(mBackgroundPosition.left, mBackgroundPosition.top);
- mForegroundOverlayView.setMatrix(sTmpMatrix);
+ if (mForegroundOverlayView != null) {
+ sTmpMatrix.reset();
+ float foregroundScale =
+ mBackgroundPosition.width() / mAppWidgetBackgroundView.getWidth();
+ sTmpMatrix.setTranslate(-mBackgroundOffset.left - mAppWidgetView.getLeft(),
+ -mBackgroundOffset.top - mAppWidgetView.getTop());
+ sTmpMatrix.postScale(foregroundScale, foregroundScale);
+ sTmpMatrix.postTranslate(mBackgroundPosition.left, mBackgroundPosition.top);
+ mForegroundOverlayView.setMatrix(sTmpMatrix);
+ }
}
private void finish(DragLayer dragLayer) {
@@ -254,7 +262,7 @@
*/
public static FloatingWidgetView getFloatingWidgetView(Launcher launcher,
LauncherAppWidgetHostView originalView, RectF widgetBackgroundPosition,
- Size windowSize, float windowCornerRadius) {
+ Size windowSize, float windowCornerRadius, boolean appTargetsAreTranslucent) {
final DragLayer dragLayer = launcher.getDragLayer();
ViewGroup parent = (ViewGroup) dragLayer.getParent();
FloatingWidgetView floatingView =
@@ -262,7 +270,7 @@
floatingView.recycle();
floatingView.init(dragLayer, originalView, widgetBackgroundPosition, windowSize,
- windowCornerRadius);
+ windowCornerRadius, appTargetsAreTranslucent);
parent.addView(floatingView);
return floatingView;
}
diff --git a/res/color/all_apps_tab_text.xml b/res/color/all_apps_tab_text.xml
index 0c9acf9..4ddb277 100644
--- a/res/color/all_apps_tab_text.xml
+++ b/res/color/all_apps_tab_text.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/white" android:state_selected="true"/>
+ <item android:color="?android:attr/textColorPrimaryInverse" android:state_selected="true"/>
<item android:color="?android:attr/textColorTertiary"/>
</selector>
\ No newline at end of file
diff --git a/res/drawable/add_item_dialog_background.xml b/res/drawable/add_item_dialog_background.xml
index 04bde8f..16a0767 100644
--- a/res/drawable/add_item_dialog_background.xml
+++ b/res/drawable/add_item_dialog_background.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
- <solid android:color="?android:attr/colorBackground" />
+ <solid android:color="@color/widgets_picker_surface" />
<corners
android:topLeftRadius="?android:attr/dialogCornerRadius"
android:topRightRadius="?android:attr/dialogCornerRadius" />
diff --git a/res/drawable/deep_shortcuts_text_placeholder.xml b/res/drawable/deep_shortcuts_text_placeholder.xml
index 99da50f..5820d6b 100644
--- a/res/drawable/deep_shortcuts_text_placeholder.xml
+++ b/res/drawable/deep_shortcuts_text_placeholder.xml
@@ -15,7 +15,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="?attr/popupColorSecondary" />
+ <solid android:color="?attr/popupColorPrimary" />
<corners android:radius="8dp" />
<size android:height="16dp" />
</shape>
diff --git a/res/drawable/ic_deepshortcut_placeholder.xml b/res/drawable/ic_deepshortcut_placeholder.xml
index 3fa8506..16e7cf3 100644
--- a/res/drawable/ic_deepshortcut_placeholder.xml
+++ b/res/drawable/ic_deepshortcut_placeholder.xml
@@ -15,6 +15,6 @@
limitations under the License.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="?attr/popupColorSecondary"/>
- <foreground android:drawable="?attr/popupColorSecondary"/>
+ <background android:drawable="?attr/popupColorPrimary"/>
+ <foreground android:drawable="?attr/popupColorPrimary"/>
</adaptive-icon>
diff --git a/res/drawable/single_item_secondary.xml b/res/drawable/single_item_secondary.xml
deleted file mode 100644
index 4edc481..0000000
--- a/res/drawable/single_item_secondary.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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 xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <solid android:color="?attr/popupColorSecondary"/>
- <corners android:radius="@dimen/popup_single_item_radius" />
-</shape>
\ No newline at end of file
diff --git a/res/layout/add_item_confirmation_activity.xml b/res/layout/add_item_confirmation_activity.xml
index 7c2f25b..00d148f 100644
--- a/res/layout/add_item_confirmation_activity.xml
+++ b/res/layout/add_item_confirmation_activity.xml
@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="24dp"
+ android:theme="?attr/widgetsTheme"
android:orientation="vertical">
<TextView
@@ -43,6 +44,8 @@
android:paddingVertical="8dp"
android:text="@string/add_item_request_drag_hint"
android:textSize="14sp"
+ android:textColor="?android:attr/textColorSecondary"
+ android:alpha="0.7"
android:importantForAccessibility="no"/>
<include layout="@layout/widget_cell"
diff --git a/res/layout/all_apps_personal_work_tabs.xml b/res/layout/all_apps_personal_work_tabs.xml
index cefd0ab..750e101 100644
--- a/res/layout/all_apps_personal_work_tabs.xml
+++ b/res/layout/all_apps_personal_work_tabs.xml
@@ -35,7 +35,7 @@
android:background="?android:attr/selectableItemBackground"
android:text="@string/all_apps_personal_tab"
android:textColor="@color/all_apps_tab_text"
- android:textSize="14sp" />
+ android:textSize="16sp" />
<Button
android:id="@+id/tab_work"
@@ -45,5 +45,5 @@
android:background="?android:attr/selectableItemBackground"
android:text="@string/all_apps_work_tab"
android:textColor="@color/all_apps_tab_text"
- android:textSize="14sp" />
+ android:textSize="16sp" />
</com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
\ No newline at end of file
diff --git a/res/layout/deep_shortcut.xml b/res/layout/deep_shortcut.xml
index 0d11b50..b175d17 100644
--- a/res/layout/deep_shortcut.xml
+++ b/res/layout/deep_shortcut.xml
@@ -19,6 +19,7 @@
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/bg_popup_item_width"
android:layout_height="@dimen/bg_popup_item_height"
+ android:elevation="@dimen/deep_shortcuts_elevation"
android:background="@drawable/middle_item_primary"
android:theme="@style/PopupItem" >
diff --git a/res/layout/longpress_options_menu.xml b/res/layout/longpress_options_menu.xml
index 3898365..d2f7a66 100644
--- a/res/layout/longpress_options_menu.xml
+++ b/res/layout/longpress_options_menu.xml
@@ -20,6 +20,5 @@
android:layout_height="wrap_content"
android:clipToPadding="false"
android:clipChildren="false"
- android:elevation="@dimen/deep_shortcuts_elevation"
android:importantForAccessibility="yes"
android:orientation="vertical" />
diff --git a/res/layout/popup_container.xml b/res/layout/popup_container.xml
index 04822fd..7c78e44 100644
--- a/res/layout/popup_container.xml
+++ b/res/layout/popup_container.xml
@@ -21,7 +21,6 @@
android:layout_height="wrap_content"
android:clipToPadding="false"
android:clipChildren="false"
- android:elevation="@dimen/deep_shortcuts_elevation"
android:orientation="vertical">
<LinearLayout
android:id="@+id/notification_container"
@@ -29,5 +28,6 @@
android:layout_height="wrap_content"
android:visibility="gone"
android:background="?attr/popupColorPrimary"
+ android:elevation="@dimen/deep_shortcuts_elevation"
android:orientation="vertical"/>
</com.android.launcher3.popup.PopupContainerWithArrow>
\ No newline at end of file
diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml
index 9f45f30..6337fae 100644
--- a/res/layout/system_shortcut.xml
+++ b/res/layout/system_shortcut.xml
@@ -19,6 +19,7 @@
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/bg_popup_item_width"
android:layout_height="@dimen/bg_popup_item_height"
+ android:elevation="@dimen/deep_shortcuts_elevation"
android:background="@drawable/middle_item_primary"
android:theme="@style/PopupItem" >
diff --git a/res/layout/system_shortcut_icons.xml b/res/layout/system_shortcut_icons.xml
index f992248..775a45f 100644
--- a/res/layout/system_shortcut_icons.xml
+++ b/res/layout/system_shortcut_icons.xml
@@ -21,7 +21,8 @@
android:layout_height="@dimen/system_shortcut_header_height"
android:orientation="horizontal"
android:gravity="end|center_vertical"
- android:background="@drawable/single_item_secondary"
+ android:background="@drawable/single_item_primary"
+ android:elevation="@dimen/deep_shortcuts_elevation"
android:clipToPadding="true">
<Space android:layout_width="0dp"
diff --git a/res/layout/widgets_full_sheet_paged_view.xml b/res/layout/widgets_full_sheet_paged_view.xml
index e3d34f6..580ca49 100644
--- a/res/layout/widgets_full_sheet_paged_view.xml
+++ b/res/layout/widgets_full_sheet_paged_view.xml
@@ -38,8 +38,5 @@
</com.android.launcher3.workprofile.PersonalWorkPagedView>
- <include layout="@layout/widgets_personal_work_tabs"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginHorizontal="16dp" />
+ <include layout="@layout/widgets_personal_work_tabs"/>
</merge>
\ No newline at end of file
diff --git a/res/layout/widgets_personal_work_tabs.xml b/res/layout/widgets_personal_work_tabs.xml
index 3402415..f835b52 100644
--- a/res/layout/widgets_personal_work_tabs.xml
+++ b/res/layout/widgets_personal_work_tabs.xml
@@ -20,8 +20,7 @@
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/all_apps_header_pill_height"
- android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
- android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
+ android:layout_marginHorizontal="16dp"
android:orientation="horizontal"
android:elevation="2dp"
style="@style/TextHeadline">
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index 6c2d6aa..5ade64c 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -17,8 +17,7 @@
*/
-->
<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_primary_light">@android:color/system_neutral1_0</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>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 1f8a022..e605ca8 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -21,7 +21,6 @@
<attr name="allAppsScrimColor" format="color" />
<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 f44cf94..e6553a2 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -41,7 +41,6 @@
<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 -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 3267a5d..1fbf8a4 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -202,7 +202,8 @@
<dimen name="pending_widget_elevation">2dp</dimen>
<!-- Deep shortcuts -->
- <dimen name="deep_shortcuts_elevation">0dp</dimen>
+ <dimen name="deep_shortcuts_elevation">2dp</dimen>
+ <dimen name="bg_popup_padding">2dp</dimen>
<dimen name="bg_popup_item_width">216dp</dimen>
<dimen name="bg_popup_item_height">56dp</dimen>
<dimen name="pre_drag_view_scale">6dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0bca00e..fa41b1a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -35,7 +35,6 @@
<item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</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>
@@ -102,7 +101,6 @@
<item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</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>
@@ -202,7 +200,7 @@
<item name="android:alpha">0</item>
<item name="android:elevation">3dp</item>
<item name="android:saveEnabled">false</item>
- <item name="android:textColor">@android:color/white</item>
+ <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
<item name="android:includeFontPadding">false</item>
<item name="android:importantForAccessibility">no</item>
</style>
diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java
index e954480..d44d158 100644
--- a/src/com/android/launcher3/notification/NotificationItemView.java
+++ b/src/com/android/launcher3/notification/NotificationItemView.java
@@ -92,10 +92,6 @@
});
}
- public void updateBackgroundColor(int color) {
- mMainView.updateBackgroundColor(color);
- }
-
public void addGutter() {
if (mGutter == null) {
mGutter = mPopupContainer.inflateAndAdd(R.layout.notification_gutter, mRootView);
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 73ac8f2..8dea14a 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -19,21 +19,15 @@
import static com.android.launcher3.anim.Interpolators.ACCELERATED_EASE;
import static com.android.launcher3.anim.Interpolators.DECELERATED_EASE;
import static com.android.launcher3.anim.Interpolators.LINEAR;
-import static com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
-import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Outline;
import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.util.Pair;
@@ -41,32 +35,25 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewOutlineProvider;
-import android.view.ViewTreeObserver;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.InsettableFrameLayout;
-import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.Workspace;
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;
-import com.android.launcher3.widget.LocalColorExtractor;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
/**
* A container for shortcuts to deep links and notifications associated with an app.
@@ -89,9 +76,6 @@
private static final int CLOSE_CHILD_FADE_START_DELAY = 0;
private static final int CLOSE_CHILD_FADE_DURATION = 140;
- // +1 for system shortcut view
- private static final int MAX_NUM_CHILDREN = MAX_SHORTCUTS + 1;
-
private final Rect mTempRect = new Rect();
protected final LayoutInflater mInflater;
@@ -120,13 +104,8 @@
private Runnable mOnCloseCallback = () -> { };
- // The rect string of the view that the arrow is attached to, in screen reference frame.
- private String mArrowColorRectString;
- private int mArrowColor;
- private final int[] mColors;
- private final HashMap<String, View> mViewForRect = new HashMap<>();
-
- @Nullable private LocalColorExtractor mColorExtractor;
+ private final float mElevation;
+ private final int mBackgroundColor;
public ArrowPopup(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
@@ -134,13 +113,9 @@
mOutlineRadius = Themes.getDialogCornerRadius(context);
mLauncher = BaseDraggingActivity.fromContext(context);
mIsRtl = Utilities.isRtl(getResources());
- setClipToOutline(true);
- setOutlineProvider(new ViewOutlineProvider() {
- @Override
- public void getOutline(View view, Outline outline) {
- outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), mOutlineRadius);
- }
- });
+
+ mBackgroundColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
+ mElevation = getResources().getDimension(R.dimen.deep_shortcuts_elevation);
// Initialize arrow view
final Resources resources = getResources();
@@ -156,33 +131,14 @@
int smallerRadius = resources.getDimensionPixelSize(R.dimen.popup_smaller_radius);
mRoundedTop = new GradientDrawable();
+ mRoundedTop.setColor(mBackgroundColor);
mRoundedTop.setCornerRadii(new float[] { mOutlineRadius, mOutlineRadius, mOutlineRadius,
mOutlineRadius, smallerRadius, smallerRadius, smallerRadius, smallerRadius});
mRoundedBottom = new GradientDrawable();
+ mRoundedBottom.setColor(mBackgroundColor);
mRoundedBottom.setCornerRadii(new float[] { smallerRadius, smallerRadius, smallerRadius,
smallerRadius, mOutlineRadius, mOutlineRadius, mOutlineRadius, mOutlineRadius});
-
- 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);
- }
-
- if (supportsColorExtraction()) {
- setupColorExtraction();
- }
- }
}
public ArrowPopup(Context context, AttributeSet attrs) {
@@ -240,7 +196,6 @@
int numVisibleShortcut = 0;
View lastView = null;
- int numVisibleChild = 0;
for (int i = 0; i < count; i++) {
View view = getChildAt(i);
boolean isShortcut = view instanceof DeepShortcutView;
@@ -267,36 +222,12 @@
numVisibleShortcut++;
}
}
-
- int color = mColors[numVisibleChild % mColors.length];
- setChildColor(view, color);
-
- // Arrow color matches the first child or the last child.
- if (!mIsAboveIcon && numVisibleChild == 0) {
- mArrowColor = color;
- } else if (mIsAboveIcon) {
- mArrowColor = color;
- }
-
- numVisibleChild++;
}
}
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
}
/**
- * Sets the background color of the child.
- */
- protected void setChildColor(View view, int color) {
- Drawable bg = view.getBackground();
- if (bg instanceof GradientDrawable) {
- ((GradientDrawable) bg.mutate()).setColor(color);
- } else if (bg instanceof ColorDrawable) {
- ((ColorDrawable) bg.mutate()).setColor(color);
- }
- }
-
- /**
* Shows the popup at the desired location, optionally reversing the children.
* @param viewsToFlip number of views from the top to to flip in case of reverse order
*/
@@ -366,23 +297,18 @@
// so we centered it instead. In that case we don't want to showDefaultOptions the arrow.
mArrow.setVisibility(INVISIBLE);
} else {
- updateArrowColor();
- }
-
- mArrow.setPivotX(mArrowWidth / 2.0f);
- mArrow.setPivotY(mIsAboveIcon ? mArrowHeight : 0);
- }
-
- private void updateArrowColor() {
- if (!Gravity.isVertical(mGravity)) {
mArrow.setBackground(new RoundedArrowDrawable(
mArrowWidth, mArrowHeight, mArrowPointRadius,
mOutlineRadius, getMeasuredWidth(), getMeasuredHeight(),
mArrowOffsetHorizontal, -mArrowOffsetVertical,
!mIsAboveIcon, mIsLeftAligned,
- mArrowColor));
- mArrow.setElevation(getElevation());
+ mBackgroundColor));
+ // TODO: Remove elevation when arrow is above as it casts a shadow on the container
+ mArrow.setElevation(mIsAboveIcon ? mElevation : 0);
}
+
+ mArrow.setPivotX(mArrowWidth / 2.0f);
+ mArrow.setPivotY(mIsAboveIcon ? mArrowHeight : 0);
}
/**
@@ -434,7 +360,7 @@
}
int childMargins = (numVisibleChildren - 1) * mMargin;
int height = getMeasuredHeight() + extraVerticalSpace + childMargins;
- int width = getMeasuredWidth();
+ int width = getMeasuredWidth() + getPaddingLeft() + getPaddingRight();
getTargetObjectLocation(mTempRect);
InsettableFrameLayout dragLayer = getPopupContainer();
@@ -667,19 +593,6 @@
getPopupContainer().removeView(this);
getPopupContainer().removeView(mArrow);
mOnCloseCallback.run();
- mArrowColorRectString = null;
- mViewForRect.clear();
- if (mColorExtractor != null) {
- mColorExtractor.removeLocations();
- mColorExtractor.setListener(null);
- }
- }
-
- /**
- * Returns whether color extraction is supported.
- */
- public boolean supportsColorExtraction() {
- return Utilities.ATLEAST_S;
}
/**
@@ -689,68 +602,6 @@
mOnCloseCallback = callback;
}
- private void setupColorExtraction() {
- Workspace workspace = mLauncher.findViewById(R.id.workspace);
- if (workspace == null) {
- return;
- }
-
- mColorExtractor = LocalColorExtractor.newInstance(mLauncher);
- mColorExtractor.setListener((rect, extractedColors) -> {
- String rectString = rect.toShortString();
- View v = mViewForRect.get(rectString);
- if (v != null) {
- int newColor = extractedColors.get(mColorExtractionIndex);
- setChildColor(v, newColor);
- if (rectString.equals(mArrowColorRectString)) {
- mArrowColor = newColor;
- updateArrowColor();
- }
- }
- });
-
- getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- getViewTreeObserver().removeOnPreDrawListener(this);
-
- ArrayList<RectF> locations = new ArrayList<>();
- Rect r = new Rect();
-
- int count = getChildCount();
- int numVisibleChild = 0;
- for (int i = 0; i < count; i++) {
- View view = getChildAt(i);
- if (view.getVisibility() == VISIBLE) {
- RectF rf = new RectF();
- mColorExtractor.getExtractedRectForView(Launcher.getLauncher(getContext()),
- workspace.getCurrentPage(), view, rf);
- if (rf.isEmpty()) {
- numVisibleChild++;
- continue;
- }
-
- locations.add(rf);
- String rectString = rf.toShortString();
- mViewForRect.put(rectString, view);
-
- // Arrow color matches the first child or the last child.
- if (!mIsAboveIcon && numVisibleChild == 0) {
- mArrowColorRectString = rectString;
- } else if (mIsAboveIcon) {
- mArrowColorRectString = rectString;
- }
-
- numVisibleChild++;
- }
- }
-
- mColorExtractor.addLocation(locations);
- return false;
- }
- });
- }
-
protected BaseDragLayer getPopupContainer() {
return mLauncher.getDragLayer();
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 1659e6d..b115678 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -172,14 +172,6 @@
return false;
}
- @Override
- protected void setChildColor(View v, int color) {
- super.setChildColor(v, color);
- if (v.getId() == R.id.notification_container && mNotificationItemView != null) {
- mNotificationItemView.updateBackgroundColor(color);
- }
- }
-
/**
* Returns true if we can show the container.
*/