本文整理匯總了Java中com.facebook.react.bridge.ReadableMap類的典型用法代碼示例。如果您正苦於以下問題:Java ReadableMap類的具體用法?Java ReadableMap怎麽用?Java ReadableMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ReadableMap類屬於com.facebook.react.bridge包,在下文中一共展示了ReadableMap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: capture
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
@ReactMethod
public void capture(final ReadableMap options, final Promise promise) {
int orientation = options.hasKey("orientation") ? options.getInt("orientation") : RCTCamera.getInstance().getOrientation();
if (orientation == RCT_CAMERA_ORIENTATION_AUTO) {
_sensorOrientationChecker.onResume();
_sensorOrientationChecker.registerOrientationListener(new RCTSensorOrientationListener() {
@Override
public void orientationEvent() {
int deviceOrientation = _sensorOrientationChecker.getOrientation();
_sensorOrientationChecker.unregisterOrientationListener();
_sensorOrientationChecker.onPause();
captureWithOrientation(options, promise, deviceOrientation);
}
});
} else {
captureWithOrientation(options, promise, orientation);
}
}
示例2: getSourceIdConstraint
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
/**
* Retreives "sourceId" constraint value.
* @param mediaConstraints a <tt>ReadableMap</tt> which represents "GUM"
* constraints argument
* @return String value of "sourceId" optional "GUM" constraint or
* <tt>null</tt> if not specified in the given map.
*/
private String getSourceIdConstraint(ReadableMap mediaConstraints) {
if (mediaConstraints.hasKey("optional")
&& mediaConstraints.getType("optional") == ReadableType.Array) {
ReadableArray optional = mediaConstraints.getArray("optional");
for (int i = 0, size = optional.size(); i < size; i++) {
if (optional.getType(i) == ReadableType.Map) {
ReadableMap option = optional.getMap(i);
if (option.hasKey("sourceId")
&& option.getType("sourceId") == ReadableType.String) {
return option.getString("sourceId");
}
}
}
}
return null;
}
示例3: FrescoBasedReactTextInlineImageSpan
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
public FrescoBasedReactTextInlineImageSpan(
Resources resources,
int height,
int width,
@Nullable Uri uri,
ReadableMap headers,
AbstractDraweeControllerBuilder draweeControllerBuilder,
@Nullable Object callerContext) {
mDraweeHolder = new DraweeHolder(
GenericDraweeHierarchyBuilder.newInstance(resources)
.build()
);
mDraweeControllerBuilder = draweeControllerBuilder;
mCallerContext = callerContext;
mHeight = height;
mWidth = width;
mUri = (uri != null) ? uri : Uri.EMPTY;
mHeaders = headers;
}
示例4: createFragmentArguments
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
private Bundle createFragmentArguments(ReadableMap options) {
final Bundle args = new Bundle();
if (options.hasKey(ARG_DATE) && !options.isNull(ARG_DATE)) {
args.putLong(ARG_DATE, (long) options.getDouble(ARG_DATE));
}
if (options.hasKey(ARG_MINDATE) && !options.isNull(ARG_MINDATE)) {
args.putLong(ARG_MINDATE, (long) options.getDouble(ARG_MINDATE));
}
if (options.hasKey(ARG_MAXDATE) && !options.isNull(ARG_MAXDATE)) {
args.putLong(ARG_MAXDATE, (long) options.getDouble(ARG_MAXDATE));
}
if (options.hasKey(ARG_MODE) && !options.isNull(ARG_MODE)) {
args.putString(ARG_MODE, options.getString(ARG_MODE));
}
return args;
}
示例5: createView
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
/**
* Invoked by React to create a new node with a given tag, class name and properties.
*/
public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
ReactShadowNode cssNode = createShadowNode(className);
ReactShadowNode rootNode = mShadowNodeRegistry.getNode(rootViewTag);
cssNode.setReactTag(tag);
cssNode.setViewClassName(className);
cssNode.setRootNode(rootNode);
cssNode.setThemedContext(rootNode.getThemedContext());
mShadowNodeRegistry.addNode(cssNode);
ReactStylesDiffMap styles = null;
if (props != null) {
styles = new ReactStylesDiffMap(props);
cssNode.updateProperties(styles);
}
handleCreateView(cssNode, rootViewTag, styles);
}
示例6: stackTraceToString
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
private String stackTraceToString(String message, ReadableArray stack) {
StringBuilder stringBuilder = new StringBuilder(message).append(", stack:\n");
for (int i = 0; i < stack.size(); i++) {
ReadableMap frame = stack.getMap(i);
stringBuilder
.append(frame.getString("methodName"))
.append("@")
.append(stackFrameToModuleId(frame))
.append(frame.getInt("lineNumber"));
if (frame.hasKey("column") &&
!frame.isNull("column") &&
frame.getType("column") == ReadableType.Number) {
stringBuilder
.append(":")
.append(frame.getInt("column"));
}
stringBuilder.append("\n");
}
return stringBuilder.toString();
}
示例7: startAnimatingNode
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
@ReactMethod
public void startAnimatingNode(
final int animationId,
final int animatedNodeTag,
final ReadableMap animationConfig,
final Callback endCallback) {
mOperations.add(new UIThreadOperation() {
@Override
public void execute(NativeAnimatedNodesManager animatedNodesManager) {
animatedNodesManager.startAnimatingNode(
animationId,
animatedNodeTag,
animationConfig,
endCallback);
}
});
}
示例8: testArrayWithMaps
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
public void testArrayWithMaps() {
mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnArrayWithMaps();
waitForBridgeAndUIIdle();
List<ReadableArray> calls = mRecordingTestModule.getArrayCalls();
assertEquals(1, calls.size());
ReadableArray array = calls.get(0);
assertEquals(2, array.size());
assertFalse(array.isNull(0));
ReadableMap m1 = array.getMap(0);
ReadableMap m2 = array.getMap(1);
assertEquals("m1v1", m1.getString("m1k1"));
assertEquals("m1v2", m1.getString("m1k2"));
assertEquals("m2v1", m2.getString("m2k1"));
}
示例9: createIntent
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
private Intent createIntent(String action, ReadableMap extra) {
final Intent intent = new Intent(action);
for (
ReadableMapKeySetIterator it = extra.keySetIterator();
it.hasNextKey();
) {
String key = it.nextKey();
ReadableType type = extra.getType(key);
switch(type) {
case Null:
break;
case Boolean:
intent.putExtra(key, extra.getBoolean(key));
break;
case Number:
intent.putExtra(key, extra.getInt(key));
break;
case String:
intent.putExtra(key, extra.getString(key));
break;
default:
throw new IllegalArgumentException("Unsupported type " + type);
}
}
return intent;
}
開發者ID:de-code,項目名稱:react-native-android-speech-recognizer,代碼行數:27,代碼來源:RNAndroidSpeechRecognizerModule.java
示例10: setTextShadowOffset
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
@ReactProp(name = PROP_SHADOW_OFFSET)
public void setTextShadowOffset(ReadableMap offsetMap) {
mTextShadowOffsetDx = 0;
mTextShadowOffsetDy = 0;
if (offsetMap != null) {
if (offsetMap.hasKey(PROP_SHADOW_OFFSET_WIDTH) &&
!offsetMap.isNull(PROP_SHADOW_OFFSET_WIDTH)) {
mTextShadowOffsetDx =
PixelUtil.toPixelFromDIP(offsetMap.getDouble(PROP_SHADOW_OFFSET_WIDTH));
}
if (offsetMap.hasKey(PROP_SHADOW_OFFSET_HEIGHT) &&
!offsetMap.isNull(PROP_SHADOW_OFFSET_HEIGHT)) {
mTextShadowOffsetDy =
PixelUtil.toPixelFromDIP(offsetMap.getDouble(PROP_SHADOW_OFFSET_HEIGHT));
}
}
markUpdated();
}
示例11: createChannel
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
@ReactMethod
public void createChannel(ReadableMap options, final Promise promise) {
final JSONObject attributes = RCTConvert.readableMapToJson(options.getMap("attributes"));
final String uniqueName = options.getString("uniqueName");
String friendlyName = options.getString("friendlyName");
Channel.ChannelType type = (options.getString("type").compareTo("CHANNEL_TYPE_PRIVATE") == 0) ? Channel.ChannelType.PRIVATE : Channel.ChannelType.PUBLIC;
channels().channelBuilder()
.withUniqueName(uniqueName)
.withFriendlyName(friendlyName)
.withType(type)
.withAttributes(attributes)
.build(new CallbackListener<Channel>() {
@Override
public void onError(final ErrorInfo errorInfo) {
super.onError(errorInfo);
promise.reject("create-channel-error", "Error occurred while attempting to createChannel.");
}
@Override
public void onSuccess(final Channel newChannel) {
promise.resolve(RCTConvert.Channel(newChannel));
}
});
}
示例12: setActions
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
public void setActions(@Nullable ReadableArray actions) {
Menu menu = getMenu();
menu.clear();
mActionsHolder.clear();
if (actions != null) {
for (int i = 0; i < actions.size(); i++) {
ReadableMap action = actions.getMap(i);
MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString("title"));
setMenuItemIcon(item, action.getMap("icon"));
if (action.getBoolean("disabled")) {
item.setEnabled(false);
}
}
}
}
示例13: setIconSource
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
private void setIconSource(ReadableMap source, IconControllerListener controllerListener,
DraweeHolder holder) {
String uri = source != null ? source.getString("uri") : null;
if (uri == null) {
controllerListener.setIconImageInfo(null);
controllerListener.setDrawable(null);
} else if (uri.startsWith("http://") || uri.startsWith("https://") ||
uri.startsWith("file://")) {
controllerListener.setIconImageInfo(getIconImageInfo(source));
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse(uri))
.setControllerListener(controllerListener)
.setOldController(holder.getController())
.build();
holder.setController(controller);
holder.getTopLevelDrawable().setVisible(true, true);
} else {
controllerListener.setDrawable(getDrawableByName(uri));
}
}
示例14: getView
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
private View getView(int position, View convertView, ViewGroup parent, boolean isDropdown) {
ReadableMap item = getItem(position);
if (convertView == null) {
int layoutResId = isDropdown
? android.R.layout.simple_spinner_dropdown_item
: android.R.layout.simple_spinner_item;
convertView = mInflater.inflate(layoutResId, parent, false);
}
TextView textView = (TextView) convertView;
textView.setText(item.getString("label"));
if (!isDropdown && mPrimaryTextColor != null) {
textView.setTextColor(mPrimaryTextColor);
} else if (item.hasKey("color") && !item.isNull("color")) {
textView.setTextColor(item.getInt("color"));
}
return convertView;
}
示例15: buildColorStateList
import com.facebook.react.bridge.ReadableMap; //導入依賴的package包/類
private ColorStateList buildColorStateList(ReadableMap colorMap) {
int[][] states = new int[][] {
new int[] { android.R.attr.state_checked },
new int[] {-android.R.attr.state_enabled },
new int[] { },
};
Map<String, String> colorStates = unifyColors(colorMap);
int[] colors = new int[] {
Color.parseColor(colorStates.get("active")),
Color.parseColor(colorStates.get("disabled")),
Color.parseColor(colorStates.get("default"))
};
return new ColorStateList(states, colors);
}
開發者ID:timomeh,項目名稱:react-native-android-bottom-navigation,代碼行數:18,代碼來源:RNBottomNavigationManager.java