History log of /packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
66b24572e41a13ba5b85b37cf7be64804299c8f6 22-Sep-2016 Sunny Goyal <sunnygoyal@google.com> Exposing custom actions using keyboard shortcut

Keyboard shortcuts:
ctrl+A => Open all apps
ctrl+S => shows deep shortcuts
ctrl+O => shows custom actions popup

This also removes the direct delete/uninstall key shortcuts, making
actidental icon removal less likely

Bug: 24065447
Change-Id: Iae63370c0f33620628567cffd4df024064d4d02e
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
bb011dad4e69bec027be1e00d573a3095b318b43 16-Jun-2016 Sunny Goyal <sunnygoyal@google.com> Adding a flag (enabled by default) to remove the all-apps button.

All apps can still be opened by clicking the caret.

Bug: 29398447
Change-Id: I61f1b05cea83a0a49d7cc16c518c5419618ba779
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
329d8bfa0438980d93aab8c9744c4060acb5f0ba 04-Dec-2015 Tony Wickham <twickham@google.com> Cleanup keyboard code.

This should be the last keyboard CL.
- Fix bug: couldn't focus All Apps button in some cases when the All
Apps column was skipped over. Also added test case for this.
- Stop explicitly passing countX and countY to handleKeyEvent, as
these had to match the matrix dimensions anyways.
- Rename createSparseMatrix() - there were 3 methods of the same name,
but all had different purposes. This is confusing both from a
readability standpoint and also when looking at stack traces.

Change-Id: I08ba8411674fcea43a608856c114dee8dbd22398
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
af78b59af19264105b8ce856defa5342d6fd584a 11-Nov-2015 Tony Wickham <twickham@google.com> Make sure pages are always accessible via left/right arrow keys.

- Handle NextPageFirstItem as first focusable item in reading order
- Handle PreviousPageLastItem as last focusable item in reading order
- Check the hotseat after the workspace in both cases above
- Dpad horizontal navigation (left/right) uses these as a last
resort (Rule3) to guarantee an item takes focus if a page exists

Note that it is necessary to search for a focusable item because
widgets are not yet focusable.

Bug: 25591057
Change-Id: I953648bd76c657d660a38427fdd4108bf9963c23
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
6cbd22279e5e033c67863a3db851e0f43be9ddff 10-Nov-2015 Tony Wickham <twickham@google.com> 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
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
0e2f3849b84f59ed7c1c4336ca01ac17f096e265 06-Nov-2015 Tony Wickham <twickham@google.com> Merge "Make sure user can always get to next page with keyboard." into ub-launcher3-burnaby-polish
c2964cb6cd87746dd1e44da90e62813ccb47cecf 05-Nov-2015 Tony Wickham <twickham@google.com> Make sure user can always get to next page with keyboard.

There's a case where hitting the left/right arrow in the first/last
column wouldn't give focus to an icon on the next page because it is
vertically too far from the first icon to be considered. This makes
for a bad user experience, because there is no way to switch pages
with the keyboard. So now we brute-force search for an appropriate
icon if none was found in this case.

Bug: 25434120
Change-Id: Ifdead0e3b458717ccb33e2f0ec7c15f1fcce4b95
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
25189851ace521c856faf7a9deacf1330b5bef92 05-Nov-2015 Tony Wickham <twickham@google.com> Stop explicitly snapping to page when navigating with keyboard.

When an icon grabs focus, it already snaps to its own page, so
the explicit snapToPage() is redundant. And in the case where no icon
will grab the focus, the explicit call puts us in a weird state
because the page snaps but the focus doesn't change (see bug).

(This happens, for instance, if you are moving from an icon on the
bottom right of page 1 and the only icon on page 2 is in the top
left. In this case, the second icon won't take focus because the
angle is too wide according to FocusLogic#handleDpadHorizontal().)

Bug: 25434120
Change-Id: I17b0ef7d86426a2599bc948bf2313dca7e112364
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
df315180f0653702b470beea62f27927e45fab4b 22-Oct-2015 Tony Wickham <twickham@google.com> Don't add cells to FocusLogic sparse matrix if they aren't focusable.

Previously, any child of ShortcutAndWidgetContainer was added to the
matrix, causing widgets (which aren't focusable) to be considered as
potential targets to gain focus when an arrow key was pressed. But if
the algorithm chose them, they couldn't take the focus so nothing
happened (i.e. the focus stayed on the app/folder it was on before).

Bug: 25126768
Change-Id: Id55fc310f7f58fb8795cce51dcefe4fd1210f788
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
c2bc0ef1c313698fd931fc84ec2f11882c38cdba 21-Oct-2015 Tony Wickham <twickham@google.com> Fix regression where keyboard couldn't switch between workspace pages.

Bug: 25122302
Change-Id: Id1d7628753ce7ef37af50e8594e541dcb6bea13e
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
2e6da1539bc7286336b3c24d96ab76434939ce4d 06-May-2015 Adam Cohen <adamcohen@google.com> Refactoring DeviceProfile

-> Pulling out the parts of device profile which can (and need to be)
initialized and accessed without access to an Activity context,
ie. the invariant bits.
-> The invariant bits are stored in InvariantDeviceProfile which is
initialized statically from LauncherAppState.
-> The DeviceProfile contains the Activity context-dependent bits,
and we will create one of these for each Activity instance, and
this instance is accessed through the Launcher activity.
-> It's possible that we can continue to refactor this such that
all appropriate dimensions can be computed without an Activity
context (by only specifying orientation). This would be an
extension of this CL and allow us to know exactly how launcher
will look in both orientations from any context.

Sets the stage for some improvements around b/19514688

Change-Id: Ia7daccf14d8ca2b9cb340b8780b684769e9f1892
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
fc3c1edf7bbc3f7cb23e79520731d13ccc2da046 10-Apr-2015 Sunny Goyal <sunnygoyal@google.com> Fixing folder focus logic

> Folder items no longer remain in a linear order when a folder
gets rearranged, and se we need to use createSparseMatrix instead
of createFullArray. Also because of this we need to use getChildAt(x, y)
instead of getChildAt(index)
> Removing traces of AppsCustomizePage (all apps) from FocusHelper

Change-Id: I9007f6b95cb823e27ef4a43ce725fda8ef1b7cf8
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
ada50984dc149c1f4337f965fbb59bdeaac8d09f 10-Apr-2015 Hyunyoung Song <hyunyoungs@google.com> Focus handling - RTL support

- Support LEFT and RIGHT keys to work across workspaces when in RTL mode.
- Folder icons navigate correctly on DPAD_LEFT/RIGHT events
- Folder navigation across pages also works correctly
- Deleted dead code inside FocusHelper

b/20120358

Change-Id: I7f851cb7ed31f666a91b2f856458d7966ea5f712
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
18bfaafd3da45dce7b5f73eaa1665f228353338c 17-Mar-2015 Hyunyoung Song <hyunyoungs@google.com> key event focus logic should support large tablets

TL;DR;; On smaller tablets, landscape = vertical hotseat bar, and
portrait = horizontal hotseat bar. However, in larger tablets, hotseat bar is
always horizontal. This is now correctly handled using DeviceProfile.isVerticalBar
method.

b/19732584

Change-Id: I1035c89b4685be12dbc863f8a1465047a5fec6a6
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
38531719636eba7c924e3e71c583ebce2c89a1d0 04-Mar-2015 Hyunyoung Song <hyunyoungs@google.com> [key event focus] DPAD navigates to the nearest item on next/previous page
b/19381790
b/16351792

TL;DR;; Previously, when RIGHT is handled on the right most column of the
current page or when LEFT is handled on the left most column, the next
icon of focus is next page 'first' icon or the previous page 'last icon'.
With this change, the row information is preserved when trying to locate
an icon to give focus in the next/previous page.

Next CL: long awaited unit tests that capture corner cases for different
orientation/ device configuration.

Change-Id: I5278bed45275b3e4cb39fb698df35f90bb45a415
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
31178b8237ccb6af666df60ef60c116c8afdf316 24-Feb-2015 Hyunyoung Song <hyunyoungs@google.com> [key event focus handling] (1)hotseat <-> icon now symmetric, (2)support DEL keycode

TL;DR; (1) Key event navigation from and to the hotseat and icons in the workspace
is now symmetric. Since there is one more icon in the hotseat, only left
N-1 icon navigation was symmetric.

(2) KeyEvent.KEYCODE_DEL and KeyEvent.KEYCODE_FORWARD_DEL can now delete icons
from the workspace. The focus move to the previous icon where the focus
traveled from.

Also contains minor styling and indexing issues.

Bug: 15408321
Bug: 19381790

Change-Id: I16cbcb2693e92eebb830997d01c0bf674073dd51
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java
ee3e6a7b777e58552a26ab8a10641886588e9196 20-Feb-2015 Hyunyoung Song <hyunyoungs@google.com> [key event focus handling] Cleanup/Refactor/Feature
1) Focus navigation handling is refactored to Focus utility class.
New 2 step dpad navigation algorithm is inside Focus class
2) Introduced a map (or matrix) that indicates where sparse icons are located inside a grid.
This enables getting rid of the icon sorting logic which was costly.
3) Unified all the dpad handling logic inside the handleXXKeyEvent methods
4) DOWN/UP key will allow navigation between workspace icons and the hotseat
5) Folder icons allow DOWN/UP to navigate to the title

b/19381790

Change-Id: Id45b3f215ef7c1ca5f99b08e3d721e219298627a
/packages/apps/Launcher3/src/com/android/launcher3/util/FocusLogic.java