Java Code Examples for com.facebook.react.uimanager.PixelUtil#toDIPFromPixel()
The following examples show how to use
com.facebook.react.uimanager.PixelUtil#toDIPFromPixel() .
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: RNPublisherBannerViewManager.java From react-native-admob with BSD 2-Clause "Simplified" License | 6 votes |
private void sendOnSizeChangeEvent() { int width; int height; ReactContext reactContext = (ReactContext) getContext(); WritableMap event = Arguments.createMap(); AdSize adSize = this.adView.getAdSize(); if (adSize == AdSize.SMART_BANNER) { width = (int) PixelUtil.toDIPFromPixel(adSize.getWidthInPixels(reactContext)); height = (int) PixelUtil.toDIPFromPixel(adSize.getHeightInPixels(reactContext)); } else { width = adSize.getWidth(); height = adSize.getHeight(); } event.putDouble("width", width); event.putDouble("height", height); sendEvent(RNPublisherBannerViewManager.EVENT_SIZE_CHANGE, event); }
Example 2
Source File: RNAdMobBannerViewManager.java From react-native-admob with BSD 2-Clause "Simplified" License | 6 votes |
private void sendOnSizeChangeEvent() { int width; int height; ReactContext reactContext = (ReactContext) getContext(); WritableMap event = Arguments.createMap(); AdSize adSize = this.adView.getAdSize(); if (this.adSize == AdSize.SMART_BANNER) { width = (int) PixelUtil.toDIPFromPixel(adSize.getWidthInPixels(reactContext)); height = (int) PixelUtil.toDIPFromPixel(adSize.getHeightInPixels(reactContext)); } else { width = adSize.getWidth(); height = adSize.getHeight(); } event.putDouble("width", width); event.putDouble("height", height); sendEvent(RNAdMobBannerViewManager.EVENT_SIZE_CHANGE, event); }
Example 3
Source File: StatusBarModule.java From react-native-GPay with MIT License | 5 votes |
@Override public @Nullable Map<String, Object> getConstants() { final Context context = getReactApplicationContext(); final int heightResId = context.getResources() .getIdentifier("status_bar_height", "dimen", "android"); final float height = heightResId > 0 ? PixelUtil.toDIPFromPixel(context.getResources().getDimensionPixelSize(heightResId)) : 0; return MapBuilder.<String, Object>of( HEIGHT_KEY, height); }