Java 类com.facebook.react.uimanager.annotations.ReactProp 实例源码

项目:RNLearn_Project1    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.MAX_HEIGHT)
public void setMaxHeight(Dynamic maxHeight) {
  if (isVirtual()) {
    return;
  }

  mTempYogaValue.setFromDynamic(maxHeight);
  switch (mTempYogaValue.unit) {
    case POINT:
    case UNDEFINED:
      setStyleMaxHeight(mTempYogaValue.value);
      break;
    case PERCENT:
      setStyleMaxHeightPercent(mTempYogaValue.value);
      break;
  }

  maxHeight.recycle();
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@ReactProp(name = "keyboardType")
public void setKeyboardType(ReactEditText view, @Nullable String keyboardType) {
  int flagsToSet = InputType.TYPE_CLASS_TEXT;
  if (KEYBOARD_TYPE_NUMERIC.equalsIgnoreCase(keyboardType)) {
    flagsToSet = INPUT_TYPE_KEYBOARD_NUMBERED;
  } else if (KEYBOARD_TYPE_EMAIL_ADDRESS.equalsIgnoreCase(keyboardType)) {
    flagsToSet = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT;
  } else if (KEYBOARD_TYPE_PHONE_PAD.equalsIgnoreCase(keyboardType)) {
    flagsToSet = InputType.TYPE_CLASS_PHONE;
  }
  updateStagedInputTypeFlag(
      view,
      INPUT_TYPE_KEYBOARD_NUMBERED | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS |
          InputType.TYPE_CLASS_TEXT,
      flagsToSet);
  checkPasswordType(view);
}
项目:react-native-pili-live    文件:PiliStreamingViewManager.java   
@ReactProp(name = "profile")
public void setProfile(AspectFrameLayout view, @Nullable ReadableMap profile) {
    ReadableMap video = profile.getMap("video");
    ReadableMap audio = profile.getMap("audio");
    int encodingSize = profile.getInt("encodingSize");

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(video.getInt("fps"), video.getInt("bps"), video.getInt("maxFrameInterval"));//fps bps maxFrameInterval
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mProfile.setEncodingSizeLevel(encodingSize);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
项目:RNLearn_Project1    文件:RCTVirtualText.java   
@ReactProp(name = PROP_SHADOW_OFFSET)
public void setTextShadowOffset(@Nullable ReadableMap offsetMap) {
  float dx = 0;
  float dy = 0;
  if (offsetMap != null) {
    if (offsetMap.hasKey("width")) {
      dx = PixelUtil.toPixelFromDIP(offsetMap.getDouble("width"));
    }
    if (offsetMap.hasKey("height")) {
      dy = PixelUtil.toPixelFromDIP(offsetMap.getDouble("height"));
    }
  }

  if (!mShadowStyleSpan.offsetMatches(dx, dy)) {
    getShadowSpan().setOffset(dx, dy);
    notifyChanged(false);
  }
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@ReactProp(name = "keyboardType")
public void setKeyboardType(ReactEditText view, @Nullable String keyboardType) {
  int flagsToSet = InputType.TYPE_CLASS_TEXT;
  if (KEYBOARD_TYPE_NUMERIC.equalsIgnoreCase(keyboardType)) {
    flagsToSet = INPUT_TYPE_KEYBOARD_NUMBERED;
  } else if (KEYBOARD_TYPE_EMAIL_ADDRESS.equalsIgnoreCase(keyboardType)) {
    flagsToSet = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT;
  } else if (KEYBOARD_TYPE_PHONE_PAD.equalsIgnoreCase(keyboardType)) {
    flagsToSet = InputType.TYPE_CLASS_PHONE;
  }
  updateStagedInputTypeFlag(
      view,
      INPUT_TYPE_KEYBOARD_NUMBERED | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS |
          InputType.TYPE_CLASS_TEXT,
      flagsToSet);
  checkPasswordType(view);
}
项目:RNLearn_Project1    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.MIN_HEIGHT)
public void setMinHeight(Dynamic minHeight) {
  if (isVirtual()) {
    return;
  }

  mTempYogaValue.setFromDynamic(minHeight);
  switch (mTempYogaValue.unit) {
    case POINT:
    case UNDEFINED:
      setStyleMinHeight(mTempYogaValue.value);
      break;
    case PERCENT:
      setStyleMinHeightPercent(mTempYogaValue.value);
      break;
  }

  minHeight.recycle();
}
项目:RNLearn_Project1    文件:RCTVirtualText.java   
@ReactProp(name = ViewProps.FONT_WEIGHT)
public void setFontWeight(@Nullable String fontWeightString) {
  final int fontWeight;
  if (fontWeightString == null) {
    fontWeight = -1;
  } else if (BOLD.equals(fontWeightString)) {
    fontWeight = Typeface.BOLD;
  } else if (NORMAL.equals(fontWeightString)) {
    fontWeight = Typeface.NORMAL;
  } else {
    int fontWeightNumeric = parseNumericFontWeight(fontWeightString);
    if (fontWeightNumeric == -1) {
      throw new RuntimeException("invalid font weight " + fontWeightString);
    }
    fontWeight = fontWeightNumeric >= 500 ? Typeface.BOLD : Typeface.NORMAL;
  }

  if (mFontStylingSpan.getFontWeight() != fontWeight) {
    getSpan().setFontWeight(fontWeight);
    notifyChanged(true);
  }
}
项目:react-native-camera-face-detector    文件:RCTCameraViewManager.java   
@ReactProp(name = "barCodeTypes")
public void setBarCodeTypes(RCTCameraView view, ReadableArray barCodeTypes) {
    if (barCodeTypes == null) {
        return;
    }
    List<String> result = new ArrayList<String>(barCodeTypes.size());
    for (int i = 0; i < barCodeTypes.size(); i++) {
        result.add(barCodeTypes.getString(i));
    }
    view.setBarCodeTypes(result);
}
项目:RNLearn_Project1    文件:ReactPropAnnotationSetterSpecTest.java   
@Test(expected = RuntimeException.class)
public void testUnsupportedPropValueType() {
  new BaseViewManager() {
    @ReactProp(name = "prop")
    public void setterWithUnsupportedValueType(View v, Date value) {
    }
  }.getNativeProps();
}
项目:RNLearn_Project1    文件:ARTGroupShadowNode.java   
@ReactProp(name = "clipping")
public void setClipping(@Nullable ReadableArray clippingDims) {
  float[] clippingData = PropHelper.toFloatArray(clippingDims);
  if (clippingData != null) {
    mClipping = createClipping(clippingData);
    markUpdated();
  }
}
项目:RNLearn_Project1    文件:BaseViewManager.java   
@ReactProp(name = PROP_TRANSFORM)
public void setTransform(T view, ReadableArray matrix) {
  if (matrix == null) {
    resetTransformProperty(view);
  } else {
    setTransformProperty(view, matrix);
  }
}
项目:react-native-pili-live    文件:PiliStreamingViewManager.java   
@ReactProp(name = "zoom")
public void setZoom(AspectFrameLayout view, int zoom) {
    mCurrentZoom = zoom;
    mCurrentZoom = Math.min(mCurrentZoom, mMaxZoom);
    mCurrentZoom = Math.max(0, mCurrentZoom);
    mMediaStreamingManager.setZoomValue(zoom);
}
项目:RNLearn_Project1    文件:ReactPropAnnotationSetterSpecTest.java   
@Test(expected = RuntimeException.class)
public void testUnsupportedPropValueType() {
  new BaseViewManager() {
    @ReactProp(name = "prop")
    public void setterWithUnsupportedValueType(View v, Date value) {
    }
  }.getNativeProps();
}
项目:react-native-android-new-crosswalk    文件:CrosswalkWebViewGroupManager.java   
@ReactProp(name = "source")
public void setSource(final CrosswalkWebView view, @Nullable ReadableMap source) {
  Activity _activity = reactContext.getCurrentActivity();
  if (_activity != null) {
      if (source != null) {
          if (source.hasKey("html")) {
              final String html = source.getString("html");
              _activity.runOnUiThread(new Runnable() {
                  @Override
                  public void run () {
                      view.load(null, html);
                  }
              });
              return;
          }
          if (source.hasKey("uri")) {
              final String url = source.getString("uri");
              _activity.runOnUiThread(new Runnable() {
                  @Override
                  public void run () {
                      view.load(url, null);
                  }
              });
              return;
          }
      }
  }
  setUrl(view, BLANK_URL);
}
项目:react-native-camera-face-detector    文件:RCTCameraViewManager.java   
@ReactProp(name = "captureMode")
public void setCaptureMode(RCTCameraView view, final int captureMode) {
    // Note that this in practice only performs any additional setup necessary for each mode;
    // the actual indication to capture a still or record a video when capture() is called is
    // still ultimately decided upon by what it in the options sent to capture().
    view.setCaptureMode(captureMode);
}
项目:RNLearn_Project1    文件:ReactPropAnnotationSetterSpecTest.java   
@Test(expected = RuntimeException.class)
public void testSetterWIthNonViewParam() {
  new BaseViewManager() {
    @ReactProp(name = "prop")
    public void setterWithNonViewParam(Object v, boolean value) {
    }
  }.getNativeProps();
}
项目:react-native-collapsing-toolbar    文件:CollapsingToolbarLayoutManager.java   
@ReactProp(name = "expandedTitleMargin")
public void setExpandedTitleMargin(CollapsingToolbarLayoutView view, ReadableMap margin) {
    int start = margin.getInt("start");
    int top = margin.getInt("top");
    int end = margin.getInt("end");
    int bottom = margin.getInt("bottom");
    view.setExpandedTitleMargin(
        (int) PixelUtil.toPixelFromDIP(start),
        (int) PixelUtil.toPixelFromDIP(top),
        (int) PixelUtil.toPixelFromDIP(end),
        (int) PixelUtil.toPixelFromDIP(bottom)
    );
}
项目:RNLearn_Project1    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.JUSTIFY_CONTENT)
public void setJustifyContent(@Nullable String justifyContent) {
  if (isVirtual()) {
    return;
  }

  if (justifyContent == null) {
    setJustifyContent(YogaJustify.FLEX_START);
    return;
  }

  switch (justifyContent) {
    case "flex-start": {
      setJustifyContent(YogaJustify.FLEX_START);
      break;
    }
    case "center": {
      setJustifyContent(YogaJustify.CENTER);
      break;
    }
    case "flex-end": {
      setJustifyContent(YogaJustify.FLEX_END);
      break;
    }
    case "space-between": {
      setJustifyContent(YogaJustify.SPACE_BETWEEN);
      break;
    }
    case "space-around": {
      setJustifyContent(YogaJustify.SPACE_AROUND);
      break;
    }
    default: {
      throw new JSApplicationIllegalArgumentException(
          "invalid value for justifyContent: " + justifyContent);
    }
  }
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@ReactProp(name = "placeholderTextColor", customType = "Color")
public void setPlaceholderTextColor(ReactEditText view, @Nullable Integer color) {
  if (color == null) {
    view.setHintTextColor(DefaultStyleValuesUtil.getDefaultTextColorHint(view.getContext()));
  } else {
    view.setHintTextColor(color);
  }
}
项目:RNLearn_Project1    文件:BaseViewManager.java   
@ReactProp(name = PROP_TRANSFORM)
public void setTransform(T view, ReadableArray matrix) {
  if (matrix == null) {
    resetTransformProperty(view);
  } else {
    setTransformProperty(view, matrix);
  }
}
项目:RNLearn_Project1    文件:ReactTextShadowNode.java   
@ReactProp(name = PROP_SHADOW_RADIUS, defaultInt = 1)
public void setTextShadowRadius(float textShadowRadius) {
  if (textShadowRadius != mTextShadowRadius) {
    mTextShadowRadius = textShadowRadius;
    markUpdated();
  }
}
项目:RNLearn_Project1    文件:ReactImageManager.java   
@ReactProp(name = ViewProps.RESIZE_METHOD)
public void setResizeMethod(ReactImageView view, @Nullable String resizeMethod) {
  if (resizeMethod == null || "auto".equals(resizeMethod)) {
    view.setResizeMethod(ImageResizeMethod.AUTO);
  } else if ("resize".equals(resizeMethod)) {
    view.setResizeMethod(ImageResizeMethod.RESIZE);
  } else if ("scale".equals(resizeMethod)) {
    view.setResizeMethod(ImageResizeMethod.SCALE);
  } else {
    throw new JSApplicationIllegalArgumentException("Invalid resize method: '" + resizeMethod+ "'");
  }
}
项目:RNLearn_Project1    文件:ReactTextShadowNode.java   
@ReactProp(name = ViewProps.LINE_HEIGHT, defaultInt = UNSET)
public void setLineHeight(int lineHeight) {
  mLineHeightInput = lineHeight;
  if (lineHeight == UNSET) {
    mLineHeight = Float.NaN;
  } else {
    mLineHeight = mAllowFontScaling ?
      PixelUtil.toPixelFromSP(lineHeight) : PixelUtil.toPixelFromDIP(lineHeight);
  }
  markUpdated();
}
项目:RNLearn_Project1    文件:ReactPickerManager.java   
@ReactProp(name = "items")
public void setItems(ReactPicker view, @Nullable ReadableArray items) {
  if (items != null) {
    ReadableMap[] data = new ReadableMap[items.size()];
    for (int i = 0; i < items.size(); i++) {
      data[i] = items.getMap(i);
    }
    ReactPickerAdapter adapter = new ReactPickerAdapter(view.getContext(), data);
    adapter.setPrimaryTextColor(view.getPrimaryColor());
    view.setAdapter(adapter);
  } else {
    view.setAdapter(null);
  }
}
项目:react-native-pili-player    文件:PiliLiveViewManager.java   
@ReactProp(name = "source")
    public void setSource(PLVideoView mVideoView, ReadableMap source) {
        AVOptions options = new AVOptions();
        String uri = source.getString("uri");
        boolean mediaController = source.hasKey("controller") && source.getBoolean("controller");
        int avFrameTimeout = source.hasKey("timeout") ? source.getInt("timeout") : -1;        //10 * 1000 ms
        //boolean liveStreaming = source.hasKey("live") && source.getBoolean("live");  //1 or 0 // 1 -> live
        boolean codec = source.hasKey("hardCodec") && source.getBoolean("hardCodec");  //1 or 0  // 1 -> hw codec enable, 0 -> disable [recommended]
        // the unit of timeout is ms
        if (avFrameTimeout >= 0) {
            options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
//        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        if (codec) {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 1);
        } else {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 0);
        }

        mVideoView.setAVOptions(options);

        // After setVideoPath, the play will start automatically
        // mVideoView.start() is not required

        mVideoView.setVideoPath(uri);

//        if (mediaController) {
//            // You can also use a custom `MediaController` widget
//            MediaController mMediaController = new MediaController(reactContext, false, isLiveStreaming(uri));
//            mVideoView.setMediaController(mMediaController);
//        }

    }
项目:RNLearn_Project1    文件:ReactSwitchManager.java   
@ReactProp(name = "trackTintColor", customType = "Color")
public void setTrackTintColor(ReactSwitch view, Integer color) {
  if (color == null) {
    view.getTrackDrawable().clearColorFilter();
  } else {
    view.getTrackDrawable().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
  }
}
项目:RNLearn_Project1    文件:ReactWebViewManager.java   
@ReactProp(name = "userAgent")
public void setUserAgent(WebView view, @Nullable String userAgent) {
  if (userAgent != null) {
    // TODO(8496850): Fix incorrect behavior when property is unset (uA == null)
    view.getSettings().setUserAgentString(userAgent);
  }
}
项目:RNLearn_Project1    文件:ReactWebViewManager.java   
@ReactProp(name = "onContentSizeChange")
public void setOnContentSizeChange(WebView view, boolean sendContentSizeChangeEvents) {
  if (sendContentSizeChangeEvents) {
    view.setPictureListener(getPictureListener());
  } else {
    view.setPictureListener(null);
  }
}
项目:pili-react-native    文件:PiliPlayerViewManager.java   
@ReactProp(name = "started")
public void setStarted(PLVideoView mVideoView,  boolean started) {
    this.started = started;
    if (started) {
        mVideoView.start();
    } else {
        mVideoView.pause();
        mEventEmitter.receiveEvent(getTargetId(), Events.PAUSE.toString(), Arguments.createMap());
    }
}
项目:react-native-videoplayer    文件:ReactExoplayerViewManager.java   
@ReactProp(name = PROP_REPEAT, defaultBoolean = false)
public void setRepeat(final ReactExoplayerView videoView, final boolean repeat) {
    videoView.setRepeatModifier(repeat);
}
项目:RNLearn_Project1    文件:ReactTextShadowNode.java   
@ReactProp(name = PROP_TEXT)
public void setText(@Nullable String text) {
  mText = text;
  markUpdated();
}
项目:RNLearn_Project1    文件:ReactImageManager.java   
@ReactProp(name = "shouldNotifyLoadEvents")
public void setLoadHandlersRegistered(ReactImageView view, boolean shouldNotifyLoadEvents) {
  view.setShouldNotifyLoadEvents(shouldNotifyLoadEvents);
}
项目:RNLearn_Project1    文件:RCTImageView.java   
@ReactProp(name = "fadeDuration")
public void setFadeDuration(int durationMs) {
  getMutableDrawImage().setFadeDuration(durationMs);
}
项目:RNLearn_Project1    文件:ReactProgressBarViewManager.java   
@ReactProp(name = PROP_PROGRESS)
public void setProgress(ProgressBarContainerView view, double progress) {
  view.setProgress(progress);
}
项目:react-native-pili-live    文件:PiliPlayerViewManager.java   
@ReactProp(name = "source")
    public void setSource(PLVideoView mVideoView, ReadableMap source) {
        AVOptions options = new AVOptions();
        String uri = source.getString("uri");
        boolean mediaController = source.hasKey("controller") && source.getBoolean("controller");
        int avFrameTimeout = source.hasKey("timeout") ? source.getInt("timeout") : -1;        //10 * 1000 ms
        boolean liveStreaming = source.hasKey("live") && source.getBoolean("live");  //1 or 0 // 1 -> live
        boolean codec = source.hasKey("hardCodec") && source.getBoolean("hardCodec");  //1 or 0  // 1 -> hw codec enable, 0 -> disable [recommended]
        // the unit of timeout is ms
        if (avFrameTimeout >= 0) {
            options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        if (liveStreaming) {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
        } else {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
        }
//        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        if (codec) {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 1);
        } else {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 0);
        }

        mVideoView.setAVOptions(options);

        // After setVideoPath, the play will start automatically
        // mVideoView.start() is not required

        mVideoView.setVideoPath(uri);

//        if (mediaController) {
//            // You can also use a custom `MediaController` widget
//            MediaController mMediaController = new MediaController(reactContext, false, isLiveStreaming(uri));
//            mVideoView.setMediaController(mMediaController);
//        }

    }
项目:RNLearn_Project1    文件:SimpleViewPropertyTest.java   
@ReactProp(name = "bar")
public void setBar(View view, ReadableMap bar) {
}
项目:react-native-videoplayer    文件:ReactVideoViewManager.java   
@ReactProp(name = PROP_MUTED, defaultBoolean = false)
public void setMuted(final ReactVideoView videoView, final boolean muted) {
    videoView.setMutedModifier(muted);
}
项目:RNLearn_Project1    文件:RCTTextInput.java   
@ReactProp(name = PROP_TEXT)
public void setText(@Nullable String text) {
  mText = text;
  notifyChanged(true);
}
项目:RNLearn_Project1    文件:ReactViewManager.java   
@ReactProp(name = com.facebook.react.uimanager.ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS)
public void setRemoveClippedSubviews(ReactViewGroup view, boolean removeClippedSubviews) {
  view.setRemoveClippedSubviews(removeClippedSubviews);
}
项目:react-native-videoplayer    文件:ReactVideoViewManager.java   
@ReactProp(name = PROP_RATE)
public void setRate(final ReactVideoView videoView, final float rate) {
    videoView.setRateModifier(rate);
}