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 File: Utils.java    From BlackList with Apache License 2.0 5 votes vote down vote up
/**
 * 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 File: TypedArrayHelper.java    From CameraButton with Apache License 2.0 5 votes vote down vote up
@Px
static int getDimension(Context context,
                        TypedArray array,
                        @StyleableRes int attr,
                        @DimenRes int defaultDimenRes) {

    return array.getDimensionPixelOffset(
            attr, context.getResources().getDimensionPixelSize(defaultDimenRes));
}
 
Example #3
Source File: TapTarget.java    From styT with Apache License 2.0 5 votes vote down vote up
private int dimenOrSize(Context context, int size, @DimenRes int dimen) {
    if (dimen != -1) {
        return context.getResources().getDimensionPixelSize(dimen);
    }

    return UiUtil.sp(context, size);
}
 
Example #4
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget chipIconSizeResource(@DimenRes int id) {
    view.setChipIconSizeResource(id);
    return self();
}
 
Example #5
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget textEndPaddingResource(@DimenRes int id) {
    view.setTextEndPaddingResource(id);
    return self();
}
 
Example #6
Source File: CirclePatternCell.java    From PasscodeView with Apache License 2.0 4 votes vote down vote up
@NonNull
public CirclePatternCell.Builder setRadius(@DimenRes final int indicatorRadius) {
    mRadius = getContext().getResources().getDimension(indicatorRadius);
    return this;
}
 
Example #7
Source File: CompatResourceUtils.java    From WheelViewDemo with Apache License 2.0 4 votes vote down vote up
public static int getDimensionPixelSize(@NonNull Fragment fragment, @DimenRes int id){
    return fragment.getResources().getDimensionPixelSize(id);
}
 
Example #8
Source File: AbsCustomSlider.java    From timecat with Apache License 2.0 4 votes vote down vote up
protected int getDimension(@DimenRes int id) {
	return getResources().getDimensionPixelSize(id);
}
 
Example #9
Source File: RoundedImageView.java    From DMusic with Apache License 2.0 4 votes vote down vote up
public void setBorderWidth(@DimenRes int resId) {
    setBorderWidth(getResources().getDimension(resId));
}
 
Example #10
Source File: DefaultDimensionResourceProvider.java    From CoachMarks with Apache License 2.0 4 votes vote down vote up
@Override
public int getDimensionInPixel(@DimenRes final int dimenRes) {
    return mContext.getResources().getDimensionPixelSize(dimenRes);
}
 
Example #11
Source File: RectKey.java    From PasscodeView with Apache License 2.0 4 votes vote down vote up
@NonNull
public Builder setKeyTextSize(@DimenRes int keyTextSize) {
    mKeyTextSize = getContext().getResources().getDimension(keyTextSize);
    return this;
}
 
Example #12
Source File: VerticalDividerItemDecoration.java    From AFBaseLibrary with Apache License 2.0 4 votes vote down vote up
public Builder marginResId(@DimenRes int verticalMarginId) {
    return marginResId(verticalMarginId, verticalMarginId);
}
 
Example #13
Source File: HorizontalDividerItemDecoration.java    From AFBaseLibrary with Apache License 2.0 4 votes vote down vote up
public Builder marginResId(@DimenRes int leftMarginId, @DimenRes int rightMarginId) {
    return margin(mResources.getDimensionPixelSize(leftMarginId),
            mResources.getDimensionPixelSize(rightMarginId));
}
 
Example #14
Source File: HorizontalDividerItemDecoration.java    From AFBaseLibrary with Apache License 2.0 4 votes vote down vote up
public Builder marginResId(@DimenRes int horizontalMarginId) {
    return marginResId(horizontalMarginId, horizontalMarginId);
}
 
Example #15
Source File: CompatResourceUtils.java    From CameraMaskDemo with Apache License 2.0 4 votes vote down vote up
public static int getDimensionPixelSize(@NonNull Fragment fragment, @DimenRes int id){
    return fragment.getResources().getDimensionPixelSize(id);
}
 
Example #16
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget chipStartPaddingResource(@DimenRes int id) {
    view.setChipStartPaddingResource(id);
    return self();
}
 
Example #17
Source File: ImageLayoutInformation.java    From CoachMarks with Apache License 2.0 4 votes vote down vote up
public static Builder create(@DimenRes int imageWidth, @DimenRes int imageHeight) {
    return new AutoValue_ImageLayoutInformation.Builder()
            .setImageWidth(imageWidth)
            .setImageHeight(imageHeight);
}
 
Example #18
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget iconEndPaddingResource(@DimenRes int id) {
    view.setIconEndPaddingResource(id);
    return self();
}
 
Example #19
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget chipStrokeWidthResource(@DimenRes int id) {
    view.setChipStrokeWidthResource(id);
    return self();
}
 
Example #20
Source File: CircleIndicator.java    From PasscodeView with Apache License 2.0 4 votes vote down vote up
@NonNull
public CircleIndicator.Builder setIndicatorRadius(@DimenRes final int indicatorRadius) {
    mIndicatorRadius = getContext().getResources().getDimension(indicatorRadius);
    return this;
}
 
Example #21
Source File: FloatingActionButton.java    From TestChat with Apache License 2.0 4 votes vote down vote up
float getDimension(@DimenRes int id) {
        return getResources().getDimension(id);
}
 
Example #22
Source File: TextInputWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public TextInputWidget boxCornerRadiiResources(@DimenRes int boxCornerRadiusTopStartId, @DimenRes int boxCornerRadiusTopEndId, @DimenRes int boxCornerRadiusBottomEndId, @DimenRes int boxCornerRadiusBottomStartId) {
    view.setBoxCornerRadiiResources(boxCornerRadiusTopStartId, boxCornerRadiusTopEndId, boxCornerRadiusBottomEndId, boxCornerRadiusBottomStartId);
    return self();
}
 
Example #23
Source File: MaterialButtonWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public MaterialButtonWidget cornerRadiusResource(@DimenRes int cornerRadiusResourceId) {
    view.setCornerRadiusResource(cornerRadiusResourceId);
    return self();
}
 
Example #24
Source File: ChipGroupWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget chipSpacingVerticalResource(@DimenRes int id) {
    view.setChipSpacingVerticalResource(id);
    return self();
}
 
Example #25
Source File: ChipGroupWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget chipSpacingHorizontalResource(@DimenRes int id) {
    view.setChipSpacingHorizontalResource(id);
    return self();
}
 
Example #26
Source File: ChipGroupWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget chipSpacingResource(@DimenRes int id) {
    view.setChipSpacingResource(id);
    return self();
}
 
Example #27
Source File: CompatResourceUtils.java    From SimpleAdapterDemo with Apache License 2.0 4 votes vote down vote up
public static int getDimensionPixelSize(@NonNull Context context, @DimenRes int id){
    return context.getResources().getDimensionPixelSize(id);
}
 
Example #28
Source File: FinestWebView.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
public Builder menuTextPaddingRightRes(@DimenRes int menuTextPaddingRight) {
	this.menuTextPaddingRight = ResourcesUtil.getDimension(menuTextPaddingRight);
	return this;
}
 
Example #29
Source File: FinestWebView.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
public Builder menuTextPaddingLeftRes(@DimenRes int menuTextPaddingLeft) {
	this.menuTextPaddingLeft = ResourcesUtil.getDimension(menuTextPaddingLeft);
	return this;
}
 
Example #30
Source File: FinestWebView.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
public Builder urlSizeRes(@DimenRes int urlSize) {
	this.urlSize = ResourcesUtil.getDimension(urlSize);
	return this;
}