Example usage for com.facebook.react.uimanager PixelUtil toPixelFromDIP

List of usage examples for com.facebook.react.uimanager PixelUtil toPixelFromDIP

Introduction

In this page you can find the example usage for com.facebook.react.uimanager PixelUtil toPixelFromDIP.

Prototype

public static float toPixelFromDIP(double value) 

Source Link

Document

Convert from DIP to PX

Usage

From source file:cn.chronos.image.ImageAndroidView.java

License:Open Source License

public void setBorderWidth(float borderWidth) {
    mBorderWidth = PixelUtil.toPixelFromDIP(borderWidth);
    mIsDirty = true;
}

From source file:cn.chronos.image.ImageAndroidView.java

License:Open Source License

public void setBorderRadius(float borderRadius) {
    mBorderRadius = PixelUtil.toPixelFromDIP(borderRadius);
    mIsDirty = true;
}

From source file:com.helloworld.RealRecyclerView.java

License:Open Source License

void setRowHeight(int rowHeight) {
    mRowHeight = (int) PixelUtil.toPixelFromDIP(rowHeight);
    final int height = Math.max(DisplayMetricsHolder.getScreenDisplayMetrics().heightPixels,
            DisplayMetricsHolder.getScreenDisplayMetrics().widthPixels);
    mHoldItems = Math.round(1.6f * height / this.mRowHeight);
    if (mHoldItems < 6)
        mHoldItems = 6;//from   w  ww.  j a v  a2s  .c  o  m
}

From source file:com.reactnative.swiper.viewpager.ReactViewPagerManager.java

License:Open Source License

@ReactProp(name = "pageMargin", defaultFloat = 0)
public void setPageMargin(ReactViewPager pager, float margin) {
    pager.setPageMargin((int) PixelUtil.toPixelFromDIP(margin));
}

From source file:com.rnnestedscrollview.ReactNestedScrollViewManager.java

License:MIT License

@ReactPropGroup(names = { ViewProps.BORDER_RADIUS, ViewProps.BORDER_TOP_LEFT_RADIUS,
        ViewProps.BORDER_TOP_RIGHT_RADIUS, ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
        ViewProps.BORDER_BOTTOM_LEFT_RADIUS }, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderRadius(ReactNestedScrollView view, int index, float borderRadius) {
    if (!YogaConstants.isUndefined(borderRadius)) {
        borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
    }// ww w  .  j  av a  2  s  .  c o m

    if (index == 0) {
        view.setBorderRadius(borderRadius);
    } else {
        view.setBorderRadius(borderRadius, index - 1);
    }
}

From source file:com.rnnestedscrollview.ReactNestedScrollViewManager.java

License:MIT License

@ReactPropGroup(names = { ViewProps.BORDER_WIDTH, ViewProps.BORDER_LEFT_WIDTH, ViewProps.BORDER_RIGHT_WIDTH,
        ViewProps.BORDER_TOP_WIDTH, ViewProps.BORDER_BOTTOM_WIDTH, }, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderWidth(ReactNestedScrollView view, int index, float width) {
    if (!YogaConstants.isUndefined(width)) {
        width = PixelUtil.toPixelFromDIP(width);
    }/*from   w w  w. ja  v a  2s .c  o m*/
    view.setBorderWidth(SPACING_TYPES[index], width);
}