当前位置: 首页>>代码示例>>Java>>正文


Java View.LAYOUT_DIRECTION_RTL属性代码示例

本文整理汇总了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);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:16,代码来源:LocalizedContent.java

示例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;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:13,代码来源:TitleHelper.java

示例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);
    }
}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:31,代码来源:FastScrollPopup.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:MaterialAutoCompleteTextView.java

示例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);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:GravityDelegate.java

示例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;
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:7,代码来源:Util.java

示例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);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:9,代码来源:TouchInterceptor.java

示例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;
}
 
开发者ID:rumaan,项目名称:AcademApp,代码行数:11,代码来源:MaterialIn.java

示例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);
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:11,代码来源:DrawableLayoutDirectionHelper.java

示例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;
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:9,代码来源:UIUtils.java

示例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));
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:38,代码来源:LauncherAccessibilityDelegate.java

示例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);
    }
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:10,代码来源:ViewUtil.java

示例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;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:40,代码来源:AppWidgetManagerCompatVL.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DefaultRvAdapter.java

示例15: isRTL

public static boolean isRTL(Configuration config) {
    return (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:3,代码来源:Utils.java


注:本文中的android.view.View.LAYOUT_DIRECTION_RTL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。