diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index d822c8cf82..f8c9fd128f 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -70,7 +70,9 @@ public class AllAppsState extends LauncherState { @Override protected float getDepthUnchecked(Context context) { - return 1f; + // The scrim fades in at approximately 50% of the swipe gesture. + // This means that the depth should be greater than 1, in order to fully zoom out. + return 2f; } @Override diff --git a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java index f1b4e3d89d..baca76cfba 100644 --- a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java +++ b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java @@ -48,15 +48,16 @@ import com.android.quickstep.views.RecentsView; public class AnimatorControllerWithResistance { private enum RecentsResistanceParams { - FROM_APP(0.75f, 0.5f, 1f), - FROM_APP_TABLET(0.9f, 0.75f, 1f), - FROM_OVERVIEW(1f, 0.75f, 0.5f); + FROM_APP(0.75f, 0.5f, 1f, false), + FROM_APP_TABLET(1f, 0.7f, 1f, true), + FROM_OVERVIEW(1f, 0.75f, 0.5f, false); RecentsResistanceParams(float scaleStartResist, float scaleMaxResist, - float translationFactor) { + float translationFactor, boolean stopScalingAtTop) { this.scaleStartResist = scaleStartResist; this.scaleMaxResist = scaleMaxResist; this.translationFactor = translationFactor; + this.stopScalingAtTop = stopScalingAtTop; } /** @@ -74,6 +75,12 @@ public class AnimatorControllerWithResistance { * where 0 will keep it centered and 1 will have it barely touch the top of the screen. */ public final float translationFactor; + + /** + * Whether to end scaling effect when the scaled down version of TaskView's top reaches the + * non-scaled version of TaskView's top. + */ + public final boolean stopScalingAtTop; } private static final TimeInterpolator RECENTS_SCALE_RESIST_INTERPOLATOR = DEACCEL; @@ -161,26 +168,6 @@ public class AnimatorControllerWithResistance { PointF pivot = new PointF(); float fullscreenScale = params.recentsOrientedState.getFullScreenScaleAndPivot( startRect, params.dp, pivot); - float prevScaleRate = (fullscreenScale - params.startScale) - / (params.dp.heightPx - startRect.bottom); - // This is what the scale would be at the end of the drag if we didn't apply resistance. - float endScale = params.startScale - prevScaleRate * distanceToCover; - // Create an interpolator that resists the scale so the scale doesn't get smaller than - // RECENTS_SCALE_MAX_RESIST. - float startResist = Utilities.getProgress(params.resistanceParams.scaleStartResist, - params.startScale, endScale); - float maxResist = Utilities.getProgress(params.resistanceParams.scaleMaxResist, - params.startScale, endScale); - final TimeInterpolator scaleInterpolator = t -> { - if (t < startResist) { - return t; - } - float resistProgress = Utilities.getProgress(t, startResist, 1); - resistProgress = RECENTS_SCALE_RESIST_INTERPOLATOR.getInterpolation(resistProgress); - return startResist + resistProgress * (maxResist - startResist); - }; - resistAnim.addFloat(params.scaleTarget, params.scaleProperty, params.startScale, endScale, - scaleInterpolator); // Compute where the task view would be based on the end scale. RectF endRectF = new RectF(startRect); @@ -195,6 +182,32 @@ public class AnimatorControllerWithResistance { resistAnim.addFloat(params.translationTarget, params.translationProperty, params.startTranslation, endTranslation, RECENTS_TRANSLATE_RESIST_INTERPOLATOR); + float prevScaleRate = (fullscreenScale - params.startScale) + / (params.dp.heightPx - startRect.bottom); + // This is what the scale would be at the end of the drag if we didn't apply resistance. + float endScale = params.startScale - prevScaleRate * distanceToCover; + // Create an interpolator that resists the scale so the scale doesn't get smaller than + // RECENTS_SCALE_MAX_RESIST. + float startResist = Utilities.getProgress(params.resistanceParams.scaleStartResist, + params.startScale, endScale); + float maxResist = Utilities.getProgress(params.resistanceParams.scaleMaxResist, + params.startScale, endScale); + float stopResist = + params.resistanceParams.stopScalingAtTop ? 1f - startRect.top / endRectF.top : 1f; + final TimeInterpolator scaleInterpolator = t -> { + if (t < startResist) { + return t; + } + if (t > stopResist) { + return maxResist; + } + float resistProgress = Utilities.getProgress(t, startResist, stopResist); + resistProgress = RECENTS_SCALE_RESIST_INTERPOLATOR.getInterpolation(resistProgress); + return startResist + resistProgress * (maxResist - startResist); + }; + resistAnim.addFloat(params.scaleTarget, params.scaleProperty, params.startScale, endScale, + scaleInterpolator); + return resistAnim; } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 935305a5c6..26664de149 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1172,7 +1172,7 @@ public abstract class RecentsView"షార్ట్‌కట్‌ను తరలించడానికి లేదా అనుకూల చర్యలను ఉపయోగించడానికి రెండుసార్లు నొక్కండి & హోల్డ్ చేయండి." "ఈ మొదటి స్క్రీన్‌లో స్థలం లేదు" "ఇష్టమైనవి ట్రేలో ఖాళీ లేదు" - "అనువర్తనాల జాబితా" + "యాప్‌ల జాబితా" "వ్యక్తిగత యాప్‌ల జాబితా" "కార్యాలయ యాప్‌ల జాబితా" "తీసివేయి" @@ -83,7 +83,7 @@ "హోమ్‌లో సెట్టింగ్‌లు మరియు సత్వరమార్గాలను చదవడానికి యాప్‌ను అనుమతిస్తుంది." "హోమ్ సెట్టింగ్‌లు మరియు సత్వరమార్గాలను వ్రాయడం" "హోమ్‌లో సెట్టింగ్‌లు మరియు సత్వరమార్గాలను మార్చడానికి యాప్‌ను అనుమతిస్తుంది." - "ఫోన్ కాల్‌లను చేసేందుకు %1$sకి అనుమతి లేదు" + "ఫోన్ కాల్స్‌ను చేసేందుకు %1$sకి అనుమతి లేదు" "విడ్జెట్‌ను లోడ్ చేయడం సాధ్యం కాలేదు" "సెటప్‌ను పూర్తి చేయడానికి ట్యాప్ చేయండి" "ఇది సిస్టమ్ యాప్ మరియు దీన్ని అన్‌ఇన్‌స్టాల్ చేయడం సాధ్యపడదు." diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 696c3089ab..1ebfda18ff 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1298,7 +1298,7 @@ public class Launcher extends StatefulActivity implements Launche } if (!foundCellSpan) { - mWorkspace.onNoCellFound(layout); + mWorkspace.onNoCellFound(layout, info, /* logInstanceId= */ null); return; } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index ae42d74c2a..3bfa1e2d2e 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -63,6 +63,8 @@ import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Toast; +import androidx.annotation.Nullable; + import com.android.launcher3.accessibility.AccessibleDragListenerAdapter; import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper; import com.android.launcher3.anim.Interpolators; @@ -82,6 +84,7 @@ import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.icons.BitmapRenderer; import com.android.launcher3.icons.FastBitmapDrawable; import com.android.launcher3.logger.LauncherAtom; +import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.LauncherEvent; import com.android.launcher3.model.data.AppInfo; @@ -1604,7 +1607,7 @@ public class Workspace extends PagedView // Don't accept the drop if there's no room for the item if (!foundCell) { - onNoCellFound(dropTargetLayout); + onNoCellFound(dropTargetLayout, d.dragInfo, d.logInstanceId); return false; } } @@ -1906,7 +1909,7 @@ public class Workspace extends PagedView lp.cellX, lp.cellY, item.spanX, item.spanY); } else { if (!returnToOriginalCellToPreventShuffling) { - onNoCellFound(dropTargetLayout); + onNoCellFound(dropTargetLayout, d.dragInfo, d.logInstanceId); } if (mDragInfo.cell instanceof LauncherAppWidgetHostView) { d.dragView.detachContentView(/* reattachToPreviousParent= */ true); @@ -1974,10 +1977,16 @@ public class Workspace extends PagedView } } - public void onNoCellFound(View dropTargetLayout) { + public void onNoCellFound( + View dropTargetLayout, ItemInfo itemInfo, @Nullable InstanceId logInstanceId) { int strId = mLauncher.isHotseatLayout(dropTargetLayout) ? R.string.hotseat_out_of_space : R.string.out_of_space; Toast.makeText(mLauncher, mLauncher.getString(strId), Toast.LENGTH_SHORT).show(); + StatsLogManager.StatsLogger logger = mStatsLogManager.logger().withItemInfo(itemInfo); + if (logInstanceId != null) { + logger = logger.withInstanceId(logInstanceId); + } + logger.log(LauncherEvent.LAUNCHER_ITEM_DROP_FAILED_INSUFFICIENT_SPACE); } /** diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 79e5b5d04c..d959ee288b 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -486,7 +486,10 @@ public class StatsLogManager implements ResourceBasedOverride { LAUNCHER_TURN_ON_WORK_APPS_TAP(838), @UiEvent(doc = "User tapped on 'Turn off work apps' button in all apps window.") - LAUNCHER_TURN_OFF_WORK_APPS_TAP(839) + LAUNCHER_TURN_OFF_WORK_APPS_TAP(839), + + @UiEvent(doc = "Launcher item drop failed since there was not enough room on the screen.") + LAUNCHER_ITEM_DROP_FAILED_INSUFFICIENT_SPACE(872) ; // ADD MORE diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index 167eb0983e..a8ed1549d6 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -325,10 +325,10 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { return; } if (drawable != null) { + // Scale down the preview size if it's wider than the cell. float scale = 1f; - if (getWidth() > 0 && getHeight() > 0) { - // Scale down the preview size if it's wider than the cell. - float maxWidth = getWidth(); + if (mTargetPreviewWidth > 0) { + float maxWidth = mTargetPreviewWidth; float previewWidth = drawable.getIntrinsicWidth() * mPreviewContainerScale; scale = Math.min(maxWidth / previewWidth, 1); }