android.support.annotation.DimenRes Java Examples
The following examples show how to use
android.support.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 Project: BlackList Author: kaliturin File: Utils.java License: Apache License 2.0 | 5 votes |
/** * Scales passed view with passed dimension on Tablets only */ public static void scaleViewOnTablet(Context context, View view, @DimenRes int dimenRes) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { boolean isTablet = context.getResources().getBoolean(R.bool.isTablet); if (isTablet) { TypedValue outValue = new TypedValue(); context.getResources().getValue(dimenRes, outValue, true); float scale = outValue.getFloat(); view.setScaleX(scale); view.setScaleY(scale); } } }
Example #2
Source Project: styT Author: stytooldex File: TapTarget.java License: Apache License 2.0 | 5 votes |
private int dimenOrSize(Context context, int size, @DimenRes int dimen) { if (dimen != -1) { return context.getResources().getDimensionPixelSize(dimen); } return UiUtil.sp(context, size); }
Example #3
Source Project: CameraButton Author: hluhovskyi File: TypedArrayHelper.java License: Apache License 2.0 | 5 votes |
@Px static int getDimension(Context context, TypedArray array, @StyleableRes int attr, @DimenRes int defaultDimenRes) { return array.getDimensionPixelOffset( attr, context.getResources().getDimensionPixelSize(defaultDimenRes)); }
Example #4
Source Project: SimpleAdapterDemo Author: JustinRoom File: CompatResourceUtils.java License: Apache License 2.0 | 4 votes |
public static int getDimensionPixelSize(@NonNull Context context, @DimenRes int id){ return context.getResources().getDimensionPixelSize(id); }
Example #5
Source Project: SimpleAdapterDemo Author: JustinRoom File: CompatResourceUtils.java License: Apache License 2.0 | 4 votes |
public static int getDimensionPixelSize(@NonNull View view, @DimenRes int id){ return view.getResources().getDimensionPixelSize(id); }
Example #6
Source Project: SimpleAdapterDemo Author: JustinRoom File: CompatResourceUtils.java License: Apache License 2.0 | 4 votes |
public static int getDimensionPixelSize(@NonNull Fragment fragment, @DimenRes int id){ return fragment.getResources().getDimensionPixelSize(id); }
Example #7
Source Project: ChannelView Author: chengzhicao File: ChannelView.java License: Apache License 2.0 | 4 votes |
public void setPlatesTitleSizeRes(@DimenRes int platesTitleSize) { this.platesTitleSize = getResources().getDimensionPixelSize(platesTitleSize); for (TextView title : platesTitle) { title.setTextSize(TypedValue.COMPLEX_UNIT_PX, this.platesTitleSize); } }
Example #8
Source Project: ChannelView Author: chengzhicao File: ChannelView.java License: Apache License 2.0 | 4 votes |
public void setOtherSubTitleTextSizeRes(@DimenRes int otherSubTitleTextSize) { this.otherSubTitleTextSize = getResources().getDimensionPixelSize(otherSubTitleTextSize); for (TextView otherSubTitle : otherSubTitles) { otherSubTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, this.otherSubTitleTextSize); } }
Example #9
Source Project: ChannelView Author: chengzhicao File: ChannelView.java License: Apache License 2.0 | 4 votes |
public void setSubTitleTextSizeRes(@DimenRes int subTitleTextSize) { this.subTitleTextSize = getResources().getDimensionPixelSize(subTitleTextSize); if (channelLayout != null && channelLayout.subTitle != null) { channelLayout.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, this.subTitleTextSize); } }
Example #10
Source Project: PasscodeView Author: kevalpatel2106 File: RectKey.java License: Apache License 2.0 | 4 votes |
@NonNull public Builder setKeyPadding(@DimenRes int keyPaddingRes) { mKeyPadding = getContext().getResources().getDimension(keyPaddingRes); return this; }
Example #11
Source Project: meter-number-picker Author: alexzaitsev File: MeterNumberPicker.java License: Apache License 2.0 | 4 votes |
public void setMinHeightRes(@DimenRes int height) { setMinHeightPx(getResources().getDimensionPixelSize(height)); }
Example #12
Source Project: kAndroid Author: 1067899750 File: BaseRateView.java License: Apache License 2.0 | 4 votes |
public float getDimension(@DimenRes int resId) { return getResources().getDimension(resId); }
Example #13
Source Project: kAndroid Author: 1067899750 File: BaseLineRateView.java License: Apache License 2.0 | 4 votes |
public float getDimension(@DimenRes int resId) { return getResources().getDimension(resId); }
Example #14
Source Project: kAndroid Author: 1067899750 File: ChildView.java License: Apache License 2.0 | 4 votes |
public float getDimension(@DimenRes int resId) { return getResources().getDimension(resId); }
Example #15
Source Project: kAndroid Author: 1067899750 File: BaseView.java License: Apache License 2.0 | 4 votes |
public float getDimension(@DimenRes int resId) { return getResources().getDimension(resId); }
Example #16
Source Project: andela-med-manager Author: jumaallan File: ItemOffsetDecoration.java License: Apache License 2.0 | 4 votes |
public ItemOffsetDecoration(@NonNull Context context, @DimenRes int itemOffsetId) { this(context.getResources().getDimensionPixelSize(itemOffsetId)); }
Example #17
Source Project: diycode Author: GcsSloop File: PositionAnimExpectation.java License: Apache License 2.0 | 4 votes |
public PositionAnimExpectation withMarginDimen(@DimenRes int marginRes){ this.marginRes = marginRes; return this; }
Example #18
Source Project: PasscodeView Author: kevalpatel2106 File: RoundKey.java License: Apache License 2.0 | 4 votes |
@NonNull public RoundKey.Builder setKeyPadding(@DimenRes final int keyPaddingRes) { mKeyPadding = getContext().getResources().getDimension(keyPaddingRes); return this; }
Example #19
Source Project: PasscodeView Author: kevalpatel2106 File: DotPatternCell.java License: Apache License 2.0 | 4 votes |
@NonNull public DotPatternCell.Builder setRadius(@DimenRes final int indicatorRadius) { mRadius = getContext().getResources().getDimension(indicatorRadius); return this; }
Example #20
Source Project: 1Rramp-Android Author: hapramp File: ShadowUtils.java License: MIT License | 4 votes |
public static Drawable generateBackgroundWithShadow(View view, @ColorRes int backgroundColor, @DimenRes int cornerRadius, @ColorRes int shadowColor, @DimenRes int elevation, int shadowGravity) { float cornerRadiusValue = view.getContext().getResources().getDimension(cornerRadius); int elevationValue = (int) view.getContext().getResources().getDimension(elevation); int shadowColorValue = ContextCompat.getColor(view.getContext(), shadowColor); int backgroundColorValue = ContextCompat.getColor(view.getContext(), backgroundColor); float[] outerRadius = {cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue}; Rect shapeDrawablePadding = new Rect(); shapeDrawablePadding.left = 0; shapeDrawablePadding.right = 0; int DY = 0; int DX = 0; switch (shadowGravity) { case Gravity.CENTER: shapeDrawablePadding.top = elevationValue; shapeDrawablePadding.bottom = elevationValue; DY = 0; break; case Gravity.RIGHT: shapeDrawablePadding.right = elevationValue * 2; shapeDrawablePadding.bottom = elevationValue * 2; DY = elevationValue / 3; DX = elevationValue / 3; break; case Gravity.TOP: shapeDrawablePadding.top = elevationValue * 2; shapeDrawablePadding.bottom = elevationValue; DY = -1 * elevationValue / 3; break; case Gravity.BOTTOM: shapeDrawablePadding.top = elevationValue; shapeDrawablePadding.bottom = elevationValue * 2; DY = elevationValue / 3; break; } ShapeDrawable shapeDrawable = new ShapeDrawable(); shapeDrawable.setPadding(shapeDrawablePadding); shapeDrawable.getPaint().setColor(backgroundColorValue); shapeDrawable.getPaint().setShadowLayer(cornerRadiusValue / 3, DX, DY, shadowColorValue); view.setLayerType(LAYER_TYPE_SOFTWARE, shapeDrawable.getPaint()); shapeDrawable.setShape(new RoundRectShape(outerRadius, null, null)); LayerDrawable drawable = new LayerDrawable(new Drawable[]{shapeDrawable}); drawable.setLayerInset(0, 0, 0, 0, elevationValue * 2); return drawable; }
Example #21
Source Project: PowerFileExplorer Author: PowerExplorer File: ResourcesUtil.java License: GNU General Public License v3.0 | 4 votes |
public static float getDimension(@DimenRes int dimenRes) { return Base.getResources().getDimension(dimenRes); }
Example #22
Source Project: PowerFileExplorer Author: PowerExplorer File: ResourcesUtil.java License: GNU General Public License v3.0 | 4 votes |
public static int getDimensionPixelOffset(@DimenRes int dimenRes) { return Base.getResources().getDimensionPixelOffset(dimenRes); }
Example #23
Source Project: PowerFileExplorer Author: PowerExplorer File: ResourcesUtil.java License: GNU General Public License v3.0 | 4 votes |
public static int getDimensionPixelSize(@DimenRes int dimenRes) { return Base.getResources().getDimensionPixelSize(dimenRes); }
Example #24
Source Project: Android Author: connectim File: RoundedImageView.java License: MIT License | 4 votes |
public void setBorderWidth(@DimenRes int resId) { setBorderWidth(getResources().getDimension(resId)); }
Example #25
Source Project: AccountBook Author: Airsaid File: FlexibleDividerDecoration.java License: GNU General Public License v3.0 | 4 votes |
public T sizeResId(@DimenRes int sizeId) { return size(mResources.getDimensionPixelSize(sizeId)); }
Example #26
Source Project: PowerFileExplorer Author: PowerExplorer File: FinestWebView.java License: GNU General Public License v3.0 | 4 votes |
public Builder urlSizeRes(@DimenRes int urlSize) { this.urlSize = ResourcesUtil.getDimension(urlSize); return this; }
Example #27
Source Project: PowerFileExplorer Author: PowerExplorer File: FinestWebView.java License: GNU General Public License v3.0 | 4 votes |
public Builder menuTextPaddingLeftRes(@DimenRes int menuTextPaddingLeft) { this.menuTextPaddingLeft = ResourcesUtil.getDimension(menuTextPaddingLeft); return this; }
Example #28
Source Project: PowerFileExplorer Author: PowerExplorer File: FinestWebView.java License: GNU General Public License v3.0 | 4 votes |
public Builder menuTextPaddingRightRes(@DimenRes int menuTextPaddingRight) { this.menuTextPaddingRight = ResourcesUtil.getDimension(menuTextPaddingRight); return this; }
Example #29
Source Project: lock-screen Author: amirarcane File: ResourceUtils.java License: MIT License | 4 votes |
public static float getDimensionInPx(Context context, @DimenRes int id) { return context.getResources().getDimension(id); }
Example #30
Source Project: relight Author: ittianyu File: ChipGroupWidget.java License: Apache License 2.0 | 4 votes |
public ChipGroupWidget chipSpacingResource(@DimenRes int id) { view.setChipSpacingResource(id); return self(); }