Merge "Handle more cases in FocusHelper#handleHotseatButtonKeyEvent()." into ub-launcher3-burnaby-polish
This commit is contained in:
@@ -174,7 +174,7 @@ public class FocusHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles key events in the workspace hot seat (bottom of the screen).
|
* Handles key events in the workspace hotseat (bottom of the screen).
|
||||||
* <p>Currently we don't special case for the phone UI in different orientations, even though
|
* <p>Currently we don't special case for the phone UI in different orientations, even though
|
||||||
* the hotseat is on the side in landscape mode. This is to ensure that accessibility
|
* the hotseat is on the side in landscape mode. This is to ensure that accessibility
|
||||||
* consistency is maintained across rotations.
|
* consistency is maintained across rotations.
|
||||||
@@ -263,12 +263,38 @@ public class FocusHelper {
|
|||||||
countY, matrix, iconIndex, pageIndex, pageCount, Utilities.isRtl(v.getResources()));
|
countY, matrix, iconIndex, pageIndex, pageCount, Utilities.isRtl(v.getResources()));
|
||||||
|
|
||||||
View newIcon = null;
|
View newIcon = null;
|
||||||
if (newIconIndex == FocusLogic.NEXT_PAGE_FIRST_ITEM) {
|
switch (newIconIndex) {
|
||||||
parent = getCellLayoutChildrenForIndex(workspace, pageIndex + 1);
|
case FocusLogic.NEXT_PAGE_FIRST_ITEM:
|
||||||
newIcon = parent.getChildAt(0);
|
parent = getCellLayoutChildrenForIndex(workspace, pageIndex + 1);
|
||||||
// TODO(hyunyoungs): handle cases where the child is not an icon but
|
newIcon = parent.getChildAt(0);
|
||||||
// a folder or a widget.
|
// TODO(hyunyoungs): handle cases where the child is not an icon but
|
||||||
workspace.snapToPage(pageIndex + 1);
|
// a folder or a widget.
|
||||||
|
workspace.snapToPage(pageIndex + 1);
|
||||||
|
break;
|
||||||
|
case FocusLogic.PREVIOUS_PAGE_FIRST_ITEM:
|
||||||
|
parent = getCellLayoutChildrenForIndex(workspace, pageIndex - 1);
|
||||||
|
newIcon = parent.getChildAt(0);
|
||||||
|
// TODO(hyunyoungs): handle cases where the child is not an icon but
|
||||||
|
// a folder or a widget.
|
||||||
|
workspace.snapToPage(pageIndex - 1);
|
||||||
|
break;
|
||||||
|
case FocusLogic.PREVIOUS_PAGE_LAST_ITEM:
|
||||||
|
parent = getCellLayoutChildrenForIndex(workspace, pageIndex - 1);
|
||||||
|
newIcon = parent.getChildAt(parent.getChildCount() - 1);
|
||||||
|
// TODO(hyunyoungs): handle cases where the child is not an icon but
|
||||||
|
// a folder or a widget.
|
||||||
|
workspace.snapToPage(pageIndex - 1);
|
||||||
|
break;
|
||||||
|
case FocusLogic.PREVIOUS_PAGE_LEFT_COLUMN:
|
||||||
|
case FocusLogic.PREVIOUS_PAGE_RIGHT_COLUMN:
|
||||||
|
// Go to the previous page but keep the focus on the same hotseat icon.
|
||||||
|
workspace.snapToPage(pageIndex - 1);
|
||||||
|
break;
|
||||||
|
case FocusLogic.NEXT_PAGE_LEFT_COLUMN:
|
||||||
|
case FocusLogic.NEXT_PAGE_RIGHT_COLUMN:
|
||||||
|
// Go to the next page but keep the focus on the same hotseat icon.
|
||||||
|
workspace.snapToPage(pageIndex + 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (parent == iconParent && newIconIndex >= iconParent.getChildCount()) {
|
if (parent == iconParent && newIconIndex >= iconParent.getChildCount()) {
|
||||||
newIconIndex -= iconParent.getChildCount();
|
newIconIndex -= iconParent.getChildCount();
|
||||||
@@ -368,7 +394,7 @@ public class FocusHelper {
|
|||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
iconLayout = (CellLayout) parent.getParent();
|
iconLayout = (CellLayout) parent.getParent();
|
||||||
matrix = FocusLogic.createSparseMatrix(iconLayout,
|
matrix = FocusLogic.createSparseMatrix(iconLayout,
|
||||||
iconLayout.getCountX(), row);
|
iconLayout.getCountX(), row);
|
||||||
newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX + 1, countY,
|
newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX + 1, countY,
|
||||||
matrix, FocusLogic.PIVOT, newPageIndex, pageCount,
|
matrix, FocusLogic.PIVOT, newPageIndex, pageCount,
|
||||||
Utilities.isRtl(v.getResources()));
|
Utilities.isRtl(v.getResources()));
|
||||||
|
|||||||
Reference in New Issue
Block a user