summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-12-04 12:09:59 -0800
committerDanesh M <daneshm90@gmail.com>2014-06-06 22:54:21 -0700
commit7b166877a4d5b6058047e4df517ddfa7cd4dc9f5 (patch)
tree8e6bbeba055ef1f628b70f7731b6e1f458ece16f /src
parentfc51446bff87a88b0ff1a8e54133f81ae15a47da (diff)
downloadandroid_packages_apps_Trebuchet-7b166877a4d5b6058047e4df517ddfa7cd4dc9f5.tar.gz
android_packages_apps_Trebuchet-7b166877a4d5b6058047e4df517ddfa7cd4dc9f5.tar.bz2
android_packages_apps_Trebuchet-7b166877a4d5b6058047e4df517ddfa7cd4dc9f5.zip
Restoring Hotseat to the left-aligned in RTL. (Bug 11451335)
Change-Id: I5451b1281e3f346f51677040775ae7bf76e303d1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index e456a3bc6..b249fb305 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -75,6 +75,7 @@ public class DeviceProfile {
boolean isLandscape;
boolean isTablet;
boolean isLargeTablet;
+ boolean isLayoutRtl;
boolean transposeLayoutWithOrientation;
int desiredWorkspaceLeftRightMarginPx;
@@ -373,10 +374,11 @@ public class DeviceProfile {
void updateFromConfiguration(Context context, Resources resources, int wPx, int hPx,
int awPx, int ahPx) {
- isLandscape = (resources.getConfiguration().orientation ==
- Configuration.ORIENTATION_LANDSCAPE);
+ Configuration configuration = resources.getConfiguration();
+ isLandscape = (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE);
isTablet = resources.getBoolean(R.bool.is_tablet);
isLargeTablet = resources.getBoolean(R.bool.is_large_tablet);
+ isLayoutRtl = (configuration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
widthPx = wPx;
heightPx = hPx;
availableWidthPx = awPx;
@@ -454,7 +456,13 @@ public class DeviceProfile {
Rect bounds = new Rect();
if (orientation == CellLayout.LANDSCAPE &&
transposeLayoutWithOrientation) {
- bounds.set(0, edgeMarginPx, searchBarVisible ? searchBarSpaceHeightPx : edgeMarginPx, availableHeightPx - edgeMarginPx);
+ if (isLayoutRtl) {
+ bounds.set(availableWidthPx - searchBarSpaceHeightPx, edgeMarginPx,
+ availableWidthPx, availableHeightPx - edgeMarginPx);
+ } else {
+ bounds.set(0, edgeMarginPx, searchBarSpaceHeightPx,
+ availableHeightPx - edgeMarginPx);
+ }
} else {
if (isTablet()) {
// Pad the left and right of the workspace to ensure consistent spacing
@@ -489,8 +497,13 @@ public class DeviceProfile {
if (orientation == CellLayout.LANDSCAPE &&
transposeLayoutWithOrientation) {
// Pad the left and right of the workspace with search/hotseat bar sizes
- padding.set(searchBarBounds.right, edgeMarginPx,
- hotseatBarHeightPx, edgeMarginPx);
+ if (isLayoutRtl) {
+ padding.set(hotseatBarHeightPx, edgeMarginPx,
+ searchBarBounds.width(), edgeMarginPx);
+ } else {
+ padding.set(searchBarBounds.width(), edgeMarginPx,
+ hotseatBarHeightPx, edgeMarginPx);
+ }
} else {
if (isTablet()) {
// Pad the left and right of the workspace to ensure consistent spacing
@@ -650,7 +663,7 @@ public class DeviceProfile {
lp = (FrameLayout.LayoutParams) hotseat.getLayoutParams();
if (hasVerticalBarLayout) {
// Vertical hotseat
- lp.gravity = Gravity.RIGHT;
+ lp.gravity = Gravity.END;
lp.width = hotseatBarHeightPx;
lp.height = LayoutParams.MATCH_PARENT;
hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx);