Java 类android.support.annotation.DimenRes 实例源码

项目:shortstories    文件:BitmapUtil.java   
private static Bitmap getEmoji(
        Context context, String emoji, @DimenRes int sizeResId, @DimenRes int insetResId) {
    if (context == null || TextUtils.isEmpty(emoji)) {
        return null;
    }
    int size = context.getResources().getDimensionPixelSize(sizeResId);
    int inset = context.getResources().getDimensionPixelSize(insetResId);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    paint.setTextAlign(Paint.Align.LEFT);
    paint.setTextSize(size);
    float baseline = -paint.ascent();
    int width = (int) (paint.measureText(emoji) + 0.5f);
    int height = (int) (baseline + paint.descent() + 0.5f);
    Bitmap bitmap = Bitmap.createBitmap(width + inset * 2, height + inset * 2, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawText(emoji, inset, baseline + inset, paint);
    return bitmap;
}
项目:music-player    文件:CharacterDrawable.java   
public static CharacterDrawable create(Context context, char character, boolean roundAsCircle, @DimenRes int padding) {
    return new CharacterDrawable.Builder()
            .setCharacter(character)
            .setBackgroundRoundAsCircle(roundAsCircle)
            .setCharacterPadding(context.getResources().getDimensionPixelSize(padding))
            .build();
}
项目:ShadowFrameLayout    文件:ShadowFrameLayout.java   
public void setShadowsHeightDimens(@DimenRes int left, @DimenRes int top, @DimenRes int right, @DimenRes int bottom) {
    mShadowLeftHeight = mResources.getDimensionPixelOffset(left);
    mShadowTopHeight = mResources.getDimensionPixelOffset(top);
    mShadowRightHeight = mResources.getDimensionPixelOffset(right);
    mShadowBottomHeight = mResources.getDimensionPixelOffset(bottom);
    invalidate();
}
项目:SkinFramework    文件:ComposedResources.java   
@Override
public float getDimension(@DimenRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getDimension(realId);
    }
    return super.getDimension(id);
}
项目:SkinFramework    文件:ComposedResources.java   
@Override
public int getDimensionPixelSize(@DimenRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getDimensionPixelSize(realId);
    }
    return super.getDimensionPixelSize(id);
}
项目:LiteReader    文件:ButtonViewModel.java   
public Builder margin(@DimenRes int commonMargin) {
    margin.add(commonMargin);
    margin.add(commonMargin);
    margin.add(commonMargin);
    margin.add(commonMargin);
    return this;
}
项目:Nird2    文件:AuthorView.java   
private void setAvatarSize(@DimenRes int res) {
    LayoutParams params = (LayoutParams) avatar.getLayoutParams();
    int size = getResources().getDimensionPixelSize(res);
    params.height = size;
    params.width = size;
    avatar.setLayoutParams(params);
}
项目:Nird2    文件:AuthorView.java   
private void setAvatarSize(@DimenRes int res) {
    LayoutParams params = (LayoutParams) avatar.getLayoutParams();
    int size = getResources().getDimensionPixelSize(res);
    params.height = size;
    params.width = size;
    avatar.setLayoutParams(params);
}
项目:imageviewer    文件:ImageViewer.java   
/**
 * Set {@code start}, {@code top}, {@code end} and {@code bottom} padding for zooming and scrolling area using dimension.
 *
 * @return This Builder object to allow for chaining of calls to set methods
 */
public Builder setContainerPadding(Context context,
                                   @DimenRes int start, @DimenRes int top,
                                   @DimenRes int end, @DimenRes int bottom) {
    setContainerPaddingPx(
            Math.round(context.getResources().getDimension(start)),
            Math.round(context.getResources().getDimension(top)),
            Math.round(context.getResources().getDimension(end)),
            Math.round(context.getResources().getDimension(bottom))
    );
    return this;
}
项目:NoInternetDialog    文件:NoInternetDialog.java   
public Builder setDialogRadius(@DimenRes int dialogRadiusDimen) {
    this.dialogRadius = context.getResources().getDimensionPixelSize(dialogRadiusDimen);
    return this;
}
项目:GitHub    文件:FlexibleDividerDecoration.java   
public T sizeResId(@DimenRes int sizeId) {
    return size(mResources.getDimensionPixelSize(sizeId));
}
项目:FastLib    文件:FastMultiStatusView.java   
public Builder setErrorTextSizeResource(@DimenRes int mErrorTextSizeRes) {
    return setErrorTextSize(getDimensionPixelSize(mErrorTextSizeRes));
}
项目:AppFirCloud    文件:HorizontalDividerItemDecoration.java   
public Builder marginResId(@DimenRes int leftMarginId, @DimenRes int rightMarginId) {
    return margin(mResources.getDimensionPixelSize(leftMarginId),
            mResources.getDimensionPixelSize(rightMarginId));
}
项目:AppFirCloud    文件:VerticalDividerItemDecoration.java   
public Builder marginResId(@DimenRes int topMarginId, @DimenRes int bottomMarginId) {
    return margin(mResources.getDimensionPixelSize(topMarginId),
            mResources.getDimensionPixelSize(bottomMarginId));
}
项目:boohee_v5.6    文件:RoundedImageView.java   
public void setCornerRadiusDimen(@DimenRes int resId) {
    float radius = getResources().getDimension(resId);
    setCornerRadius(radius, radius, radius, radius);
}
项目:FastLib    文件:FastMultiStatusView.java   
public Builder setNoNetTextSizeResource(@DimenRes int mNoNetTextSizeRes) {
    return setNoNetTextSize(getDimensionPixelSize(mNoNetTextSizeRes));
}
项目:GitHub    文件:VerticalDividerItemDecoration.java   
public Builder marginResId(@DimenRes int verticalMarginId) {
    return marginResId(verticalMarginId, verticalMarginId);
}
项目:AppFirCloud    文件:FlexibleDividerDecoration.java   
public T sizeResId(@DimenRes int sizeId) {
    return size(mResources.getDimensionPixelSize(sizeId));
}
项目:GitHub    文件:MaterialSimpleListItem.java   
public Builder iconPaddingRes(@DimenRes int paddingRes) {
    return iconPadding(context.getResources().getDimensionPixelSize(paddingRes));
}
项目:ShadowFrameLayout    文件:ShadowFrameLayout.java   
public void setLeftShadowDimens(@DimenRes int resource) {
    mShadowLeftHeight = mResources.getDimensionPixelOffset(resource);
    invalidate();
}
项目:RLibrary    文件:UIIViewImpl.java   
public int getDimensionPixelOffset(@DimenRes int id) {
    return getResources().getDimensionPixelOffset(id);
}
项目:ShadowFrameLayout    文件:ShadowFrameLayout.java   
public void setTopShadowDimens(@DimenRes int resource) {
    mShadowTopHeight = mResources.getDimensionPixelOffset(resource);
    invalidate();
}
项目:shareNote    文件:RoundedImageView.java   
public void setBorderWidth(@DimenRes int resId) {
  setBorderWidth(getResources().getDimension(resId));
}
项目:Pluto-Android    文件:BitmapDisplayConfig.java   
public static BitmapDisplayConfig getDefaultUserAvatarConfigByDpRes(Context context, @DimenRes int dpRes) {
    int dp2px = context.getResources().getDimensionPixelSize(dpRes);
    return getDefaultUserAvatarConfig(context, dp2px);
}
项目:RendererRecyclerViewAdapter    文件:ItemOffsetDecoration.java   
public ItemOffsetDecoration(@NonNull Context context, @DimenRes int itemOffsetId) {
    this(context.getResources().getDimensionPixelSize(itemOffsetId));
}
项目:LiteReader    文件:BlankViewModel.java   
public BlankViewModel(@DimenRes int height) {
    this.height = height;
}
项目:boohee_v5.6    文件:RoundedImageView.java   
public void setCornerRadiusDimen(int corner, @DimenRes int resId) {
    setCornerRadius(corner, (float) getResources().getDimensionPixelSize(resId));
}
项目:LiteReader    文件:HeaderItemViewModel.java   
public HeaderItemViewModel textSize(@DimenRes int testSize) {
    this.textSize = testSize;
    return this;
}
项目:CustomListView    文件:DensityUtils.java   
public static int getDimens(Context context, @DimenRes int resource) {
    Resources mResources = context.getResources();
    return mResources.getDimensionPixelSize(resource);
}
项目:quickblox-android    文件:VideoConversationFragment.java   
public DividerItemDecoration(@NonNull Context context, @DimenRes int dimensionDivider) {
    this.space = context.getResources().getDimensionPixelSize(dimensionDivider);
}
项目:quickblox-android    文件:ResourceUtils.java   
public static int getDimen(@DimenRes int dimenId) {
    return (int) CoreApp.getInstance().getResources().getDimension(dimenId);
}
项目:androidgithub    文件:FlexibleDividerDecoration.java   
public T sizeResId(@DimenRes int sizeId) {
    return size(mResources.getDimensionPixelSize(sizeId));
}
项目:FastLib    文件:FastMultiStatusView.java   
public Builder setEmptyTextSizeResource(@DimenRes int mEmptyTextSizeRes) {
    return setEmptyTextSize(getDimensionPixelSize(mEmptyTextSizeRes));
}
项目:imageviewer    文件:ImageViewer.java   
/**
 * Set common padding for zooming and scrolling area using dimension.
 *
 * @return This Builder object to allow for chaining of calls to set methods
 */
public Builder setContainerPadding(Context context, @DimenRes int padding) {
    int paddingPx = Math.round(context.getResources().getDimension(padding));
    setContainerPaddingPx(paddingPx, paddingPx, paddingPx, paddingPx);
    return this;
}
项目:ContactLoader    文件:LineDividerItemDecoration.java   
public void setHorizontalPadding(@DimenRes int horizontalPadding) {
    this.horizontalPadding = mContext.getResources().getDimensionPixelSize(horizontalPadding);
}
项目:FastLib    文件:FastLoadMoreView.java   
public Builder setLoadFailTextSizeResource(@DimenRes int mLoadFailTextSizeRes) {
    return setLoadFailTextSize(getDimensionPixelSize(mLoadFailTextSizeRes));
}
项目:RX_Demo    文件:VerticalDividerItemDecoration.java   
public Builder marginResId(@DimenRes int verticalMarginId) {
    return marginResId(verticalMarginId, verticalMarginId);
}
项目:Pocket-Plays-for-Twitch    文件:IntroductoryOverlay.java   
/**
 * Sets the radius of the "hole" around the cast button. This will override the value
 * specified in the resource file and is optional.
 */
public Builder setFocusRadiusId(@DimenRes int radiusId) {
    mRadius = mContext.getResources().getDimension(radiusId);
    return this;
}
项目:RX_Demo    文件:HorizontalDividerItemDecoration.java   
public Builder marginResId(@DimenRes int horizontalMarginId) {
    return marginResId(horizontalMarginId, horizontalMarginId);
}
项目:diycode    文件:PositionAnimExpectation.java   
public PositionAnimExpectation withMarginDimen(@DimenRes int marginRes){
    this.marginRes = marginRes;
    return this;
}