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
This commit is contained in:
Hyunyoung Song
2015-03-17 11:32:21 -07:00
parent b4cd42a1df
commit 18bfaafd3d
3 changed files with 35 additions and 26 deletions
@@ -184,21 +184,18 @@ public class FocusLogic {
*/
// TODO: get rid of the dynamic matrix creation
public static int[][] createSparseMatrix(CellLayout iconLayout, CellLayout hotseatLayout,
int orientation, int allappsiconRank, boolean includeAllappsicon) {
boolean isHorizontal, int allappsiconRank, boolean includeAllappsicon) {
ViewGroup iconParent = iconLayout.getShortcutsAndWidgets();
ViewGroup hotseatParent = hotseatLayout.getShortcutsAndWidgets();
int m, n;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
if (isHorizontal) {
m = iconLayout.getCountX();
n = iconLayout.getCountY() + hotseatLayout.getCountY();
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else {
m = iconLayout.getCountX() + hotseatLayout.getCountX();
n = iconLayout.getCountY();
} else {
throw new IllegalStateException(String.format(
"orientation type=%d is not supported for key board events.", orientation));
}
int[][] matrix = createFullMatrix(m, n, false /* set all cell to empty */);
@@ -215,7 +212,7 @@ public class FocusLogic {
// is truncated. If it is negative, then all apps icon index is not inserted.
for(int i = hotseatParent.getChildCount() - 1; i >= (includeAllappsicon ? 0 : 1); i--) {
int delta = 0;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
if (isHorizontal) {
int cx = ((CellLayout.LayoutParams)
hotseatParent.getChildAt(i).getLayoutParams()).cellX;
if ((includeAllappsicon && cx >= allappsiconRank) ||
@@ -223,7 +220,7 @@ public class FocusLogic {
delta = -1;
}
matrix[cx + delta][iconLayout.getCountY()] = iconParent.getChildCount() + i;
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else {
int cy = ((CellLayout.LayoutParams)
hotseatParent.getChildAt(i).getLayoutParams()).cellY;
if ((includeAllappsicon && cy >= allappsiconRank) ||