Example usage for android.view View LAYOUT_DIRECTION_RTL

List of usage examples for android.view View LAYOUT_DIRECTION_RTL

Introduction

In this page you can find the example usage for android.view View LAYOUT_DIRECTION_RTL.

Prototype

int LAYOUT_DIRECTION_RTL

To view the source code for android.view View LAYOUT_DIRECTION_RTL.

Click Source Link

Document

Horizontal layout direction of this view is from Right to Left.

Usage

From source file:com.metinkale.prayerapp.BaseActivity.java

protected boolean isRTL() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return false;
    }/*from   w ww .j  a  v  a 2  s. c o  m*/
    Configuration config = getResources().getConfiguration();
    return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}

From source file:com.android.messaging.ui.ViewPagerTabs.java

private int getRtlPosition(int position) {
    if (OsUtil.isAtLeastJB_MR2() && Factory.get().getApplicationContext().getResources().getConfiguration()
            .getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        return mTabStrip.getChildCount() - 1 - position;
    }/*from   w w  w.  j  av a 2s . c o m*/
    return position;
}

From source file:com.frozendevs.periodictable.view.ViewPagerTabs.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private int getRtlPosition(int position) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        if (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
            return mTabStrip.getChildCount() - 1 - position;
        }//  w  ww  .  j  a  v a 2s  .com
    }

    return position;
}

From source file:com.example.client.activity.imported.FlexibleSpaceWithImageWithViewPagerTabActivity.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void setPivotXToTitle(View view) {
    final TextView mTitleView = (TextView) view.findViewById(R.id.title);
    Configuration config = getResources().getConfiguration();
    if (Build.VERSION_CODES.JELLY_BEAN_MR1 <= Build.VERSION.SDK_INT
            && config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        ViewHelper.setPivotX(mTitleView, view.findViewById(android.R.id.content).getWidth());
    } else {//  w w w . ja  v  a2s  . com
        ViewHelper.setPivotX(mTitleView, 0);
    }
}

From source file:org.chromium.chrome.browser.widget.MaterialProgressBar.java

private void drawRect(Canvas canvas, Paint paint, float start, float end) {
    if (ViewCompat.getLayoutDirection(this) == View.LAYOUT_DIRECTION_RTL) {
        int width = canvas.getWidth();
        float rtlStart = width - end;
        float rtlEnd = width - start;
        canvas.drawRect(rtlStart, 0, rtlEnd, canvas.getHeight(), paint);
    } else {/*from ww  w.j a v  a  2s  . c  om*/
        canvas.drawRect(start, 0, end, canvas.getHeight(), paint);
    }
}

From source file:com.pdftron.pdf.utils.Utils.java

public static boolean isRtlLayout(Context context) {
    if (isJellyBeanMR1()) {
        Configuration config = context.getResources().getConfiguration();
        if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
            return true;
        }//from   w ww  . jav  a  2  s.  com
    }
    return false;
}

From source file:com.github.andrewlord1990.materialandroid.component.textfield.PasswordEditText.java

@TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
private boolean isLeftToRightLayoutDirection() {
    Configuration config = getResources().getConfiguration();
    return config.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL;
}

From source file:com.aaa.activity.main.MainActivity.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void setPivotXToTitle(View view) {
    final EditText mTitleView = (EditText) view.findViewById(R.id.title);
    Configuration config = getResources().getConfiguration();
    if (Build.VERSION_CODES.JELLY_BEAN_MR1 <= Build.VERSION.SDK_INT
            && config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        ViewHelper.setPivotX(mTitleView, view.findViewById(android.R.id.content).getWidth());
    } else {/*  w ww.  j  av  a  2  s .  c o  m*/
        ViewHelper.setPivotX(mTitleView, -1);
    }
}

From source file:com.android.contacts.common.list.ViewPagerTabs.java

private int getRtlPosition(int position) {
    if (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        return mTabStrip.getChildCount() - 1 - position;
    }// w  w w  .j  av  a 2 s.  c o m
    return position;
}

From source file:com.android.tv.settings.accessories.AddAccessoryActivity.java

@Override
protected void onStart() {
    super.onStart();

    if (DEBUG) {//from  ww w.j  a va 2  s  .c om
        Log.d(TAG, "onStart() mPairingInBackground = " + mPairingInBackground);
    }

    // Only do the following if we are not coming back to this activity from
    // the Secure Pairing activity.
    if (!mPairingInBackground) {
        if (mAnimateOnStart) {
            mAnimateOnStart = false;
            ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
            mTopLayout = (FrameLayout) contentView.getChildAt(0);

            // Fade out the old activity, and fade in the new activity.
            overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

            // Set the activity background
            int bgColor = getResources().getColor(R.color.dialog_activity_background);
            getBackgroundDrawable().setColor(bgColor);
            mTopLayout.setBackground(getBackgroundDrawable());

            // Delay the rest of the changes until the first layout event
            mTopLayout.getViewTreeObserver()
                    .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                        @Override
                        public void onGlobalLayout() {
                            mTopLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);

                            // set the Action and Content fragments to their start offsets
                            mActionView = findViewById(R.id.action_fragment);
                            mContentView = findViewById(R.id.content_fragment);
                            if (mActionView != null) {
                                mViewOffset = mActionView.getMeasuredWidth();
                                int offset = (ViewCompat
                                        .getLayoutDirection(mActionView) == View.LAYOUT_DIRECTION_RTL)
                                                ? -mViewOffset
                                                : mViewOffset;
                                mActionView.setTranslationX(offset);
                                mContentView.setTranslationX(offset / 2);
                            }
                            mAutoPairText = (TextView) findViewById(R.id.autopair_message);
                            if (mAutoPairText != null) {
                                mAutoPairText.setVisibility(View.GONE);
                            }
                            updateView();
                        }
                    });
        }

        startBluetoothPairer();

        mStartTime = SystemClock.elapsedRealtime();
    }

    mPairingInBackground = false;
}