本文整理汇总了Java中com.facebook.react.bridge.ReadableArray.size方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableArray.size方法的具体用法?Java ReadableArray.size怎么用?Java ReadableArray.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.react.bridge.ReadableArray
的用法示例。
在下文中一共展示了ReadableArray.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setChildren
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
* An optimized version of manageChildren that is used for initial setting of child views.
* The children are assumed to be in index order
*
* @param viewTag tag of the parent
* @param childrenTags tags of the children
*/
public void setChildren(
int viewTag,
ReadableArray childrenTags) {
ReactShadowNode cssNodeToManage = mShadowNodeRegistry.getNode(viewTag);
for (int i = 0; i < childrenTags.size(); i++) {
ReactShadowNode cssNodeToAdd = mShadowNodeRegistry.getNode(childrenTags.getInt(i));
if (cssNodeToAdd == null) {
throw new IllegalViewOperationException("Trying to add unknown view tag: "
+ childrenTags.getInt(i));
}
cssNodeToManage.addChildAt(cssNodeToAdd, i);
}
if (!cssNodeToManage.isVirtual() && !cssNodeToManage.isVirtualAnchor()) {
mNativeViewHierarchyOptimizer.handleSetChildren(
cssNodeToManage,
childrenTags);
}
}
示例2: convertJsStackTrace
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
* Convert a JavaScript stack trace (see {@code parseErrorStack} JS module) to an array of
* {@link StackFrame}s.
*/
public static StackFrame[] convertJsStackTrace(@Nullable ReadableArray stack) {
int size = stack != null ? stack.size() : 0;
StackFrame[] result = new StackFrame[size];
for (int i = 0; i < size; i++) {
ReadableMap frame = stack.getMap(i);
String methodName = frame.getString("methodName");
String fileName = frame.getString("file");
int lineNumber = -1;
if (frame.hasKey(LINE_NUMBER_KEY) && !frame.isNull(LINE_NUMBER_KEY)) {
lineNumber = frame.getInt(LINE_NUMBER_KEY);
}
int columnNumber = -1;
if (frame.hasKey(COLUMN_KEY) && !frame.isNull(COLUMN_KEY)) {
columnNumber = frame.getInt(COLUMN_KEY);
}
result[i] = new StackFrameImpl(fileName, methodName, lineNumber, columnNumber);
}
return result;
}
示例3: convertArrayToJson
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private static JSONArray convertArrayToJson(ReadableArray readableArray) throws JSONException {
JSONArray array = new JSONArray();
for (int i = 0; i < readableArray.size(); i++) {
switch (readableArray.getType(i)) {
case Null:
break;
case Boolean:
array.put(readableArray.getBoolean(i));
break;
case Number:
array.put(readableArray.getDouble(i));
break;
case String:
array.put(readableArray.getString(i));
break;
case Map:
array.put(convertMapToJson(readableArray.getMap(i)));
break;
case Array:
array.put(convertArrayToJson(readableArray.getArray(i)));
break;
}
}
return array;
}
示例4: AdditionAnimatedNode
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public AdditionAnimatedNode(
ReadableMap config,
NativeAnimatedNodesManager nativeAnimatedNodesManager) {
mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
ReadableArray inputNodes = config.getArray("input");
mInputNodes = new int[inputNodes.size()];
for (int i = 0; i < mInputNodes.length; i++) {
mInputNodes[i] = inputNodes.getInt(i);
}
}
示例5: parseMediaConstraints
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
* Parses mandatory and optional "GUM" constraints described by a specific
* <tt>ReadableMap</tt>.
*
* @param constraints A <tt>ReadableMap</tt> which represents a JavaScript
* object specifying the constraints to be parsed into a
* <tt>MediaConstraints</tt> instance.
* @return A new <tt>MediaConstraints</tt> instance initialized with the
* mandatory and optional constraint keys and values specified by
* <tt>constraints</tt>.
*/
private MediaConstraints parseMediaConstraints(ReadableMap constraints) {
MediaConstraints mediaConstraints = new MediaConstraints();
if (constraints.hasKey("mandatory")
&& constraints.getType("mandatory") == ReadableType.Map) {
parseConstraints(
constraints.getMap("mandatory"),
mediaConstraints.mandatory);
} else {
Log.d(TAG, "mandatory constraints are not a map");
}
if (constraints.hasKey("optional")
&& constraints.getType("optional") == ReadableType.Array) {
ReadableArray optional = constraints.getArray("optional");
for (int i = 0, size = optional.size(); i < size; i++) {
if (optional.getType(i) == ReadableType.Map) {
parseConstraints(
optional.getMap(i),
mediaConstraints.optional);
}
}
} else {
Log.d(TAG, "optional constraints are not an array");
}
return mediaConstraints;
}
示例6: toJSONArray
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static JSONArray toJSONArray(ReadableArray readableArray) throws JSONException {
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < readableArray.size(); i++) {
ReadableType type = readableArray.getType(i);
switch (type) {
case Null:
jsonArray.put(i, null);
break;
case Boolean:
jsonArray.put(i, readableArray.getBoolean(i));
break;
case Number:
jsonArray.put(i, readableArray.getDouble(i));
break;
case String:
jsonArray.put(i, readableArray.getString(i));
break;
case Map:
jsonArray.put(i, MapUtil.toJSONObject(readableArray.getMap(i)));
break;
case Array:
jsonArray.put(i, ArrayUtil.toJSONArray(readableArray.getArray(i)));
break;
}
}
return jsonArray;
}
示例7: setColors
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@ReactProp(name = "colors", customType = "ColorArray")
public void setColors(ReactSwipeRefreshLayout view, @Nullable ReadableArray colors) {
if (colors != null) {
int[] colorValues = new int[colors.size()];
for (int i = 0; i < colors.size(); i++) {
colorValues[i] = colors.getInt(i);
}
view.setColorSchemeColors(colorValues);
} else {
view.setColorSchemeColors();
}
}
示例8: FrameBasedAnimationDriver
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
FrameBasedAnimationDriver(ReadableMap config) {
ReadableArray frames = config.getArray("frames");
int numberOfFrames = frames.size();
mFrames = new double[numberOfFrames];
for (int i = 0; i < numberOfFrames; i++) {
mFrames[i] = frames.getDouble(i);
}
mToValue = config.getDouble("toValue");
mIterations = config.hasKey("iterations") ? config.getInt("iterations") : 1;
mCurrentLoop = 1;
mHasFinished = mIterations == 0;
}
示例9: readableArrayToStringArray
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static String[] readableArrayToStringArray(ReadableArray readableArray) {
String[] arr = new String[readableArray.size()];
for (int i = 0; i < readableArray.size(); i++) {
arr[i] = readableArray.getString(i);
}
return arr;
}
示例10: setSource
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@ReactProp(name = "src")
public void setSource(@Nullable ReadableArray sources) {
final String source =
(sources == null || sources.size() == 0) ? null : sources.getMap(0).getString("uri");
final ImageSource imageSource = source == null ? null :
new ImageSource(getThemedContext(), source);
getMutableSpan().setImageRequest(imageSource == null ? null :
ImageRequestBuilder.newBuilderWithSource(imageSource.getUri()).build());
}
示例11: readableArrayToLongArray
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static long[] readableArrayToLongArray(ReadableArray readableArray) {
long[] arr = new long[readableArray.size()];
for (int i = 0; i < readableArray.size(); i++) {
arr[i] = (long)readableArray.getDouble(i);
}
return arr;
}
示例12: MultiplicationAnimatedNode
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public MultiplicationAnimatedNode(
ReadableMap config,
NativeAnimatedNodesManager nativeAnimatedNodesManager) {
mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
ReadableArray inputNodes = config.getArray("input");
mInputNodes = new int[inputNodes.size()];
for (int i = 0; i < mInputNodes.length; i++) {
mInputNodes[i] = inputNodes.getInt(i);
}
}
示例13: readableArrayToIntArray
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static int[] readableArrayToIntArray(ReadableArray readableArray) {
int[] arr = new int[readableArray.size()];
for (int i = 0; i < readableArray.size(); i++) {
arr[i] = readableArray.getInt(i);
}
return arr;
}
示例14: readableArrayToByteBoolArray
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static byte[] readableArrayToByteBoolArray(ReadableArray readableArray) {
byte[] bytesArr = new byte[readableArray.size() / 8 + 1];
for (int entry = 0; entry < bytesArr.length; entry++) {
for (int bit = 0; bit < 8; bit++) {
if (readableArray.getBoolean(entry * 8 + bit)) {
bytesArr[entry] |= (128 >> bit);
}
}
}
return bytesArr;
}
示例15: addAnimatedEventToView
import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public void addAnimatedEventToView(int viewTag, String eventName, ReadableMap eventMapping) {
int nodeTag = eventMapping.getInt("animatedValueTag");
AnimatedNode node = mAnimatedNodes.get(nodeTag);
if (node == null) {
throw new JSApplicationIllegalArgumentException("Animated node with tag " + nodeTag +
" does not exists");
}
if (!(node instanceof ValueAnimatedNode)) {
throw new JSApplicationIllegalArgumentException("Animated node connected to event should be" +
"of type " + ValueAnimatedNode.class.getName());
}
ReadableArray path = eventMapping.getArray("nativeEventPath");
List<String> pathList = new ArrayList<>(path.size());
for (int i = 0; i < path.size(); i++) {
pathList.add(path.getString(i));
}
EventAnimationDriver event = new EventAnimationDriver(pathList, (ValueAnimatedNode) node);
String key = viewTag + eventName;
if (mEventDrivers.containsKey(key)) {
mEventDrivers.get(key).add(event);
} else {
List<EventAnimationDriver> drivers = new ArrayList<>(1);
drivers.add(event);
mEventDrivers.put(key, drivers);
}
}