androidx.annotation.DimenRes Java Examples
The following examples show how to use
androidx.annotation.DimenRes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceResolver.java From litho with Apache License 2.0 | 5 votes |
public float resolveFloatAttr(@AttrRes int attrResId, @DimenRes int defResId) { TypedArray a = mTheme.obtainStyledAttributes(new int[] {attrResId}); try { return a.getDimension(0, resolveFloatRes(defResId)); } finally { a.recycle(); } }
Example #2
Source File: ImageViewer.java From photo-viewer with Apache License 2.0 | 5 votes |
/** * 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; }
Example #3
Source File: ResourceResolver.java From litho with Apache License 2.0 | 5 votes |
public int resolveDimenSizeAttr(@AttrRes int attrResId, @DimenRes int defResId) { TypedArray a = mTheme.obtainStyledAttributes(new int[] {attrResId}); try { return a.getDimensionPixelSize(0, resolveDimenSizeRes(defResId)); } finally { a.recycle(); } }
Example #4
Source File: ResourceResolver.java From litho with Apache License 2.0 | 5 votes |
public float resolveFloatRes(@DimenRes int resId) { if (resId != 0) { Float cached = mResourceCache.get(resId); if (cached != null) { return cached; } float result = mResources.getDimension(resId); mResourceCache.put(resId, result); return result; } return 0; }
Example #5
Source File: ResourceResolver.java From litho with Apache License 2.0 | 5 votes |
public int resolveDimenOffsetRes(@DimenRes int resId) { if (resId != 0) { Integer cached = mResourceCache.get(resId); if (cached != null) { return cached; } int result = mResources.getDimensionPixelOffset(resId); mResourceCache.put(resId, result); return result; } return 0; }
Example #6
Source File: ResourceResolver.java From litho with Apache License 2.0 | 5 votes |
public int resolveDimenSizeRes(@DimenRes int resId) { if (resId != 0) { Integer cached = mResourceCache.get(resId); if (cached != null) { return cached; } int result = mResources.getDimensionPixelSize(resId); mResourceCache.put(resId, result); return result; } return 0; }
Example #7
Source File: Settings.java From MHViewer with Apache License 2.0 | 5 votes |
@DimenRes public static int getDetailSizeResId() { switch (getDetailSize()) { default: case 0: return R.dimen.gallery_list_column_width_long; case 1: return R.dimen.gallery_list_column_width_short; } }
Example #8
Source File: Settings.java From MHViewer with Apache License 2.0 | 5 votes |
@DimenRes public static int getThumbSizeResId() { switch (getThumbSize()) { case 0: return R.dimen.gallery_grid_column_width_large; default: case 1: return R.dimen.gallery_grid_column_width_middle; case 2: return R.dimen.gallery_grid_column_width_small; } }
Example #9
Source File: ResourceUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 获取 Dimension * @param id resource identifier * @return Dimension */ public static float getDimension(@DimenRes final int id) { try { return DevUtils.getContext().getResources().getDimension(id); } catch (Exception e) { LogPrintUtils.eTag(TAG, e, "getDimension"); } return 0f; }
Example #10
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T minHeightRes(@DimenRes int resId) { return minHeightPx(mResourceResolver.resolveDimenSizeRes(resId)); }
Example #11
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T maxHeightRes(@DimenRes int resId) { return maxHeightPx(mResourceResolver.resolveDimenSizeRes(resId)); }
Example #12
Source File: ItemOffsetDecoration.java From RendererRecyclerViewAdapter with Apache License 2.0 | 4 votes |
public ItemOffsetDecoration(@NonNull Context context, @DimenRes int itemOffsetId) { this(context.getResources().getDimensionPixelSize(itemOffsetId)); }
Example #13
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #widthPx */ public T widthAttr(@AttrRes int resId, @DimenRes int defaultResId) { return widthPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); }
Example #14
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #widthPx */ public T widthRes(@DimenRes int resId) { return widthPx(mResourceResolver.resolveDimenSizeRes(resId)); }
Example #15
Source File: BasicTestSample.java From litho with Apache License 2.0 | 4 votes |
public Matcher myDimenSizePropRes(@DimenRes int resId) { this.mMyDimenSizePropMatcher = org.hamcrest.core.Is.is((float) mResourceResolver.resolveDimenSizeRes(resId)); return this; }
Example #16
Source File: BasicTestSample.java From litho with Apache License 2.0 | 4 votes |
public Matcher myDimenSizePropAttr(@AttrRes int attrResId, @DimenRes int defResId) { this.mMyDimenSizePropMatcher = org.hamcrest.core.Is.is( (float) mResourceResolver.resolveDimenSizeAttr(attrResId, defResId)); return this; }
Example #17
Source File: FastLoadMoreView.java From FastLib with Apache License 2.0 | 4 votes |
public Builder setLoadingTextSizeResource(@DimenRes int mLoadingTextSizeRes) { return setLoadingTextSize(getDimensionPixelSize(mLoadingTextSizeRes)); }
Example #18
Source File: PositionAnimExpectation.java From ExpectAnim with Apache License 2.0 | 4 votes |
public PositionAnimExpectation withMarginDimen(@DimenRes int marginRes){ this.marginRes = marginRes; return this; }
Example #19
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
public T touchExpansionRes(@Nullable YogaEdge edge, @DimenRes int resId) { return touchExpansionPx(edge, mResourceResolver.resolveDimenSizeRes(resId)); }
Example #20
Source File: ImageViewer.java From photo-viewer with Apache License 2.0 | 4 votes |
/** * 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; }
Example #21
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T minHeightAttr(@AttrRes int resId, @DimenRes int defaultResId) { return minHeightPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); }
Example #22
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T maxWidthRes(@DimenRes int resId) { return maxWidthPx(mResourceResolver.resolveDimenSizeRes(resId)); }
Example #23
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T maxWidthAttr(@AttrRes int resId, @DimenRes int defaultResId) { return maxWidthPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); }
Example #24
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T minWidthRes(@DimenRes int resId) { return minWidthPx(mResourceResolver.resolveDimenSizeRes(resId)); }
Example #25
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #minWidthPx */ public T maxHeightAttr(@AttrRes int resId, @DimenRes int defaultResId) { return maxHeightPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); }
Example #26
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #marginPx */ public T marginRes(@Nullable YogaEdge edge, @DimenRes int resId) { return marginPx(edge, mResourceResolver.resolveDimenSizeRes(resId)); }
Example #27
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #marginPx */ public T marginAttr(@Nullable YogaEdge edge, @AttrRes int resId, @DimenRes int defaultResId) { return marginPx(edge, mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); }
Example #28
Source File: FastLoadMoreView.java From FastLib with Apache License 2.0 | 4 votes |
public Builder setLoadEndTextSizeResource(@DimenRes int mLoadEndTextSizeRes) { return setLoadEndTextSize(getDimensionPixelSize(mLoadEndTextSizeRes)); }
Example #29
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #heightPx */ public T heightAttr(@AttrRes int resId, @DimenRes int defaultResId) { return heightPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); }
Example #30
Source File: Component.java From litho with Apache License 2.0 | 4 votes |
/** @see #flexBasisPx */ public T flexBasisRes(@DimenRes int resId) { return flexBasisPx(mResourceResolver.resolveDimenSizeRes(resId)); }