summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/FocusHelper.java
diff options
context:
space:
mode:
authorWinson <winsonc@google.com>2015-09-10 22:03:57 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-09-10 22:03:57 +0000
commit7089a4e197bb14b01f4c485304f205dcb730ad21 (patch)
treea059ceadbb13bd734b2a851aaa59bda428d7f0d9 /src/com/android/launcher3/FocusHelper.java
parentd6a887b6a72d0bc3d2970a6e5cbdc0f3cc3e5c9d (diff)
parentc0b52fefbc11531d560359c093484099f9d1298e (diff)
downloadandroid_packages_apps_Trebuchet-7089a4e197bb14b01f4c485304f205dcb730ad21.tar.gz
android_packages_apps_Trebuchet-7089a4e197bb14b01f4c485304f205dcb730ad21.tar.bz2
android_packages_apps_Trebuchet-7089a4e197bb14b01f4c485304f205dcb730ad21.zip
am c0b52fef: Refactoring to ensure item deletion always removes from the DB.
* commit 'c0b52fefbc11531d560359c093484099f9d1298e': Refactoring to ensure item deletion always removes from the DB.
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r--src/com/android/launcher3/FocusHelper.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java
index 3751b881b..6f345875a 100644
--- a/src/com/android/launcher3/FocusHelper.java
+++ b/src/com/android/launcher3/FocusHelper.java
@@ -186,7 +186,8 @@ public class FocusHelper {
return consume;
}
- DeviceProfile profile = ((Launcher) v.getContext()).getDeviceProfile();
+ final Launcher launcher = (Launcher) v.getContext();
+ final DeviceProfile profile = launcher.getDeviceProfile();
if (DEBUG) {
Log.v(TAG, String.format(
@@ -197,7 +198,6 @@ public class FocusHelper {
// Initialize the variables.
final ShortcutAndWidgetContainer hotseatParent = (ShortcutAndWidgetContainer) v.getParent();
final CellLayout hotseatLayout = (CellLayout) hotseatParent.getParent();
- Hotseat hotseat = (Hotseat) hotseatLayout.getParent();
Workspace workspace = (Workspace) v.getRootView().findViewById(R.id.workspace);
int pageIndex = workspace.getNextPage();
@@ -241,7 +241,10 @@ public class FocusHelper {
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT &&
profile.isVerticalBarLayout()) {
keyCode = KeyEvent.KEYCODE_PAGE_DOWN;
- }else {
+ } else if (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_FORWARD_DEL) {
+ ItemInfo info = (ItemInfo) v.getTag();
+ launcher.removeItem(v, info, true /* deleteFromDb */);
+ } else {
// For other KEYCODE_DPAD_LEFT and KEYCODE_DPAD_RIGHT navigation, do not use the
// matrix extended with hotseat.
matrix = FocusLogic.createSparseMatrix(hotseatLayout);
@@ -327,7 +330,8 @@ public class FocusHelper {
!hotseat.hasIcons() /* ignore all apps icon, unless there are no other icons */);
countX = countX + 1;
} else if (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_FORWARD_DEL) {
- workspace.removeWorkspaceItem(v);
+ ItemInfo info = (ItemInfo) v.getTag();
+ launcher.removeItem(v, info, true /* deleteFromDb */);
return consume;
} else {
matrix = FocusLogic.createSparseMatrix(iconLayout);