private boolean isRtl() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; } return false; } }
/** * @return True if the application is currently in RTL mode. */ public static boolean isRtl() { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; }
private int getDefaultVerticalScrollbarPosition() { final Locale locale = Locale.getDefault(); final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale); switch (layoutDirection) { case View.LAYOUT_DIRECTION_RTL: return View.SCROLLBAR_POSITION_LEFT; case View.LAYOUT_DIRECTION_LTR: default: return View.SCROLLBAR_POSITION_RIGHT; } } }
static public final PhotoPosition getDefaultPhotoPosition(boolean opposite) { final Locale locale = Locale.getDefault(); final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale); switch (layoutDirection) { case View.LAYOUT_DIRECTION_RTL: return (opposite ? PhotoPosition.LEFT : PhotoPosition.RIGHT); case View.LAYOUT_DIRECTION_LTR: default: return (opposite ? PhotoPosition.RIGHT : PhotoPosition.LEFT); } }
public DialpadView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Dialpad); mRippleColor = a.getColorStateList(R.styleable.Dialpad_dialpad_key_button_touch_tint); a.recycle(); mTranslateDistance = getResources().getDimensionPixelSize( R.dimen.dialpad_key_button_translate_y); mIsLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; mIsRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; }
float originTextWidth = Utils.getTextWidth(paint, mTitleTextView.getText().toString()); boolean isRTL = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL || mContainerView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;