diff options
author | 2014-08-29 19:19:10 +0000 | |
---|---|---|
committer | 2014-08-29 19:19:10 +0000 | |
commit | 0a829462d058401d0d01767ed0511d10cfd443a5 (patch) | |
tree | a2c7723cecbb36014c0c99884bbdf41c53f815fe /java/src/com/android/inputmethod/compat/ViewCompatUtils.java | |
parent | 2b44ba116a8d0926f7b4f5cae1b0306ac5e04a5c (diff) | |
parent | 2d713c87c67ee94ad9a069675e852ee1d02be949 (diff) | |
download | latinime-0a829462d058401d0d01767ed0511d10cfd443a5.tar.gz latinime-0a829462d058401d0d01767ed0511d10cfd443a5.tar.xz latinime-0a829462d058401d0d01767ed0511d10cfd443a5.zip |
am 2d713c87: am 2fabd50d: am f507d1fe: Support RTL layout in custom input style settings
* commit '2d713c87c67ee94ad9a069675e852ee1d02be949':
Support RTL layout in custom input style settings
Diffstat (limited to 'java/src/com/android/inputmethod/compat/ViewCompatUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/compat/ViewCompatUtils.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/compat/ViewCompatUtils.java b/java/src/com/android/inputmethod/compat/ViewCompatUtils.java index afbe8c890..0f00be133 100644 --- a/java/src/com/android/inputmethod/compat/ViewCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/ViewCompatUtils.java @@ -34,6 +34,9 @@ public final class ViewCompatUtils { // Note that View.setElevation(float) has been introduced in API level 21. private static final Method METHOD_setElevation = CompatUtils.getMethod( View.class, "setElevation", float.class); + // Note that View.setTextAlignment(int) has been introduced in API level 17. + private static final Method METHOD_setTextAlignment = CompatUtils.getMethod( + View.class, "setTextAlignment", int.class); private ViewCompatUtils() { // This utility class is not publicly instantiable. @@ -56,9 +59,19 @@ public final class ViewCompatUtils { } public static void setElevation(final View view, final float elevation) { - if (METHOD_setElevation == null) { - return; - } CompatUtils.invoke(view, null, METHOD_setElevation, elevation); } + + // These TEXT_ALIGNMENT_* constants have been introduced in API 17. + public static final int TEXT_ALIGNMENT_INHERIT = 0; + public static final int TEXT_ALIGNMENT_GRAVITY = 1; + public static final int TEXT_ALIGNMENT_TEXT_START = 2; + public static final int TEXT_ALIGNMENT_TEXT_END = 3; + public static final int TEXT_ALIGNMENT_CENTER = 4; + public static final int TEXT_ALIGNMENT_VIEW_START = 5; + public static final int TEXT_ALIGNMENT_VIEW_END = 6; + + public static void setTextAlignment(final View view, final int textAlignment) { + CompatUtils.invoke(view, null, METHOD_setTextAlignment, textAlignment); + } } |