Focus doesn't leave folders without also closing them.

- Pressing Tab wraps around to the first item from the folder name,
  and vice versa when pressing Shift+Tab.
- When tapping off the folder while editing the text, the folder
  requests focus. We handle the following cases from that state:
    - Pressing an arrow key or Tab gives focus to the first item.
    - Pressing Shift+Tab gives focus to the last item.
- Fix slight corner case where moving from folder name to an item
  didn't update mIsEditingName to false. So when clicking off of
  the folder, it gave focus to the folder (as mentioned above)
  instead of closing the folder like it usually does when icons are
  focused. Not a huge deal, but still worth fixing.
Bug: 25687579
Change-Id: I1bec844c8ccd09529a11b9e3a1d92b3bdf7b2eb3
This commit is contained in:
Tony Wickham committed 2015-11-20 15:08:55 -08:00
1 parent a43f78fc4b
commit feec2171f8
2 files changed
+47 -10

No files matched your search

+16 -4
View File
@@ -402,16 +402,28 @@ public class FolderPagedView extends PagedView {
return !ALLOW_FOLDER_SCROLL && getItemCount() >= mMaxItemsPerPage;
}
public View getFirstItem() {
if (getChildCount() < 1) {
return null;
}
ShortcutAndWidgetContainer currContainer = getCurrentCellLayout().getShortcutsAndWidgets();
if (mGridCountX > 0) {
return currContainer.getChildAt(0, 0);
} else {
return currContainer.getChildAt(0);
}
}
public View getLastItem() {
if (getChildCount() < 1) {
return null;
}
ShortcutAndWidgetContainer lastContainer = getCurrentCellLayout().getShortcutsAndWidgets();
int lastRank = lastContainer.getChildCount() - 1;
ShortcutAndWidgetContainer currContainer = getCurrentCellLayout().getShortcutsAndWidgets();
int lastRank = currContainer.getChildCount() - 1;
if (mGridCountX > 0) {
return lastContainer.getChildAt(lastRank % mGridCountX, lastRank / mGridCountX);
return currContainer.getChildAt(lastRank % mGridCountX, lastRank / mGridCountX);
} else {
return lastContainer.getChildAt(lastRank);
return currContainer.getChildAt(lastRank);
}
}