summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/FocusHelper.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-05-21 20:46:33 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-05-22 08:46:41 -0700
commitc6205603efe1f2987caf96504c87d720a25b5a94 (patch)
tree19a1c13def0784a3f3edc1e69aab87251820cbcf /src/com/android/launcher3/FocusHelper.java
parent2805e639cdea6ae0051155611d122ed27556e658 (diff)
downloadandroid_packages_apps_Trebuchet-c6205603efe1f2987caf96504c87d720a25b5a94.tar.gz
android_packages_apps_Trebuchet-c6205603efe1f2987caf96504c87d720a25b5a94.tar.bz2
android_packages_apps_Trebuchet-c6205603efe1f2987caf96504c87d720a25b5a94.zip
Creating landscape and portrait device profiles at app initialization
Change-Id: Ide9d007adc36b348e19b05cdf49e87f8b02db60e
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r--src/com/android/launcher3/FocusHelper.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java
index fe50e3a4e..46e4902f9 100644
--- a/src/com/android/launcher3/FocusHelper.java
+++ b/src/com/android/launcher3/FocusHelper.java
@@ -92,13 +92,12 @@ public class FocusHelper {
final int pageIndex = pagedView.indexOfChild(cellLayout);
final int pageCount = pagedView.getPageCount();
- Launcher launcher = (Launcher) v.getContext();
+ final boolean isLayoutRtl = Utilities.isRtl(v.getResources());
int[][] matrix = FocusLogic.createSparseMatrix(cellLayout);
// Process focus.
int newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX,
- countY, matrix, iconIndex, pageIndex, pageCount,
- launcher.getDeviceProfile().isLayoutRtl);
+ countY, matrix, iconIndex, pageIndex, pageCount, isLayoutRtl);
if (newIconIndex == FocusLogic.NOOP) {
handleNoopKey(keyCode, v);
return consume;
@@ -252,7 +251,7 @@ public class FocusHelper {
// Process the focus.
int newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX,
- countY, matrix, iconIndex, pageIndex, pageCount, profile.isLayoutRtl);
+ countY, matrix, iconIndex, pageIndex, pageCount, Utilities.isRtl(v.getResources()));
View newIcon = null;
if (newIconIndex == FocusLogic.NEXT_PAGE_FIRST_ITEM) {
@@ -335,7 +334,7 @@ public class FocusHelper {
// Process the focus.
int newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX,
- countY, matrix, iconIndex, pageIndex, pageCount, profile.isLayoutRtl);
+ countY, matrix, iconIndex, pageIndex, pageCount, Utilities.isRtl(v.getResources()));
View newIcon = null;
switch (newIconIndex) {
case FocusLogic.NOOP:
@@ -358,7 +357,8 @@ public class FocusHelper {
matrix = FocusLogic.createSparseMatrix(iconLayout,
iconLayout.getCountX(), row);
newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX + 1, countY,
- matrix, FocusLogic.PIVOT, newPageIndex, pageCount, profile.isLayoutRtl);
+ matrix, FocusLogic.PIVOT, newPageIndex, pageCount,
+ Utilities.isRtl(v.getResources()));
newIcon = parent.getChildAt(newIconIndex);
}
break;
@@ -391,7 +391,8 @@ public class FocusHelper {
iconLayout = (CellLayout) parent.getParent();
matrix = FocusLogic.createSparseMatrix(iconLayout, -1, row);
newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX + 1, countY,
- matrix, FocusLogic.PIVOT, newPageIndex, pageCount, profile.isLayoutRtl);
+ matrix, FocusLogic.PIVOT, newPageIndex, pageCount,
+ Utilities.isRtl(v.getResources()));
newIcon = parent.getChildAt(newIconIndex);
}
break;