Merge "Add springs when snapping between pages on the workspace." into ub-launcher3-master
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 1a485ed..9500a2f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -61,6 +61,9 @@
<category android:name="android.intent.category.MONKEY"/>
<category android:name="android.intent.category.LAUNCHER_APP" />
</intent-filter>
+ <meta-data
+ android:name="com.android.launcher3.grid.control"
+ android:value="${packageName}.grid.control" />
</activity>
</application>
diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
index 73075dc..d0c255c 100644
--- a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
+++ b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
@@ -22,8 +22,6 @@
import android.view.View;
-import androidx.annotation.Nullable;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.util.TouchController;
@@ -44,25 +42,12 @@
* @param launcher the launcher activity
* @return the touch controller for recents tasks
*/
- public static @Nullable TouchController createTaskSwipeController(Launcher launcher) {
+ public static TouchController createTaskSwipeController(Launcher launcher) {
// We leave all input handling to the view itself.
return null;
}
/**
- * Creates and returns a touch controller for swiping from overview state to the all apps state
- * if such an action is supported.
- *
- * @param launcher the launcher activity
- * @return the touch controller for swiping from overview to all apps
- */
- public static @Nullable TouchController createOverviewToAllAppsTouchController(
- Launcher launcher) {
- // Go does not support overview to all apps transition.
- return null;
- }
-
- /**
* Creates and returns the controller responsible for recents view state transitions.
*
* @param launcher the launcher activity
diff --git a/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java b/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java
index 455c58c..5df8043 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java
@@ -122,7 +122,11 @@
}
public Bitmap createPill(int width, int height) {
- radius = height / 2f;
+ return createPill(width, height, height / 2f);
+ }
+
+ public Bitmap createPill(int width, int height, float r) {
+ radius = r;
int centerX = Math.round(width / 2f + shadowBlur);
int centerY = Math.round(radius + shadowBlur + keyShadowDistance);
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index 8af310c..ab97344 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
index 0b62bee..f18f43c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
@@ -22,14 +22,11 @@
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
-import androidx.annotation.Nullable;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.util.TouchController;
-import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.views.RecentsView;
/**
@@ -48,28 +45,11 @@
* @param launcher the launcher activity
* @return the touch controller for recents tasks
*/
- public static @Nullable TouchController createTaskSwipeController(Launcher launcher) {
+ public static TouchController createTaskSwipeController(Launcher launcher) {
return new LauncherTaskViewController(launcher);
}
/**
- * Creates and returns a touch controller for swiping from overview state to the all apps state
- * if such an action is supported.
- *
- * @param launcher the launcher activity
- * @return the touch controller for swiping from overview to all apps
- */
- public static @Nullable TouchController createOverviewToAllAppsTouchController(
- Launcher launcher) {
- boolean swipeUpEnabled = OverviewInteractionState.INSTANCE.get(launcher)
- .isSwipeUpGestureEnabled();
- if (!swipeUpEnabled || launcher.getDeviceProfile().isVerticalBarLayout()) {
- return new OverviewToAllAppsTouchController(launcher);
- }
- return null;
- }
-
- /**
* Creates and returns the controller responsible for recents view state transitions.
*
* @param launcher the launcher activity
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index e0c4e4b..8d62ab8 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -20,6 +20,8 @@
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_corner_radius">8dp</dimen>
+ <!-- For screens without rounded corners -->
+ <dimen name="task_corner_radius_small">2dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
<dimen name="quickscrub_adjacent_visible_width">20dp</dimen>
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 7c47956..0c741a1 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -62,8 +62,4 @@
<!-- Annotation shown on an app card in Recents, telling that the app has a usage limit set by
the user, and a given time is left for it today [CHAR LIMIT=20] -->
<string name="time_left_for_app"><xliff:g id="time" example="7 minutes">%1$s</xliff:g> left today</string>
-
- <!-- Annotation shown on an app card in Recents, telling that the app is in a group that has a
- usage limit set by the user, and a given time is left for the group today [CHAR LIMIT=20] -->
- <string name="time_left_for_group"><xliff:g id="time" example="1 hour">%1$s</xliff:g> left for group</string>
</resources>
\ No newline at end of file
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 73a7c08..07a5b72 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -615,9 +615,12 @@
// Animate window corner radius from 100% to windowCornerRadius.
float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher)
.getWindowCornerRadius();
- float circleRadius = iconWidth / 2f;
- float windowRadius = Utilities.mapRange(easePercent, circleRadius,
- windowCornerRadius);
+ float windowRadius = 0;
+ if (RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
+ float circleRadius = iconWidth / 2f;
+ windowRadius = Utilities.mapRange(easePercent, circleRadius,
+ windowCornerRadius);
+ }
// Animate the window crop so that it starts off as a square, and then reveals
// horizontally.
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
similarity index 100%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index bc9069a..d295ac5 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -21,7 +21,10 @@
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.allapps.DiscoveryBounce.BOUNCE_MAX_COUNT;
+import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_COUNT;
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
+import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_COUNT;
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN;
import android.animation.AnimatorSet;
@@ -60,14 +63,15 @@
WindowManagerWrapper.getInstance().setShelfHeight(visible != 0, height);
public static TouchController[] createTouchControllers(Launcher launcher) {
+ boolean swipeUpEnabled = OverviewInteractionState.INSTANCE.get(launcher)
+ .isSwipeUpGestureEnabled();
ArrayList<TouchController> list = new ArrayList<>();
list.add(launcher.getDragController());
- TouchController overviewToAllAppsController =
- RecentsUiFactory.createOverviewToAllAppsTouchController(launcher);
- if (overviewToAllAppsController != null) {
- list.add(overviewToAllAppsController);
+ if (!swipeUpEnabled || launcher.getDeviceProfile().isVerticalBarLayout()) {
+ list.add(new OverviewToAllAppsTouchController(launcher));
}
+
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
list.add(new LandscapeEdgeSwipeController(launcher));
} else {
@@ -135,7 +139,8 @@
LauncherState prevState = launcher.getStateManager().getLastState();
if (((swipeUpEnabled && finalState == OVERVIEW) || (!swipeUpEnabled
- && finalState == ALL_APPS && prevState == NORMAL))) {
+ && finalState == ALL_APPS && prevState == NORMAL) || BOUNCE_MAX_COUNT <=
+ launcher.getSharedPrefs().getInt(HOME_BOUNCE_COUNT, 0))) {
launcher.getSharedPrefs().edit().putBoolean(HOME_BOUNCE_SEEN, true).apply();
launcher.getStateManager().removeStateListener(this);
}
@@ -158,7 +163,8 @@
public void onStateTransitionComplete(LauncherState finalState) {
LauncherState prevState = launcher.getStateManager().getLastState();
- if (finalState == ALL_APPS && prevState == OVERVIEW) {
+ if ((finalState == ALL_APPS && prevState == OVERVIEW) || BOUNCE_MAX_COUNT <=
+ launcher.getSharedPrefs().getInt(SHELF_BOUNCE_COUNT, 0)) {
launcher.getSharedPrefs().edit().putBoolean(SHELF_BOUNCE_SEEN, true).apply();
launcher.getStateManager().removeStateListener(this);
}
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index 442b106..e61c00a 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -66,6 +66,7 @@
private final TaskThumbnailCache mThumbnailCache;
private float mWindowCornerRadius = -1;
+ private Boolean mSupportsRoundedCornersOnWindows;
private RecentsModel(Context context) {
mContext = context;
@@ -199,6 +200,26 @@
return mWindowCornerRadius;
}
+ public boolean supportsRoundedCornersOnWindows() {
+ if (mSupportsRoundedCornersOnWindows == null) {
+ if (mSystemUiProxy != null) {
+ try {
+ mSupportsRoundedCornersOnWindows =
+ mSystemUiProxy.supportsRoundedCornersOnWindows();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Connection to ISystemUIProxy was lost, ignoring window corner "
+ + "radius");
+ return false;
+ }
+ } else {
+ Log.w(TAG, "ISystemUIProxy is null, ignoring window corner radius");
+ return false;
+ }
+ }
+
+ return mSupportsRoundedCornersOnWindows;
+ }
+
public void onTrimMemory(int level) {
if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
mThumbnailCache.getHighResLoadingState().setVisible(false);
diff --git a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
index 84033cb..31de683 100644
--- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -91,6 +91,8 @@
private final float mWindowCornerRadius;
// Corner radius of windows when they're in overview mode.
private final float mTaskCornerRadius;
+ // If windows can have real time rounded corners.
+ private final boolean mSupportsRoundedCornersOnWindows;
// Corner radius currently applied to transformed window.
private float mCurrentCornerRadius;
@@ -107,8 +109,12 @@
(t, a1) -> a1;
public ClipAnimationHelper(Context context) {
- mTaskCornerRadius = context.getResources().getDimension(R.dimen.task_corner_radius);
- mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
+ mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
+ mSupportsRoundedCornersOnWindows = RecentsModel.INSTANCE.get(context)
+ .supportsRoundedCornersOnWindows();
+ int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ?
+ R.dimen.task_corner_radius : R.dimen.task_corner_radius_small;
+ mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes);
}
private void updateSourceStack(RemoteAnimationTargetCompat target) {
@@ -197,9 +203,10 @@
mTmpMatrix.setRectToRect(mSourceRect, params.currentRect, ScaleToFit.FILL);
mTmpMatrix.postTranslate(app.position.x, app.position.y);
mClipRectF.roundOut(crop);
- cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius,
- mTaskCornerRadius);
- mCurrentCornerRadius = cornerRadius;
+ if (mSupportsRoundedCornersOnWindows) {
+ cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius,
+ mTaskCornerRadius);
+ }
}
alpha = mTaskAlphaCallback.apply(app, params.targetAlpha);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
index aafd725..9ad750b 100644
--- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -77,7 +77,6 @@
Utilities.THREAD_POOL_EXECUTOR.execute(() -> {
long appUsageLimitTimeMs = -1;
long appRemainingTimeMs = -1;
- boolean isGroupLimit = true;
try {
final Method getAppUsageLimit = LauncherApps.class.getMethod(
@@ -95,8 +94,6 @@
invoke(usageLimit);
appRemainingTimeMs = (long) appUsageLimitClass.getMethod("getUsageRemaining").
invoke(usageLimit);
- isGroupLimit = (boolean) appUsageLimitClass.getMethod("isGroupLimit").
- invoke(usageLimit);
}
} catch (Exception e) {
// Do nothing
@@ -104,14 +101,13 @@
final long appUsageLimitTimeMsFinal = appUsageLimitTimeMs;
final long appRemainingTimeMsFinal = appRemainingTimeMs;
- final boolean isGroupLimitFinal = isGroupLimit;
post(() -> {
if (appUsageLimitTimeMsFinal < 0) {
setVisibility(GONE);
} else {
setVisibility(VISIBLE);
- mText.setText(getText(appRemainingTimeMsFinal, isGroupLimitFinal));
+ mText.setText(getText(appRemainingTimeMsFinal));
mImage.setImageResource(appRemainingTimeMsFinal > 0 ?
R.drawable.hourglass_top : R.drawable.hourglass_bottom);
}
@@ -119,9 +115,7 @@
callback.call(
appUsageLimitTimeMsFinal >= 0 && appRemainingTimeMsFinal <= 0 ? 0 : 1,
getContentDescriptionForTask(
- task, appUsageLimitTimeMsFinal,
- appRemainingTimeMsFinal,
- isGroupLimitFinal));
+ task, appUsageLimitTimeMsFinal, appRemainingTimeMsFinal));
});
});
}
@@ -185,12 +179,12 @@
duration, FormatWidth.NARROW, R.string.shorter_duration_less_than_one_minute);
}
- private String getText(long remainingTime, boolean isGroupLimit) {
+ private String getText(long remainingTime) {
final Resources resources = getResources();
return (remainingTime <= 0) ?
resources.getString(R.string.app_in_grayscale) :
resources.getString(
- isGroupLimit ? R.string.time_left_for_group : R.string.time_left_for_app,
+ R.string.time_left_for_app,
getShorterReadableDuration(Duration.ofMillis(remainingTime)));
}
@@ -214,12 +208,12 @@
}
private String getContentDescriptionForTask(
- Task task, long appUsageLimitTimeMs, long appRemainingTimeMs, boolean isGroupLimit) {
+ Task task, long appUsageLimitTimeMs, long appRemainingTimeMs) {
return appUsageLimitTimeMs >= 0 ?
getResources().getString(
R.string.task_contents_description_with_remaining_time,
task.titleDescription,
- getText(appRemainingTimeMs, isGroupLimit)) :
+ getText(appRemainingTimeMs)) :
task.titleDescription;
}
}
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index dafd5bb..6582df2 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -36,6 +36,7 @@
import android.view.Display;
import android.view.WindowManager;
+import com.android.launcher3.folder.FolderShape;
import com.android.launcher3.util.ConfigMonitor;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.MainThreadInitializedObject;
@@ -285,6 +286,10 @@
!iconShapePath.equals(oldProfile.iconShapePath)) {
changeFlags |= CHANGE_FLAG_ICON_PARAMS;
}
+ if (!iconShapePath.equals(oldProfile.iconShapePath)) {
+ FolderShape.init(context);
+ }
+
apply(context, changeFlags);
}
diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java
index 76b2565..7467119 100644
--- a/src/com/android/launcher3/allapps/DiscoveryBounce.java
+++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java
@@ -25,6 +25,7 @@
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
import android.app.ActivityManager;
+import android.content.SharedPreferences;
import android.os.Handler;
import android.view.MotionEvent;
@@ -43,6 +44,10 @@
public static final String HOME_BOUNCE_SEEN = "launcher.apps_view_shown";
public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen";
+ public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count";
+ public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count";
+
+ public static final int BOUNCE_MAX_COUNT = 3;
private final Launcher mLauncher;
private final Animator mDiscoBounceAnimation;
@@ -137,6 +142,7 @@
new Handler().postDelayed(() -> showForHomeIfNeeded(launcher, false), DELAY_MS);
return;
}
+ incrementHomeBounceCount(launcher);
new DiscoveryBounce(launcher, 0).show(HOTSEAT);
}
@@ -165,6 +171,7 @@
// TODO: Move these checks to the top and call this method after invalidate handler.
return;
}
+ incrementShelfBounceCount(launcher);
new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher)))
.show(PREDICTION);
@@ -197,4 +204,22 @@
PersonalWorkSlidingTabStrip.KEY_SHOWED_PEEK_WORK_TAB, false)
&& UserManagerCompat.getInstance(launcher).hasWorkProfile();
}
+
+ private static void incrementShelfBounceCount(Launcher launcher) {
+ SharedPreferences sharedPrefs = launcher.getSharedPrefs();
+ int count = sharedPrefs.getInt(SHELF_BOUNCE_COUNT, 0);
+ if (count > BOUNCE_MAX_COUNT) {
+ return;
+ }
+ sharedPrefs.edit().putInt(SHELF_BOUNCE_COUNT, count + 1).apply();
+ }
+
+ private static void incrementHomeBounceCount(Launcher launcher) {
+ SharedPreferences sharedPrefs = launcher.getSharedPrefs();
+ int count = sharedPrefs.getInt(HOME_BOUNCE_COUNT, 0);
+ if (count > BOUNCE_MAX_COUNT) {
+ return;
+ }
+ sharedPrefs.edit().putInt(HOME_BOUNCE_COUNT, count + 1).apply();
+ }
}
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index fa93081..da99142 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -95,9 +95,8 @@
public static final TogglableFlag APPLY_CONFIG_AT_RUNTIME = new TogglableFlag(
"APPLY_CONFIG_AT_RUNTIME", true, "Apply display changes dynamically");
- public static final ToggleableGlobalSettingsFlag ENABLE_TASK_STABILIZER
- = new ToggleableGlobalSettingsFlag("ENABLE_TASK_STABILIZER", false,
- "Stable task list across fast task switches");
+ public static final TogglableFlag ENABLE_TASK_STABILIZER = new TogglableFlag(
+ "ENABLE_TASK_STABILIZER", false, "Stable task list across fast task switches");
public static final TogglableFlag QUICKSTEP_SPRINGS = new TogglableFlag("QUICKSTEP_SPRINGS",
false, "Enable springs for quickstep animations");
diff --git a/src/com/android/launcher3/folder/FolderShape.java b/src/com/android/launcher3/folder/FolderShape.java
index 4b06dda..61db6ff 100644
--- a/src/com/android/launcher3/folder/FolderShape.java
+++ b/src/com/android/launcher3/folder/FolderShape.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.folder;
-import static com.android.launcher3.Workspace.MAP_NO_RECURSE;
-
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.FloatArrayEvaluator;
@@ -43,9 +41,6 @@
import android.util.Xml;
import android.view.ViewOutlineProvider;
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
@@ -358,7 +353,7 @@
if (!Utilities.ATLEAST_OREO) {
return;
}
- new MainThreadExecutor().execute(() -> pickShapeInBackground(context));
+ pickBestShape(context);
}
private static FolderShape getShapeDefinition(String type, float radius) {
@@ -410,7 +405,7 @@
}
@TargetApi(Build.VERSION_CODES.O)
- protected static void pickShapeInBackground(Context context) {
+ protected static void pickBestShape(Context context) {
// Pick any large size
int size = 200;
@@ -447,25 +442,7 @@
}
if (closestShape != null) {
- FolderShape shape = closestShape;
- new MainThreadExecutor().execute(() -> updateFolderShape(shape));
- }
- }
-
- private static void updateFolderShape(FolderShape shape) {
- sInstance = shape;
- LauncherAppState app = LauncherAppState.getInstanceNoCreate();
- if (app == null) {
- return;
- }
- Launcher launcher = (Launcher) app.getModel().getCallback();
- if (launcher != null) {
- launcher.getWorkspace().mapOverItems(MAP_NO_RECURSE, (i, v) -> {
- if (v instanceof FolderIcon) {
- v.invalidate();
- }
- return false;
- });
+ sInstance = closestShape;
}
}
}