コード例 #1
0
 @Override
 public void receiveCommand(ReactViewGroup root, int commandId, @Nullable ReadableArray args) {
   switch (commandId) {
     case CMD_HOTSPOT_UPDATE:
       {
         if (args == null || args.size() != 2) {
           throw new JSApplicationIllegalArgumentException(
               "Illegal number of arguments for 'updateHotspot' command");
         }
         if (Build.VERSION.SDK_INT >= 21) {
           root.getLocationOnScreen(sLocationBuf);
           float x = PixelUtil.toPixelFromDIP(args.getDouble(0)) - sLocationBuf[0];
           float y = PixelUtil.toPixelFromDIP(args.getDouble(1)) - sLocationBuf[1];
           root.drawableHotspotChanged(x, y);
         }
         break;
       }
     case CMD_SET_PRESSED:
       {
         if (args == null || args.size() != 1) {
           throw new JSApplicationIllegalArgumentException(
               "Illegal number of arguments for 'setPressed' command");
         }
         root.setPressed(args.getBoolean(0));
         break;
       }
   }
 }
コード例 #2
0
 @ReactProp(name = ViewProps.BORDER_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
 public void setBorderWidth(ReactViewGroup view, float width) {
   if (!CSSConstants.isUndefined(width)) {
     width = PixelUtil.toPixelFromDIP(width);
   }
   view.setBorderWidth(Spacing.ALL, width);
 }
コード例 #3
0
 @ReactPropGroup(
     names = {
       ViewProps.BORDER_WIDTH,
       ViewProps.BORDER_LEFT_WIDTH,
       ViewProps.BORDER_RIGHT_WIDTH,
       ViewProps.BORDER_TOP_WIDTH,
       ViewProps.BORDER_BOTTOM_WIDTH,
     },
     defaultFloat = CSSConstants.UNDEFINED)
 public void setBorderWidth(ReactViewGroup view, int index, float width) {
   if (!CSSConstants.isUndefined(width)) {
     width = PixelUtil.toPixelFromDIP(width);
   }
   view.setBorderWidth(SPACING_TYPES[index], width);
 }
コード例 #4
0
 @ReactProp(name = "borderRadius")
 public void setBorderRadius(ReactViewGroup view, float borderRadius) {
   view.setBorderRadius(PixelUtil.toPixelFromDIP(borderRadius));
 }
コード例 #5
0
 public void setBorderRadius(float borderRadius) {
   mBorderRadius = PixelUtil.toPixelFromDIP(borderRadius);
   mIsDirty = true;
 }
コード例 #6
0
 public void setBorderWidth(float borderWidth) {
   mBorderWidth = PixelUtil.toPixelFromDIP(borderWidth);
   mIsDirty = true;
 }