Merge "Include recommended widgets table vertical padding in the height estimation" into sc-dev
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index 249ef3a..59d0afa 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -158,11 +158,7 @@
* Sets the specified app target surface to apply the blur to.
*/
public void setSurfaceToApp(RemoteAnimationTargetCompat target) {
- if (target != null) {
- setSurface(target.leash);
- } else {
- setActivityStarted(mLauncher.isStarted());
- }
+ setSurface(target == null ? null : target.leash);
}
private void setSurface(SurfaceControlCompat surface) {
@@ -170,9 +166,6 @@
mSurface = surface;
if (surface != null) {
setDepth(mDepth);
- } else {
- // If there is no surface, then reset the ratio
- setDepth(0f);
}
}
}
@@ -192,8 +185,7 @@
@Override
public void setStateWithAnimation(LauncherState toState, StateAnimationConfig config,
PendingAnimation animation) {
- if (mSurface == null
- || config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)
+ if (config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)
|| mIgnoreStateChangesDuringMultiWindowAnimation) {
return;
}
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 18c0b7a..f3fe0b4 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -515,8 +515,7 @@
}
mRotationTouchHelper.setOrientationTransformIfNeeded(event);
- if (!mDeviceState.isOneHandedModeActive()
- && mRotationTouchHelper.isInSwipeUpTouchRegion(event)) {
+ if (mRotationTouchHelper.isInSwipeUpTouchRegion(event)) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_SWIPE_TO_HOME,
"TouchInteractionService.onInputEvent:isInSwipeUpTouchRegion");
@@ -545,7 +544,8 @@
InputConsumer.NO_OP, mInputMonitorCompat,
mDeviceState,
event);
- } else if (mDeviceState.canTriggerOneHandedAction(event)) {
+ } else if (mDeviceState.canTriggerOneHandedAction(event)
+ && !mDeviceState.isOneHandedModeActive()) {
// Consume gesture event for triggering one handed feature.
mUncheckedConsumer = new OneHandedModeInputConsumer(this, mDeviceState,
InputConsumer.NO_OP, mInputMonitorCompat);
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/Launcher.java b/src/com/android/launcher3/Launcher.java
index 36d3625..a54c791 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, mScrimView);
+ mAllAppsController.setupViews(mAppsView);
}
/**
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 41962a4..ed854dc 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -36,6 +36,7 @@
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;
@@ -164,6 +165,10 @@
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 5c1bffb..c61c0d6 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -43,7 +43,6 @@
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.
@@ -71,11 +70,10 @@
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}.
@@ -123,8 +121,6 @@
*/
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);
}
@@ -189,12 +185,8 @@
return AnimationSuccessListener.forRunnable(this::onProgressAnimationEnd);
}
- /**
- * Setup views
- */
- public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
+ public void setupViews(AllAppsContainerView appsView) {
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/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/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java
index 9b809ae..c9424de 100644
--- a/src/com/android/launcher3/views/ScrimView.java
+++ b/src/com/android/launcher3/views/ScrimView.java
@@ -15,21 +15,18 @@
*/
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;
@@ -39,22 +36,9 @@
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(
@@ -63,23 +47,17 @@
}
@Override
- public void setInsets(Rect insets) {
- }
+ public void setInsets(Rect insets) { }
@Override
public boolean hasOverlappingRendering() {
return false;
}
- /**
- * 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
+ protected boolean onSetAlpha(int alpha) {
+ updateSysUiColors();
+ return super.onSetAlpha(alpha);
}
@Override