Example usage for android.text TextUtils getLayoutDirectionFromLocale

List of usage examples for android.text TextUtils getLayoutDirectionFromLocale

Introduction

In this page you can find the example usage for android.text TextUtils getLayoutDirectionFromLocale.

Prototype

public static int getLayoutDirectionFromLocale(Locale locale) 

Source Link

Document

Return the layout direction for a given Locale

Usage

From source file:com.geecko.QuickLyric.adapter.IntroScreenSlidePagerAdapter.java

public IntroScreenSlidePagerAdapter(FragmentManager fm, final Activity activity) {
    super(fm);/*from w ww.  j a  v a 2s . c  om*/
    this.mActivity = activity;
    mPager = ((ViewPager) mActivity.findViewById(R.id.pager));
    mPager.setOnTouchListener(exitTouchListener);
    if (Build.VERSION.SDK_INT >= 17)
        rightToLeft = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == 1;
    if (rightToLeft) {
        List<Integer> list = Arrays.asList(colors);
        Collections.reverse(list);
        colors = (Integer[]) list.toArray();
    }
    ImageButton pagerArrow = ((ImageButton) mActivity.findViewById(R.id.pager_arrow));
    Button okButton = ((Button) mActivity.findViewById(R.id.pager_ok));
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !Tutorial_5.nlEnabled) {
                final ViewGroup nlFrame = (ViewGroup) activity.findViewById(R.id.NL_frame);
                final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
                        Color.parseColor("#30000000"), Color.parseColor("#80FFFFFF"));
                colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    @Override
                    public void onAnimationUpdate(ValueAnimator animation) {
                        nlFrame.setBackgroundColor((int) animation.getAnimatedValue());
                    }
                });
                colorAnimation.setInterpolator(new LinearOutSlowInInterpolator());
                colorAnimation.setRepeatCount(3);
                colorAnimation.setRepeatMode(ValueAnimator.REVERSE);
                colorAnimation.setDuration(650L);
                colorAnimation.start();
            } else if (!hasClicked) {
                exitAction();
                hasClicked = true;
            }
        }
    });
    pagerArrow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            nextAction();
        }
    });
}

From source file:android.text.BidiFormatter.java

/**
 * Helper method to return true if the Locale directionality is RTL.
 *
 * @param locale The Locale whose directionality will be checked to be RTL or LTR
 * @return true if the {@code locale} directionality is RTL. False otherwise.
 *///  ww w . j a  v  a  2 s .  co  m
private static boolean isRtlLocale(Locale locale) {
    return (TextUtils.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL);
}

From source file:com.betterAlarm.deskclock.DeskClock.java

private boolean isRtl() {
    return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
}

From source file:com.yangtsaosoftware.pebblemessenger.services.MessageProcessingService.java

private boolean isRTL() {
    Locale myLocal = Locale.getDefault();
    return (TextUtils.getLayoutDirectionFromLocale(myLocal) == View.LAYOUT_DIRECTION_RTL ? true : false);
    //return true;
}

From source file:com.android.contacts.activities.PeopleActivity.java

private boolean isRTL() {
    final Locale locale = Locale.getDefault();
    return TextUtils.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL;
}

From source file:com.android.contacts.list.DefaultContactBrowseListFragment.java

private int getScrollBarPosition() {
    final Locale locale = Locale.getDefault();
    final boolean isRTL = TextUtils.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL;
    return isRTL ? View.SCROLLBAR_POSITION_LEFT : View.SCROLLBAR_POSITION_RIGHT;
}