/** * Specify the text size for the title via a dimen resource * <p> * Note: If set, this value will take precedence over the specified sp size */ public TapTarget titleTextDimen(@DimenRes int dimen) { this.titleTextDimen = dimen; return this; }
/** * Specify the text size for the description via a dimen resource * <p> * Note: If set, this value will take precedence over the specified sp size */ public TapTarget descriptionTextDimen(@DimenRes int dimen) { this.descriptionTextDimen = dimen; return this; }
/** * Set the DrawerBuilder width with a dimension resource * * @param drawerWidthRes * @return */ public DrawerBuilder withDrawerWidthRes(@DimenRes int drawerWidthRes) { if (mActivity == null) { throw new RuntimeException("please pass an activity first to use this call"); } this.mDrawerWidth = mActivity.getResources().getDimensionPixelSize(drawerWidthRes); return this; }
/** * @param paddingRes Padding as dimension resource. * @param itemSpacingRes Space as dimension resource to add between each carousel item. Will be * implemented via an item decoration. */ public static Padding resource(@DimenRes int paddingRes, @DimenRes int itemSpacingRes) { return new Padding( paddingRes, paddingRes, paddingRes, paddingRes, itemSpacingRes, PaddingType.RESOURCE); }
/** * set the height for the header by resource * * @param heightRes * @return */ public AccountHeaderBuilder withHeightRes(@DimenRes int heightRes) { this.mHeight = DimenHolder.fromResource(heightRes); return this; }
public BadgeStyle withPaddingLeftRightRes(@DimenRes int paddingLeftRight) { this.mPaddingLeftRight = DimenHolder.fromResource(paddingLeftRight); return this; }
public BadgeStyle withPaddingTopBottomRes(@DimenRes int paddingTopBottom) { this.mPaddingTopBottom = DimenHolder.fromResource(paddingTopBottom); return this; }
public MiniProfileDrawerItem withCustomHeightRes(@DimenRes int customHeightRes) { this.customHeight = DimenHolder.fromResource(customHeightRes); return this; }
public MiniDrawerItem withCustomHeightRes(@DimenRes int customHeightRes) { this.mCustomHeight = DimenHolder.fromResource(customHeightRes); return this; }
/** * Set background contour width from an dimen res for the icon * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable backgroundContourWidthRes(@DimenRes int sizeResId) { return backgroundContourWidthPx(mContext.getResources().getDimensionPixelSize(sizeResId)); }
public GridItemDividerDecoration(@NonNull Context context, @DimenRes int dividerSizeResId, @ColorRes int dividerColorResId) { this(context.getResources().getDimensionPixelSize(dividerSizeResId), ContextCompat.getColor(context, dividerColorResId)); }
/** * Set the size of the drawable. * * @param sizeResId The dimension resource. * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable sizeResY(@DimenRes int sizeResId) { return sizePxY(mContext.getResources().getDimensionPixelSize(sizeResId)); }
/** * set the icon offset for Y from resource * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable iconOffsetYRes(@DimenRes int sizeResId) { return iconOffsetYPx(mContext.getResources().getDimensionPixelSize(sizeResId)); }
/** * Set the padding of the drawable from res * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable paddingRes(@DimenRes int sizeResId) { return paddingPx(mContext.getResources().getDimensionPixelSize(sizeResId)); }
/** * Set rounded corner from res * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable roundedCornersRyRes(@DimenRes int sizeResId) { return roundedCornersRyPx(mContext.getResources().getDimensionPixelSize(sizeResId)); }
private int dimenOrSize(Context context, int size, @DimenRes int dimen) { if (dimen != -1) { return context.getResources().getDimensionPixelSize(dimen); } return UiUtil.sp(context, size); } }
@UiThread // Implicit synchronization for use of shared resource VALUE. public static float getFloat(Context context, @DimenRes int id) { TypedValue value = VALUE; context.getResources().getValue(id, value, true); if (value.type == TypedValue.TYPE_FLOAT) { return value.getFloat(); } throw new Resources.NotFoundException("Resource ID #0x" + Integer.toHexString(id) + " type #0x" + Integer.toHexString(value.type) + " is not valid"); }
public static DimenHolder fromResource(@DimenRes int resource) { DimenHolder dimenHolder = new DimenHolder(); dimenHolder.setResource(resource); return dimenHolder; } }
public void setItemSpacingRes(@DimenRes int itemSpacingRes) { setItemSpacingPx(resToPx(itemSpacingRes)); }
/** * Set a dimension resource to specify the padding value to use on each side of the carousel and * in between carousel items. */ @ModelProp(group = "padding") public void setPaddingRes(@DimenRes int paddingRes) { int px = resToPx(paddingRes); setPadding(px, px, px, px); setItemSpacingPx(px); }