Java Code Examples for android.widget.TextView.getLayoutDirection()

The following are Jave code examples for showing how to use getLayoutDirection() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: boohee_v5.6   File: TextViewCompatJbMr1.java   Source Code and License Vote up 6 votes
public static void setCompoundDrawablesRelative(@NonNull TextView textView, @Nullable Drawable start, @Nullable Drawable top, @Nullable Drawable end, @Nullable Drawable bottom) {
    Drawable drawable;
    boolean rtl = true;
    if (textView.getLayoutDirection() != 1) {
        rtl = false;
    }
    if (rtl) {
        drawable = end;
    } else {
        drawable = start;
    }
    if (!rtl) {
        start = end;
    }
    textView.setCompoundDrawables(drawable, top, start, bottom);
}
 
Example 2
Project: boohee_v5.6   File: TextViewCompatJbMr1.java   Source Code and License Vote up 6 votes
public static void setCompoundDrawablesRelativeWithIntrinsicBounds(@NonNull TextView textView, @Nullable Drawable start, @Nullable Drawable top, @Nullable Drawable end, @Nullable Drawable bottom) {
    Drawable drawable;
    boolean rtl = true;
    if (textView.getLayoutDirection() != 1) {
        rtl = false;
    }
    if (rtl) {
        drawable = end;
    } else {
        drawable = start;
    }
    if (!rtl) {
        start = end;
    }
    textView.setCompoundDrawablesWithIntrinsicBounds(drawable, top, start, bottom);
}
 
Example 3
Project: boohee_v5.6   File: TextViewCompatJbMr1.java   Source Code and License Vote up 6 votes
public static void setCompoundDrawablesRelativeWithIntrinsicBounds(@NonNull TextView textView, int start, int top, int end, int bottom) {
    int i;
    boolean rtl = true;
    if (textView.getLayoutDirection() != 1) {
        rtl = false;
    }
    if (rtl) {
        i = end;
    } else {
        i = start;
    }
    if (!rtl) {
        start = end;
    }
    textView.setCompoundDrawablesWithIntrinsicBounds(i, top, start, bottom);
}