summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/FocusHelper.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2015-11-09 17:51:08 -0800
committerTony Wickham <twickham@google.com>2015-11-10 11:40:58 -0800
commit6cbd22279e5e033c67863a3db851e0f43be9ddff (patch)
tree299cb5d5398a0e504072524665b89f5cbd756b45 /src/com/android/launcher3/FocusHelper.java
parent3cfa97d4c14fa4af3ee3613e44ba7b7128141e31 (diff)
downloadandroid_packages_apps_Trebuchet-6cbd22279e5e033c67863a3db851e0f43be9ddff.tar.gz
android_packages_apps_Trebuchet-6cbd22279e5e033c67863a3db851e0f43be9ddff.tar.bz2
android_packages_apps_Trebuchet-6cbd22279e5e033c67863a3db851e0f43be9ddff.zip
Add special column for All Apps button in FocusLogic's sparse matrix.
The All Apps button creates a number of edge cases, mainly because it causes the hotseat to sometimes have an extra column than the workspace. Previously, we sort of swept these problems under the rug by simply ignoring the All Apps button if other icons were present in the hotseat, with the assumption that those other icons should get focus instead of the All Apps button. (If possible, we want to stay in the same column when moving from the workspace to the hotseat.) But this doesn't always work, as in the attached bug where the hotseat doesn't get focus at all when the All Apps button is an obvious candidate for it. By adding a specialized column in the focus matrix for the All Apps button, we ensure that moving down to the hotseat stays within the original column when possible, while also allowing the focus to switch to the All Apps button if appropriate. Furthermore, we take care to skip over the All Apps column when necessary in order to maintain all previous functionality. Bug: 25590522 Change-Id: I5d6a8ee69de8834314c4689246fe7d54329b2eef
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r--src/com/android/launcher3/FocusHelper.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java
index 8516afb4e..3d12aa3e2 100644
--- a/src/com/android/launcher3/FocusHelper.java
+++ b/src/com/android/launcher3/FocusHelper.java
@@ -223,20 +223,18 @@ public class FocusHelper {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP &&
!profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrix(iconLayout, hotseatLayout,
- true /* hotseat horizontal */, profile.inv.hotseatAllAppsRank,
- iconRank == profile.inv.hotseatAllAppsRank /* include all apps icon */);
+ true /* hotseat horizontal */, profile.inv.hotseatAllAppsRank);
iconIndex += iconParent.getChildCount();
- countX = iconLayout.getCountX();
+ countX = hotseatLayout.getCountX();
countY = iconLayout.getCountY() + hotseatLayout.getCountY();
parent = iconParent;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT &&
profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrix(iconLayout, hotseatLayout,
- false /* hotseat horizontal */, profile.inv.hotseatAllAppsRank,
- iconRank == profile.inv.hotseatAllAppsRank /* include all apps icon */);
+ false /* hotseat horizontal */, profile.inv.hotseatAllAppsRank);
iconIndex += iconParent.getChildCount();
countX = iconLayout.getCountX() + hotseatLayout.getCountX();
- countY = iconLayout.getCountY();
+ countY = hotseatLayout.getCountY();
parent = iconParent;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT &&
profile.isVerticalBarLayout()) {
@@ -326,15 +324,15 @@ public class FocusHelper {
// with the hotseat.
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && !profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrix(iconLayout, hotseatLayout, true /* horizontal */,
- profile.inv.hotseatAllAppsRank,
- !hotseat.hasIcons() /* ignore all apps icon, unless there are no other icons */);
- countY = countY + 1;
+ profile.inv.hotseatAllAppsRank);
+ countX = hotseatLayout.getCountX();
+ countY = countY + hotseatLayout.getCountY();
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT &&
profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrix(iconLayout, hotseatLayout, false /* horizontal */,
- profile.inv.hotseatAllAppsRank,
- !hotseat.hasIcons() /* ignore all apps icon, unless there are no other icons */);
- countX = countX + 1;
+ profile.inv.hotseatAllAppsRank);
+ countX = countX + hotseatLayout.getCountX();
+ countY = hotseatLayout.getCountY();
} else if (isUninstallKeyChord(e)) {
matrix = FocusLogic.createSparseMatrix(iconLayout);
if (UninstallDropTarget.supportsDrop(launcher, itemInfo)) {