@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();
}
java类com.facebook.react.uimanager.annotations.ReactProp的实例源码
LayoutShadowNode.java 文件源码
项目:RNLearn_Project1
阅读 32
收藏 0
点赞 0
评论 0
ReactTextInputManager.java 文件源码
项目:RNLearn_Project1
阅读 23
收藏 0
点赞 0
评论 0
@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);
}
PiliStreamingViewManager.java 文件源码
项目:react-native-pili-live
阅读 25
收藏 0
点赞 0
评论 0
@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);
}
RCTVirtualText.java 文件源码
项目:RNLearn_Project1
阅读 28
收藏 0
点赞 0
评论 0
@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);
}
}
ReactTextInputManager.java 文件源码
项目:RNLearn_Project1
阅读 22
收藏 0
点赞 0
评论 0
@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);
}
LayoutShadowNode.java 文件源码
项目:RNLearn_Project1
阅读 44
收藏 0
点赞 0
评论 0
@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();
}
RCTVirtualText.java 文件源码
项目:RNLearn_Project1
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
}
RCTCameraViewManager.java 文件源码
项目:react-native-camera-face-detector
阅读 25
收藏 0
点赞 0
评论 0
@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);
}
ReactPropAnnotationSetterSpecTest.java 文件源码
项目:RNLearn_Project1
阅读 24
收藏 0
点赞 0
评论 0
@Test(expected = RuntimeException.class)
public void testUnsupportedPropValueType() {
new BaseViewManager() {
@ReactProp(name = "prop")
public void setterWithUnsupportedValueType(View v, Date value) {
}
}.getNativeProps();
}
ARTGroupShadowNode.java 文件源码
项目:RNLearn_Project1
阅读 29
收藏 0
点赞 0
评论 0
@ReactProp(name = "clipping")
public void setClipping(@Nullable ReadableArray clippingDims) {
float[] clippingData = PropHelper.toFloatArray(clippingDims);
if (clippingData != null) {
mClipping = createClipping(clippingData);
markUpdated();
}
}
BaseViewManager.java 文件源码
项目:RNLearn_Project1
阅读 28
收藏 0
点赞 0
评论 0
@ReactProp(name = PROP_TRANSFORM)
public void setTransform(T view, ReadableArray matrix) {
if (matrix == null) {
resetTransformProperty(view);
} else {
setTransformProperty(view, matrix);
}
}
PiliStreamingViewManager.java 文件源码
项目:react-native-pili-live
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
ReactPropAnnotationSetterSpecTest.java 文件源码
项目:RNLearn_Project1
阅读 30
收藏 0
点赞 0
评论 0
@Test(expected = RuntimeException.class)
public void testUnsupportedPropValueType() {
new BaseViewManager() {
@ReactProp(name = "prop")
public void setterWithUnsupportedValueType(View v, Date value) {
}
}.getNativeProps();
}
CrosswalkWebViewGroupManager.java 文件源码
项目:react-native-android-new-crosswalk
阅读 24
收藏 0
点赞 0
评论 0
@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);
}
RCTCameraViewManager.java 文件源码
项目:react-native-camera-face-detector
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
ReactPropAnnotationSetterSpecTest.java 文件源码
项目:RNLearn_Project1
阅读 31
收藏 0
点赞 0
评论 0
@Test(expected = RuntimeException.class)
public void testSetterWIthNonViewParam() {
new BaseViewManager() {
@ReactProp(name = "prop")
public void setterWithNonViewParam(Object v, boolean value) {
}
}.getNativeProps();
}
CollapsingToolbarLayoutManager.java 文件源码
项目:react-native-collapsing-toolbar
阅读 33
收藏 0
点赞 0
评论 0
@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)
);
}
LayoutShadowNode.java 文件源码
项目:RNLearn_Project1
阅读 29
收藏 0
点赞 0
评论 0
@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);
}
}
}
ReactTextInputManager.java 文件源码
项目:RNLearn_Project1
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
}
BaseViewManager.java 文件源码
项目:RNLearn_Project1
阅读 21
收藏 0
点赞 0
评论 0
@ReactProp(name = PROP_TRANSFORM)
public void setTransform(T view, ReadableArray matrix) {
if (matrix == null) {
resetTransformProperty(view);
} else {
setTransformProperty(view, matrix);
}
}
ReactTextShadowNode.java 文件源码
项目:RNLearn_Project1
阅读 25
收藏 0
点赞 0
评论 0
@ReactProp(name = PROP_SHADOW_RADIUS, defaultInt = 1)
public void setTextShadowRadius(float textShadowRadius) {
if (textShadowRadius != mTextShadowRadius) {
mTextShadowRadius = textShadowRadius;
markUpdated();
}
}
ReactImageManager.java 文件源码
项目:RNLearn_Project1
阅读 24
收藏 0
点赞 0
评论 0
@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+ "'");
}
}
ReactTextShadowNode.java 文件源码
项目:RNLearn_Project1
阅读 38
收藏 0
点赞 0
评论 0
@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();
}
ReactPickerManager.java 文件源码
项目:RNLearn_Project1
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
}
PiliLiveViewManager.java 文件源码
项目:react-native-pili-player
阅读 26
收藏 0
点赞 0
评论 0
@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);
// }
}
ReactSwitchManager.java 文件源码
项目:RNLearn_Project1
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
}
ReactWebViewManager.java 文件源码
项目:RNLearn_Project1
阅读 36
收藏 0
点赞 0
评论 0
@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);
}
}
ReactWebViewManager.java 文件源码
项目:RNLearn_Project1
阅读 30
收藏 0
点赞 0
评论 0
@ReactProp(name = "onContentSizeChange")
public void setOnContentSizeChange(WebView view, boolean sendContentSizeChangeEvents) {
if (sendContentSizeChangeEvents) {
view.setPictureListener(getPictureListener());
} else {
view.setPictureListener(null);
}
}
PiliPlayerViewManager.java 文件源码
项目:pili-react-native
阅读 25
收藏 0
点赞 0
评论 0
@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());
}
}
ReactExoplayerViewManager.java 文件源码
项目:react-native-videoplayer
阅读 29
收藏 0
点赞 0
评论 0
@ReactProp(name = PROP_REPEAT, defaultBoolean = false)
public void setRepeat(final ReactExoplayerView videoView, final boolean repeat) {
videoView.setRepeatModifier(repeat);
}