diff options
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 73bb828317..8be8fedf80 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -67,9 +67,9 @@ import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import com.android.app.animation.Interpolators; import com.android.launcher3.accessibility.AccessibleDragListenerAdapter; import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper; -import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.celllayout.CellLayoutLayoutParams; import com.android.launcher3.celllayout.CellPosMapper; @@ -562,9 +562,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> // Change the interpolators such that the fade animation plays before the move animation. // This prevents empty adjacent pages to overlay during animation mLayoutTransition.setInterpolator(LayoutTransition.DISAPPEARING, - Interpolators.clampToProgress(Interpolators.ACCEL_DEACCEL, 0, 0.5f)); + Interpolators.clampToProgress(Interpolators.ACCELERATE_DECELERATE, 0, 0.5f)); mLayoutTransition.setInterpolator(LayoutTransition.CHANGE_DISAPPEARING, - Interpolators.clampToProgress(Interpolators.ACCEL_DEACCEL, 0.5f, 1)); + Interpolators.clampToProgress(Interpolators.ACCELERATE_DECELERATE, 0.5f, 1)); mLayoutTransition.disableTransitionType(LayoutTransition.APPEARING); mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_APPEARING); @@ -731,6 +731,14 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> }); } + + /** + * Returns if the given screenId is already in the Workspace + */ + public boolean containsScreenId(int screenId) { + return this.mWorkspaceScreens.containsKey(screenId); + } + /** * Inserts extra empty pages to the end of the existing workspaces. * Usually we add one extra empty screen, but when two panel home is enabled we add @@ -897,9 +905,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> mWorkspaceScreens.remove(emptyScreenId); mScreenOrder.removeValue(emptyScreenId); - int newScreenId = LauncherSettings.Settings.call(getContext().getContentResolver(), - LauncherSettings.Settings.METHOD_NEW_SCREEN_ID) - .getInt(LauncherSettings.Settings.EXTRA_VALUE); + int newScreenId = LauncherAppState.getInstance(getContext()) + .getModel().getModelDbController().getNewScreenId(); // Launcher database isn't aware of empty pages that are already bound, so we need to // skip those IDs manually. while (mWorkspaceScreens.containsKey(newScreenId)) { @@ -1840,7 +1847,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION); boolean willBecomeShortcut = (info.itemType == ITEM_TYPE_APPLICATION || - info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT); return (aboveShortcut && willBecomeShortcut); @@ -2759,7 +2765,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> final PendingAddItemInfo pendingInfo = (PendingAddItemInfo) info; boolean findNearestVacantCell = true; - if (pendingInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) { + if (pendingInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { mTargetCell = findNearestArea(touchXY[0], touchXY[1], spanX, spanY, cellLayout, mTargetCell); float distance = cellLayout.getDistanceFromWorkspaceCellVisualCenter( @@ -2832,8 +2838,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> View view; switch (info.itemType) { - case ITEM_TYPE_APPLICATION: - case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: + case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION: case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT: case LauncherSettings.Favorites.ITEM_TYPE_SEARCH_ACTION: if (info instanceof WorkspaceItemFactory) { |