summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/util
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-03-17 11:32:21 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-03-17 11:32:21 -0700
commit18bfaafd3da45dce7b5f73eaa1665f228353338c (patch)
tree073359b6fde40437e81f6eca493f0a84177957b7 /src/com/android/launcher3/util
parentb4cd42a1df69ec887d0c66e8fe6fe1f27ebbf9bc (diff)
downloadandroid_packages_apps_Trebuchet-18bfaafd3da45dce7b5f73eaa1665f228353338c.tar.gz
android_packages_apps_Trebuchet-18bfaafd3da45dce7b5f73eaa1665f228353338c.tar.bz2
android_packages_apps_Trebuchet-18bfaafd3da45dce7b5f73eaa1665f228353338c.zip
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
Diffstat (limited to 'src/com/android/launcher3/util')
-rw-r--r--src/com/android/launcher3/util/FocusLogic.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/com/android/launcher3/util/FocusLogic.java b/src/com/android/launcher3/util/FocusLogic.java
index 0c6bfbf35..6e80c2f21 100644
--- a/src/com/android/launcher3/util/FocusLogic.java
+++ b/src/com/android/launcher3/util/FocusLogic.java
@@ -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) ||