本文整理汇总了Java中com.facebook.react.bridge.ReadableType.Array方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableType.Array方法的具体用法?Java ReadableType.Array怎么用?Java ReadableType.Array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.react.bridge.ReadableType
的用法示例。
在下文中一共展示了ReadableType.Array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceIdConstraint
import com.facebook.react.bridge.ReadableType; //导入方法依赖的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;
}
示例2: parseMediaConstraints
import com.facebook.react.bridge.ReadableType; //导入方法依赖的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;
}
示例3: getArray
import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private ReadableArray getArray(ReadableMap map, String key) {
if (map.hasKey(key) && map.getType(key) == ReadableType.Array) {
return map.getArray(key);
}
return null;
}