summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Workspace.java
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2016-10-18 11:47:42 -0700
committerJon Miranda <jonmiranda@google.com>2016-10-18 14:47:31 -0700
commit9485e5f293b0976f5f907804e43dfe19d58f165f (patch)
tree1d9a26460e19eba1583961a6910b7ad58afbf508 /src/com/android/launcher3/Workspace.java
parentd2959b9ee7deb06b40152e2ce85b5c045fff58e7 (diff)
downloadandroid_packages_apps_Trebuchet-9485e5f293b0976f5f907804e43dfe19d58f165f.tar.gz
android_packages_apps_Trebuchet-9485e5f293b0976f5f907804e43dfe19d58f165f.tar.bz2
android_packages_apps_Trebuchet-9485e5f293b0976f5f907804e43dfe19d58f165f.zip
Show error toast messages when there is no room for the item when icon is not to be added to folder.
* when user tries to add item to full hot seat from workspace. * when user tries to add item to full home screen from workspace. * refactored so that Workspace handles displaying error messages. Bug: 15574422 Change-Id: Ibc98c7f45bc0c646dc4636660fba62be9db22ac0
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r--src/com/android/launcher3/Workspace.java36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 13998a81b..f6f98d788 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -52,6 +52,7 @@ import android.view.accessibility.AccessibilityManager;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
+import android.widget.Toast;
import com.android.launcher3.Launcher.CustomContentCallbacks;
import com.android.launcher3.Launcher.LauncherOverlay;
@@ -2406,18 +2407,7 @@ public class Workspace extends PagedView
// Don't accept the drop if there's no room for the item
if (!foundCell) {
- // Don't show the message if we are dropping on the AllApps button and the hotseat
- // is full
- boolean isHotseat = mLauncher.isHotseatLayout(dropTargetLayout);
- if (mTargetCell != null && isHotseat && !FeatureFlags.NO_ALL_APPS_ICON) {
- Hotseat hotseat = mLauncher.getHotseat();
- if (mLauncher.getDeviceProfile().inv.isAllAppsButtonRank(
- hotseat.getOrderInHotseat(mTargetCell[0], mTargetCell[1]))) {
- return false;
- }
- }
-
- mLauncher.showOutOfSpaceMessage(isHotseat);
+ onNoCellFound(dropTargetLayout);
return false;
}
}
@@ -2703,6 +2693,8 @@ public class Workspace extends PagedView
LauncherModel.modifyItemInDatabase(mLauncher, info, container, screenId, lp.cellX,
lp.cellY, item.spanX, item.spanY);
} else {
+ onNoCellFound(dropTargetLayout);
+
// If we can't find a drop location, we return the item to its original position
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams();
mTargetCell[0] = lp.cellX;
@@ -2748,6 +2740,26 @@ public class Workspace extends PagedView
}
}
+ public void onNoCellFound(View dropTargetLayout) {
+ if (mLauncher.isHotseatLayout(dropTargetLayout)) {
+ Hotseat hotseat = mLauncher.getHotseat();
+ boolean droppedOnAllAppsIcon = !FeatureFlags.NO_ALL_APPS_ICON
+ && mTargetCell != null && !mLauncher.getDeviceProfile().inv.isAllAppsButtonRank(
+ hotseat.getOrderInHotseat(mTargetCell[0], mTargetCell[1]));
+ if (!droppedOnAllAppsIcon) {
+ // Only show message when hotseat is full and drop target was not AllApps button
+ showOutOfSpaceMessage(true);
+ }
+ } else {
+ showOutOfSpaceMessage(false);
+ }
+ }
+
+ private void showOutOfSpaceMessage(boolean isHotseatLayout) {
+ int strId = (isHotseatLayout ? R.string.hotseat_out_of_space : R.string.out_of_space);
+ Toast.makeText(mLauncher, mLauncher.getString(strId), Toast.LENGTH_SHORT).show();
+ }
+
/**
* Computes the area relative to dragLayer which is used to display a page.
*/