Index: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java |
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java |
index 0116c9b381cba496940ab283e7743d25a25c9136..f29666582235ebfdec77701c492313f1143e65c3 100644 |
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java |
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java |
@@ -20,6 +20,20 @@ public class ApiCompatibilityUtils { |
} |
/** |
+ * Returns true if view's layout direction is right-to-left. |
+ * |
+ * @param view the View whose layout is being considered |
+ */ |
+ public static boolean isLayoutRtl(View view) { |
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { |
+ return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; |
+ } else { |
+ // All layouts are LTR before JB MR1. |
+ return false; |
+ } |
+ } |
+ |
+ /** |
* @see android.view.View#setLayoutDirection(int) |
*/ |
public static void setLayoutDirection(View view, int layoutDirection) { |