diff options
author | newt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-06 20:54:45 +0000 |
---|---|---|
committer | newt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-06 20:54:45 +0000 |
commit | 36e78a82368a4b0b6d02cc0707bfcfaa888346de (patch) | |
tree | 3f4f2e7dd8ef4c443f007466e8422ca69eabfe6a /base/android | |
parent | 4dd0b510634b8d4bf8f8c30ee04b788c995e40c5 (diff) | |
download | chromium_src-36e78a82368a4b0b6d02cc0707bfcfaa888346de.zip chromium_src-36e78a82368a4b0b6d02cc0707bfcfaa888346de.tar.gz chromium_src-36e78a82368a4b0b6d02cc0707bfcfaa888346de.tar.bz2 |
Add isLayoutRtl() to ApiCompatibilityUtils.java.
This addresses the possible bug with using getLayoutDirection() on
pre-JB MR1 devices mentioned in http://crbug.com/245224#c6
BUG=245224
R=yfriedman@chromium.org
Review URL: https://codereview.chromium.org/16596002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android')
-rw-r--r-- | base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java index 0116c9b..f296665 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) { |