Java Code Examples for android.view.View.LAYOUT_DIRECTION_LTR

The following are Jave code examples for showing how to use LAYOUT_DIRECTION_LTR of the android.view.View 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: firefox-tv   File: LocalizedContent.java   Source Code and License Vote up 6 votes
private static void putLayoutDirectionIntoMap(AmazonWebView webView, Map<String, String> substitutionMap) {
    ViewCompat.setLayoutDirection(webView, View.LAYOUT_DIRECTION_LOCALE);
    final int layoutDirection = ViewCompat.getLayoutDirection(webView);

    final String direction;

    if (layoutDirection == View.LAYOUT_DIRECTION_LTR) {
        direction = "ltr";
    } else if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
        direction = "rtl";
    } else {
        direction = "auto";
    }

    substitutionMap.put("%dir%", direction);
}
 
Example 2
Project: android_ui   File: ProgressDrawable.java   Source Code and License Vote up 5 votes
/**
 */
@Override
public boolean onLayoutDirectionChanged(int layoutDirection) {
	if (mProgressState.direction != layoutDirection) {
		switch (layoutDirection) {
			case View.LAYOUT_DIRECTION_LTR:
			case View.LAYOUT_DIRECTION_RTL:
				mProgressState.direction = layoutDirection;
				invalidateSelf();
				return true;
		}
	}
	return super.onLayoutDirectionChanged(layoutDirection);
}
 
Example 3
Project: ultrasonic   File: ViewHelper.java   Source Code and License Vote up 5 votes
public static int getLayoutDirection(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return v.getLayoutDirection();
    }

    return View.LAYOUT_DIRECTION_LTR;
}
 
Example 4
Project: MyLife   File: ViewHelper.java   Source Code and License Vote up 5 votes
@SuppressLint("NewApi")
static int getLayoutDirection(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return v.getLayoutDirection();
    }

    return View.LAYOUT_DIRECTION_LTR;
}
 
Example 5
Project: easyfilemanager   File: DocumentsActivity.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public int getGravity() {
    if(Utils.hasJellyBeanMR1()){
        Configuration config = getResources().getConfiguration();
        if(config.getLayoutDirection() != View.LAYOUT_DIRECTION_LTR){
            return Gravity.LEFT;
        }
    }
    return Gravity.RIGHT;
}
 
Example 6
Project: chromium-net-for-android   File: ApiCompatibilityUtils.java   Source Code and License Vote up 5 votes
/**
 * @see Configuration#getLayoutDirection()
 */
public static int getLayoutDirection(Configuration configuration) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return configuration.getLayoutDirection();
    } else {
        // All layouts are LTR before JB MR1.
        return View.LAYOUT_DIRECTION_LTR;
    }
}
 
Example 7
Project: Cybernet-VPN   File: ViewHelper.java   Source Code and License Vote up 5 votes
@SuppressLint("NewApi")
static int getLayoutDirection(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return v.getLayoutDirection();
    }

    return View.LAYOUT_DIRECTION_LTR;
}
 
Example 8
Project: PreviewSeekBar   File: PreviewAnimator.java   Source Code and License Vote up 5 votes
float getPreviewCenterX(int width) {
    float ltr = (((View) previewLayout).getWidth() - previewChildView.getWidth())
            * getWidthOffset(previewView.getProgress()) + previewChildView.getWidth() / 2f
            - width / 2f;
    float rtl = (((View) previewLayout).getWidth() - previewChildView.getWidth())
            * (1 - getWidthOffset(previewView.getProgress())) + previewChildView.getWidth() / 2f
            - width / 2f;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return ((View) previewView).getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ?
                ltr : rtl;
    } else {
        return ltr;
    }
}
 
Example 9
Project: PreviewSeekBar   File: PreviewAnimator.java   Source Code and License Vote up 5 votes
float getPreviewX() {
    float ltr = ((float) (((View) previewLayout).getWidth() - previewChildView.getWidth()))
            * getWidthOffset(previewView.getProgress());
    float rtl = ((float) (((View) previewLayout).getWidth() - previewChildView.getWidth()))
            * (1 - getWidthOffset(previewView.getProgress()));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return ((View) previewView).getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ?
                ltr : rtl;
    } else {
        return ltr;
    }
}
 
Example 10
Project: PreviewSeekBar-master   File: PreviewAnimator.java   Source Code and License Vote up 5 votes
float getPreviewCenterX(int width) {
    float ltr = (((View) previewLayout).getWidth() - previewChildView.getWidth())
            * getWidthOffset(previewView.getProgress()) + previewChildView.getWidth() / 2f
            - width / 2f;
    float rtl = (((View) previewLayout).getWidth() - previewChildView.getWidth())
            * (1 - getWidthOffset(previewView.getProgress())) + previewChildView.getWidth() / 2f
            - width / 2f;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return ((View) previewView).getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ?
                ltr : rtl;
    } else {
        return ltr;
    }
}
 
Example 11
Project: PreviewSeekBar-master   File: PreviewAnimator.java   Source Code and License Vote up 5 votes
float getPreviewX() {
    float ltr = ((float) (((View) previewLayout).getWidth() - previewChildView.getWidth()))
            * getWidthOffset(previewView.getProgress());
    float rtl = ((float) (((View) previewLayout).getWidth() - previewChildView.getWidth()))
            * (1 - getWidthOffset(previewView.getProgress()));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return ((View) previewView).getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ?
                ltr : rtl;
    } else {
        return ltr;
    }
}
 
Example 12
Project: FireFiles   File: DocumentsActivity.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public int getGravity() {
    if(Utils.hasJellyBeanMR1()){
        Configuration config = getResources().getConfiguration();
        if(config.getLayoutDirection() != View.LAYOUT_DIRECTION_LTR){
            return Gravity.LEFT;
        }
    }
    return Gravity.RIGHT;
}
 
Example 13
Project: simple-share-android   File: DocumentsActivity.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public int getGravity() {
    if(Utils.hasJellyBeanMR1()){
        Configuration config = getResources().getConfiguration();
        if(config.getLayoutDirection() != View.LAYOUT_DIRECTION_LTR){
            return Gravity.LEFT;
        }
    }
    return Gravity.RIGHT;
}
 
Example 14
Project: AndroidBlueprints   File: DisplayHelper.java   Source Code and License Vote up 5 votes
/**
 * Sets window layout rtl.
 */
public static void setWindowLayoutRtl(Activity activity) {
    if (activity.getWindow()
            .getDecorView()
            .getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
        activity.getWindow()
                .getDecorView()
                .setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
    }
}
 
Example 15
Project: HoldingButton   File: DirectionHelper.java   Source Code and License Vote up 5 votes
static LayoutDirection resolveLayoutDirection(HoldingButtonLayout view) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return LayoutDirection.LTR;
    }

    int rawDirection = view.getResources().getConfiguration().getLayoutDirection();
    if (rawDirection == View.LAYOUT_DIRECTION_LTR) {
        return LayoutDirection.LTR;
    } else {
        return LayoutDirection.RTL;
    }
}