本文整理汇总了Java中android.view.View.LAYOUT_DIRECTION_RTL属性的典型用法代码示例。如果您正苦于以下问题:Java View.LAYOUT_DIRECTION_RTL属性的具体用法?Java View.LAYOUT_DIRECTION_RTL怎么用?Java View.LAYOUT_DIRECTION_RTL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.View
的用法示例。
在下文中一共展示了View.LAYOUT_DIRECTION_RTL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putLayoutDirectionIntoMap
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);
}
示例2: onFocusSearch
@Override
public View onFocusSearch(View focused, int direction) {
if (focused != mTitleView && direction == View.FOCUS_UP) {
return mTitleView;
}
final boolean isRtl = ViewCompat.getLayoutDirection(focused) ==
View.LAYOUT_DIRECTION_RTL;
//final int forward = isRtl ? View.FOCUS_LEFT : View.FOCUS_RIGHT;
if (mTitleView.hasFocus() && direction == View.FOCUS_DOWN /*|| direction == forward*/) {
return mSceneRoot;
}
return null;
}
示例3: draw
public void draw(Canvas canvas) {
if (isVisible()) {
// Draw the fast scroller popup
int restoreCount = canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.translate(mBgBounds.left, mBgBounds.top);
mTmpRect.set(mBgBounds);
mTmpRect.offsetTo(0, 0);
mBackgroundPath.reset();
mBackgroundRect.set(mTmpRect);
float[] radii;
if (mRes.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
radii = new float[]{mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, 0, 0};
} else {
radii = new float[]{mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, 0, 0, mCornerRadius, mCornerRadius};
}
mBackgroundPath.addRoundRect(mBackgroundRect, radii, Path.Direction.CW);
mBackgroundPaint.setAlpha((int) (mAlpha * 255));
mTextPaint.setAlpha((int) (mAlpha * 255));
canvas.drawPath(mBackgroundPath, mBackgroundPaint);
canvas.drawText(mSectionName, (mBgBounds.width() - mTextBounds.width()) / 2,
mBgBounds.height() - (mBgBounds.height() - mTextBounds.height()) / 2,
mTextPaint);
canvas.restoreToCount(restoreCount);
}
}
示例4: isRTL
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private boolean isRTL() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return false;
}
Configuration config = getResources().getConfiguration();
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
示例5: attachToRecyclerView
public void attachToRecyclerView(@NonNull RecyclerView recyclerView) {
if (recyclerView != null) {
if ((gravity == Gravity.START || gravity == Gravity.END)
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
isRtlHorizontal
= recyclerView.getContext().getResources().getConfiguration()
.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
if (listener != null) {
recyclerView.addOnScrollListener(mScrollListener);
}
}
}
示例6: isRTL
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static boolean isRTL(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Configuration config = context.getResources().getConfiguration();
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
} else return false;
}
示例7: shouldStartDragging
private boolean shouldStartDragging(int x, int draggerWidth) {
Configuration c = getResources().getConfiguration();
switch (c.getLayoutDirection()) {
case View.LAYOUT_DIRECTION_RTL:
return (x >= (getWidth() - draggerWidth));
default:
return (x <= draggerWidth);
}
}
示例8: convertGravity
private static int convertGravity(View view, int gravity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
boolean isRtl = view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
if (gravity == Gravity.START) {
gravity = isRtl ? Gravity.RIGHT : Gravity.LEFT;
} else if (gravity == Gravity.END) {
gravity = isRtl ? Gravity.LEFT : Gravity.RIGHT;
}
}
return gravity;
}
示例9: createRelativeInsetDrawable
/**
* Creates an {@link android.graphics.drawable.InsetDrawable} according to the layout direction
* of {@code view}.
*/
public static InsetDrawable createRelativeInsetDrawable(Drawable drawable,
int insetStart, int insetTop, int insetEnd, int insetBottom, View view) {
boolean isRtl = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
&& view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
return createRelativeInsetDrawable(drawable, insetStart, insetTop, insetEnd, insetBottom,
isRtl);
}
示例10: isRtl
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static boolean isRtl(final Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return false;
} else {
return context.getResources().getConfiguration().getLayoutDirection()
== View.LAYOUT_DIRECTION_RTL;
}
}
示例11: performResizeAction
@Thunk void performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
CellLayout layout = (CellLayout) host.getParent().getParent();
layout.markCellsAsUnoccupiedForView(host);
if (action == R.string.action_increase_width) {
if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
&& layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
|| !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
lp.cellX --;
info.cellX --;
}
lp.cellHSpan ++;
info.spanX ++;
} else if (action == R.string.action_decrease_width) {
lp.cellHSpan --;
info.spanX --;
} else if (action == R.string.action_increase_height) {
if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
lp.cellY --;
info.cellY --;
}
lp.cellVSpan ++;
info.spanY ++;
} else if (action == R.string.action_decrease_height) {
lp.cellVSpan --;
info.spanY --;
}
layout.markCellsAsOccupiedForView(host);
Rect sizeRange = new Rect();
AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange);
((LauncherAppWidgetHostView) host).updateAppWidgetSize(null,
sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom);
host.requestLayout();
LauncherModel.updateItemInDatabase(mLauncher, info);
announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
}
示例12: setTextViewGravityStart
@SuppressLint("RtlHardcoded")
public static void setTextViewGravityStart(final @NonNull TextView textView, @NonNull Context context) {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
if (DynamicLanguage.getLayoutDirection(context) == View.LAYOUT_DIRECTION_RTL) {
textView.setGravity(Gravity.RIGHT);
} else {
textView.setGravity(Gravity.LEFT);
}
}
}
示例13: getBadgeBitmap
@Override
public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap,
int imageWidth, int imageHeight) {
if (info.isCustomWidget || info.getProfile().equals(android.os.Process.myUserHandle())) {
return bitmap;
}
// Add a user badge in the bottom right of the image.
final Resources res = mContext.getResources();
final int badgeMinTop = res.getDimensionPixelSize(R.dimen.profile_badge_minimum_top);
// choose min between badge size defined for widget tray versus width, height of the image.
// Width, height of the image can be smaller than widget tray badge size when being dropped
// to the workspace.
final int badgeSize = Math.min(res.getDimensionPixelSize(R.dimen.profile_badge_size),
Math.min(imageWidth, imageHeight - badgeMinTop));
final Rect badgeLocation = new Rect(0, 0, badgeSize, badgeSize);
final int top = Math.max(imageHeight - badgeSize, badgeMinTop);
if (res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
badgeLocation.offset(0, top);
} else {
badgeLocation.offset(bitmap.getWidth() - badgeSize, top);
}
Drawable drawable = mPm.getUserBadgedDrawableForDensity(
new BitmapDrawable(res, bitmap), info.getProfile(), badgeLocation, 0);
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
bitmap.eraseColor(Color.TRANSPARENT);
Canvas c = new Canvas(bitmap);
drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
drawable.draw(c);
c.setBitmap(null);
return bitmap;
}
示例14: isRTL
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private boolean isRTL() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
return false;
Configuration config = dialog.getBuilder().getContext().getResources().getConfiguration();
return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
示例15: isRTL
public static boolean isRTL(Configuration config) {
return (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
}