FileDocCategorySizeDatePackage
RtlSpacingHelper.javaAPI DocAndroid 5.1 API2704Thu Mar 12 22:22:56 GMT 2015android.support.v7.internal.widget

RtlSpacingHelper

public class RtlSpacingHelper extends Object
RtlSpacingHelper manages the relationship between left/right and start/end for views that need to maintain both absolute and relative settings for a form of spacing similar to view padding.
hide

Fields Summary
public static final int
UNDEFINED
private int
mLeft
private int
mRight
private int
mStart
private int
mEnd
private int
mExplicitLeft
private int
mExplicitRight
private boolean
mIsRtl
private boolean
mIsRelative
Constructors Summary
Methods Summary
public intgetEnd()

        return mIsRtl ? mLeft : mRight;
    
public intgetLeft()


       
        return mLeft;
    
public intgetRight()

        return mRight;
    
public intgetStart()

        return mIsRtl ? mRight : mLeft;
    
public voidsetAbsolute(int left, int right)

        mIsRelative = false;
        if (left != UNDEFINED) mLeft = mExplicitLeft = left;
        if (right != UNDEFINED) mRight = mExplicitRight = right;
    
public voidsetDirection(boolean isRtl)

        if (isRtl == mIsRtl) {
            return;
        }
        mIsRtl = isRtl;
        if (mIsRelative) {
            if (isRtl) {
                mLeft = mEnd != UNDEFINED ? mEnd : mExplicitLeft;
                mRight = mStart != UNDEFINED ? mStart : mExplicitRight;
            } else {
                mLeft = mStart != UNDEFINED ? mStart : mExplicitLeft;
                mRight = mEnd != UNDEFINED ? mEnd : mExplicitRight;
            }
        } else {
            mLeft = mExplicitLeft;
            mRight = mExplicitRight;
        }
    
public voidsetRelative(int start, int end)

        mStart = start;
        mEnd = end;
        mIsRelative = true;
        if (mIsRtl) {
            if (end != UNDEFINED) mLeft = end;
            if (start != UNDEFINED) mRight = start;
        } else {
            if (start != UNDEFINED) mLeft = start;
            if (end != UNDEFINED) mRight = end;
        }