当前位置: 首页>>代码示例>>Java>>正文


Java ReadableType.String方法代码示例

本文整理汇总了Java中com.facebook.react.bridge.ReadableType.String方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableType.String方法的具体用法?Java ReadableType.String怎么用?Java ReadableType.String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.bridge.ReadableType的用法示例。


在下文中一共展示了ReadableType.String方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:26,代码来源:WebRTCModule.java

示例2: getStringArray

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private String[] getStringArray(ReadableMap map, String key) {
    ReadableArray array = getArray(map, key);
    if (array == null) return null;

    ArrayList<String> list = new ArrayList<>();
    for (int i = 0; i < array.size(); i++) {
        if (array.getType(i) == ReadableType.String) {
            String str = array.getString(i);
            if (!isEmpty(str)) {
                list.add(str);
            }
        }
    }

    String[] arr = new String[list.size()];
    return list.toArray(arr);
}
 
开发者ID:joonhocho,项目名称:react-native-mail-compose,代码行数:18,代码来源:RNMailComposeModule.java

示例3: buildCreateQuery

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private StringBuilder buildCreateQuery(String tableName, ReadableMap props, List<String> keys) {
    final StringBuilder queryBuilder = new StringBuilder("CREATE TABLE IF NOT EXISTS ").append(tableName).append(" ");
    queryBuilder.append("(");
    queryBuilder.append("id INTEGER PRIMARY KEY AUTOINCREMENT");
    for (String key : keys) {
        String propType = null;
        if(props.getType(key) == ReadableType.Boolean) {
            propType = "BOOLEAN";
        } else if(props.getType(key) == ReadableType.String) {
            propType = "TEXT";
        } else if(props.getType(key) == ReadableType.Number) {
            propType = "DOUBLE";
        }

        if(propType != null) {
            queryBuilder.append(", ").append(key).append(" ").append(propType);
        }
    }
    queryBuilder.append(")");
    return queryBuilder;
}
 
开发者ID:reneweb,项目名称:rnrecord,代码行数:22,代码来源:SaveCommand.java

示例4: buildQueryArgument

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private ArrayList<String> buildQueryArgument(List<String> keys, ReadableMap query) {
    final ArrayList<String> arguments = new ArrayList<>();

    for (String key : keys) {
        ReadableType type = query.getType(key);
        if(type == ReadableType.Boolean) {
            arguments.add(String.valueOf(query.getBoolean(key)));
        } else if(type == ReadableType.Number) {
            arguments.add(String.valueOf(query.getDouble(key)));
        } else if(type == ReadableType.String) {
            arguments.add(String.valueOf(query.getString(key)));
        }
    }

    return arguments;
}
 
开发者ID:reneweb,项目名称:rnrecord,代码行数:17,代码来源:FindCommand.java

示例5: setFromDynamic

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
void setFromDynamic(Dynamic dynamic) {
  if (dynamic.isNull()) {
    unit = YogaUnit.UNDEFINED;
    value = YogaConstants.UNDEFINED;
  } else if (dynamic.getType() == ReadableType.String) {
    final String s = dynamic.asString();
    if (s.equals("auto")) {
      unit = YogaUnit.AUTO;
      value = YogaConstants.UNDEFINED;
    } else if (s.endsWith("%")) {
      unit = YogaUnit.PERCENT;
      value = Float.parseFloat(s.substring(0, s.length() - 1));
    } else {
      throw new IllegalArgumentException("Unknown value: " + s);
    }
  } else {
    unit = YogaUnit.POINT;
    value = PixelUtil.toPixelFromDIP(dynamic.asDouble());
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:LayoutShadowNode.java

示例6: convertToRadians

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private static double convertToRadians(ReadableMap transformMap, String key) {
  double value;
  boolean inRadians = true;
  if (transformMap.getType(key) == ReadableType.String) {
    String stringValue = transformMap.getString(key);
    if (stringValue.endsWith("rad")) {
      stringValue = stringValue.substring(0, stringValue.length() - 3);
    } else if (stringValue.endsWith("deg")) {
      inRadians = false;
      stringValue = stringValue.substring(0, stringValue.length() - 3);
    }
    value = Float.parseFloat(stringValue);
  } else {
    value = transformMap.getDouble(key);
  }
  return inRadians ? value : MatrixMathHelper.degreesToRadians(value);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:TransformHelper.java

示例7: getUserProperties

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private Map<String, Object> getUserProperties(ReadableMap properties) {
    ReadableMapKeySetIterator iterator = properties.keySetIterator();
    Map<String, Object> userProperties = new HashMap<>();

    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        ReadableType type = properties.getType(key);
        if (type == ReadableType.Boolean) {
            userProperties.put(key, properties.getBoolean(key));
        } else if (type == ReadableType.Number) {
            userProperties.put(key, properties.getDouble(key));
        } else if (type == ReadableType.String) {
            userProperties.put(key, properties.getString(key));
        }
    }

    return userProperties;
}
 
开发者ID:smooch,项目名称:react-native-smooch,代码行数:19,代码来源:ReactNativeSmooch.java

示例8: getBlob

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private byte[] getBlob(ReadableMap map, String key) {
    if (map.hasKey(key) && map.getType(key) == ReadableType.String) {
        String base64 = map.getString(key);
        if (base64 != null && !base64.isEmpty()) {
            return Base64.decode(base64, 0);
        }
    }
    return null;
}
 
开发者ID:joonhocho,项目名称:react-native-message-compose,代码行数:10,代码来源:RNMessageComposeModule.java

示例9: getBlobFromUri

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private byte[] getBlobFromUri(ReadableMap map, String key) {
    if (map.hasKey(key) && map.getType(key) == ReadableType.String) {
        String uri = map.getString(key);
        if (uri != null && !uri.isEmpty()) {
            return byteArrayFromUrl(uri);
        }
    }
    return null;
}
 
开发者ID:joonhocho,项目名称:react-native-message-compose,代码行数:10,代码来源:RNMessageComposeModule.java

示例10: prepareInsertContentValues

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private ContentValues prepareInsertContentValues(ReadableMap props, List<String> keys) {
    final ContentValues contentValues = new ContentValues();
    for (String key : keys) {
        if(props.getType(key) == ReadableType.Boolean) {
            contentValues.put(key, props.getBoolean(key));
        } else if(props.getType(key) == ReadableType.Number) {
            contentValues.put(key, props.getDouble(key));
        } else if(props.getType(key) == ReadableType.String) {
            contentValues.put(key, props.getString(key));
        }
    }
    return contentValues;
}
 
开发者ID:reneweb,项目名称:rnrecord,代码行数:14,代码来源:SaveCommand.java

示例11: prepareUpdateContentValues

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private ContentValues prepareUpdateContentValues(ReadableMap props, List<String> keys) {
    final ContentValues contentValues = new ContentValues();
    for (String key : keys) {
        if(props.getType(key) == ReadableType.Boolean) {
            contentValues.put(key, props.getBoolean(key));
        } else if(props.getType(key) == ReadableType.Number) {
            contentValues.put(key, props.getDouble(key));
        } else if(props.getType(key) == ReadableType.String) {
            contentValues.put(key, props.getString(key));
        }
    }
    return contentValues;
}
 
开发者ID:reneweb,项目名称:rnrecord,代码行数:14,代码来源:UpdateCommand.java

示例12: stackFrameToModuleId

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
static private String stackFrameToModuleId(ReadableMap frame) {
  if (frame.hasKey("file") &&
      !frame.isNull("file") &&
      frame.getType("file") == ReadableType.String) {
    final Matcher matcher = mJsModuleIdPattern.matcher(frame.getString("file"));
    if (matcher.find()) {
      return matcher.group(1) + ":";
    }
  }
  return "";
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:ExceptionsManagerModule.java

示例13: stackFrameToModuleId

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
static private String stackFrameToModuleId(ReadableMap frame) {
    if (frame.hasKey("file") &&
            !frame.isNull("file") &&
            frame.getType("file") == ReadableType.String) {
        final Matcher matcher = mJsModuleIdPattern.matcher(frame.getString("file"));
        if (matcher.find()) {
            return matcher.group(1) + ":";
        }
    }
    return "";
}
 
开发者ID:Richard-Cao,项目名称:react-native-exceptions-manager,代码行数:12,代码来源:ExceptionsManagerModule.java

示例14: stackFrameToModuleId

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
private static String stackFrameToModuleId(ReadableMap frame) {
    if (frame.hasKey("file") &&
            !frame.isNull("file") &&
            frame.getType("file") == ReadableType.String) {
        final Matcher matcher = mJsModuleIdPattern.matcher(frame.getString("file"));
        if (matcher.find()) {
            return matcher.group(1) + ":";
        }
    }
    return "";
}
 
开发者ID:getsentry,项目名称:react-native-sentry,代码行数:12,代码来源:RNSentryModule.java

示例15: send

import com.facebook.react.bridge.ReadableType; //导入方法依赖的package包/类
@ReactMethod
public void send(String senderId, String messageId, String messageType, ReadableMap params, final Callback callback) {
    FirebaseMessaging fm = FirebaseMessaging.getInstance();
    RemoteMessage.Builder remoteMessage = new RemoteMessage.Builder(senderId);
    remoteMessage.setMessageId(messageId);
    remoteMessage.setMessageType(messageType);
    ReadableMapKeySetIterator iterator = params.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        ReadableType type = params.getType(key);
        if (type == ReadableType.String) {
            remoteMessage.addData(key, params.getString(key));
            Log.d(TAG, "Firebase send: " + key);
            Log.d(TAG, "Firebase send: " + params.getString(key));
        }
    }
    try {
        fm.send(remoteMessage.build());
        WritableMap res = Arguments.createMap();
        res.putString("status", "success");
        callback.invoke(null, res);
    } catch(Exception e) {
        Log.e(TAG, "Error sending message", e);
        WritableMap error = Arguments.createMap();
        error.putString("code", e.toString());
        error.putString("message", e.toString());
        callback.invoke(error);
    }
}
 
开发者ID:fullstackreact,项目名称:react-native-firestack,代码行数:30,代码来源:FirestackCloudMessaging.java


注:本文中的com.facebook.react.bridge.ReadableType.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。