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


Java ReadableMap.getString方法代码示例

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


在下文中一共展示了ReadableMap.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapGetByType

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private void mapGetByType(ReadableMap map, String key, String typeToAskFor) {
  if (typeToAskFor.equals("double")) {
    map.getDouble(key);
  } else if (typeToAskFor.equals("int")) {
    map.getInt(key);
  } else if (typeToAskFor.equals("string")) {
    map.getString(key);
  } else if (typeToAskFor.equals("array")) {
    map.getArray(key);
  } else if (typeToAskFor.equals("map")) {
    map.getMap(key);
  } else if (typeToAskFor.equals("boolean")) {
    map.getBoolean(key);
  } else {
    throw new RuntimeException("Unknown type: " + typeToAskFor);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:CatalystNativeJSToJavaParametersTestCase.java

示例2: peerConnectionAddICECandidate

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactMethod
public void peerConnectionAddICECandidate(ReadableMap candidateMap, final int id, final Callback callback) {
    boolean result = false;
    PeerConnection peerConnection = getPeerConnection(id);
    Log.d(TAG, "peerConnectionAddICECandidate() start");
    if (peerConnection != null) {
        IceCandidate candidate = new IceCandidate(
            candidateMap.getString("sdpMid"),
            candidateMap.getInt("sdpMLineIndex"),
            candidateMap.getString("candidate")
        );
        result = peerConnection.addIceCandidate(candidate);
    } else {
        Log.d(TAG, "peerConnectionAddICECandidate() peerConnection is null");
    }
    callback.invoke(result);
    Log.d(TAG, "peerConnectionAddICECandidate() end");
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:19,代码来源:WebRTCModule.java

示例3: setIconSource

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * Sets an icon for a specific icon source. If the uri indicates an icon
 * to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it.
 * Otherwise it loads the Drawable from the Resources and directly returns it via a callback
 */
private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) {

  String uri = source != null ? source.getString(PROP_ICON_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));
  }

}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:ReactToolbar.java

示例4: convertToRadians

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的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

示例5: setSource

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * 设置source属性,包括是否是直播流,解码类型,准备时长,是否有缓存等
 *
 * @param plVideoTextureView
 * @param source
 */
@ReactProp(name = "source")
public void setSource(PLVideoTextureView plVideoTextureView, ReadableMap source) {
    AVOptions avOptions = new AVOptions();
     uri = source.getString("uri");//视频连接地址
    //得到解码类型
    int mediaCodec = source.hasKey("mediaCodec") ? source.getInt("mediaCodec") : AVOptions.MEDIA_CODEC_SW_DECODE;
    //得到视频准备时间
    int timeout = source.hasKey("timeout") ? source.getInt("timeout") : 10 * 1000;
    //得到是否是直播流
    boolean liveStreaming = source.hasKey("liveStreaming") ? source.getBoolean("liveStreaming") : false;
    //得到是否应用缓存
    boolean cache = source.hasKey("cache") ? source.getBoolean("cache") : false;
    boolean started=source.hasKey("started")?source.getBoolean("started"):true;
    avOptions.setInteger(AVOptions.KEY_MEDIACODEC, mediaCodec);
    avOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, timeout);
    avOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, liveStreaming ? 1 : 0);
    if (!liveStreaming && cache) {
        avOptions.setString(AVOptions.KEY_CACHE_DIR, Config.DEFAULT_CACHE_DIR);
    }
    plVideoTextureView.setAVOptions(avOptions);
    //MediaController mediaController = new MediaController(themedReactContext, !liveStreaming, liveStreaming);
   // plVideoTextureView.setMediaController(mediaController);
    plVideoTextureView.setVideoPath(uri);
}
 
开发者ID:2534290808,项目名称:react-native-android-piliplayer,代码行数:31,代码来源:PLVideoTextureViewManager.java

示例6: 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));
                }
            });
}
 
开发者ID:ccm-innovation,项目名称:react-native-twilio-chat,代码行数:26,代码来源:RCTTwilioChatChannels.java

示例7: getHeaders

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private Map<String, String> getHeaders(ReadableMap readableMap) {
  if (readableMap == null) {
      return null;
  }
  ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
  Map<String, String> map = new HashMap<>();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    String value = readableMap.getString(key);
    map.put(key, value);
  }
  return map;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:14,代码来源:ReactOkHttpNetworkFetcher.java

示例8: getBlobFromUri

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的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-mail-compose,代码行数:10,代码来源:RNMailComposeModule.java

示例9: setSource

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@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);
//        }

    }
 
开发者ID:An-uking,项目名称:react-native-pili-player,代码行数:38,代码来源:PiliLiveViewManager.java

示例10: createRequest

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public DownloadManager.Request createRequest(String url, ReadableMap headers, ReadableMap requestConfig) {
    String downloadTitle = requestConfig.getString("downloadTitle");
    String downloadDescription = requestConfig.getString("downloadTitle");
    String saveAsName = requestConfig.getString("saveAsName");
    Boolean allowedInRoaming = requestConfig.getBoolean("allowedInRoaming");
    Boolean allowedInMetered = requestConfig.getBoolean("allowedInMetered");
    Boolean showInDownloads = requestConfig.getBoolean("showInDownloads");

    Uri downloadUri = Uri.parse(url);
    DownloadManager.Request request = new DownloadManager.Request(downloadUri);

    ReadableMapKeySetIterator iterator = headers.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        request.addRequestHeader(key, headers.getString(key));
    }

    request.setTitle(downloadTitle);
    request.setDescription(downloadDescription);
    request.setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, saveAsName);
    request.setAllowedOverRoaming(allowedInRoaming);
    request.setAllowedOverMetered(allowedInMetered);
    request.setVisibleInDownloadsUi(showInDownloads);
    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    return request;
}
 
开发者ID:master-atul,项目名称:react-native-simple-download-manager,代码行数:28,代码来源:Downloader.java

示例11: hasAndNotEmpty

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static @NonNull boolean hasAndNotEmpty(@NonNull final ReadableMap target,
                                              @NonNull final String key)
{
    if (!target.hasKey(key))
    {
        return false;
    }

    final String value = target.getString(key);

    return !TextUtils.isEmpty(value);
}
 
开发者ID:lennyup,项目名称:react-native-udesk,代码行数:13,代码来源:UdeskModule.java

示例12: getAssets

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactMethod
public void getAssets(final ReadableMap params, final Promise promise) {
    String start = params.hasKey("start") ? params.getString("start") : null;
    int limit = params.getInt("limit");
    String assetType = params.getString("assetType");

    new GetAssetsTask(
            getReactApplicationContext(),
            start,
            limit,
            assetType,
            promise)
            .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
开发者ID:chrisbianca,项目名称:react-native-cameraroll,代码行数:15,代码来源:RNCameraRollModule.java

示例13: getBlob

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的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-mail-compose,代码行数:10,代码来源:RNMailComposeModule.java

示例14: startAnimatingNode

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public void startAnimatingNode(
  int animationId,
  int animatedNodeTag,
  ReadableMap animationConfig,
  Callback endCallback) {
  AnimatedNode node = mAnimatedNodes.get(animatedNodeTag);
  if (node == null) {
    throw new JSApplicationIllegalArgumentException("Animated node with tag " + animatedNodeTag +
      " does not exists");
  }
  if (!(node instanceof ValueAnimatedNode)) {
    throw new JSApplicationIllegalArgumentException("Animated node should be of type " +
      ValueAnimatedNode.class.getName());
  }
  String type = animationConfig.getString("type");
  final AnimationDriver animation;
  if ("frames".equals(type)) {
    animation = new FrameBasedAnimationDriver(animationConfig);
  } else if ("spring".equals(type)) {
    animation = new SpringAnimation(animationConfig);
  } else if ("decay".equals(type)) {
    animation = new DecayAnimation(animationConfig);
  } else {
    throw new JSApplicationIllegalArgumentException("Unsupported animation type: " + type);
  }
  animation.mId = animationId;
  animation.mEndCallback = endCallback;
  animation.mAnimatedValue = (ValueAnimatedNode) node;
  mActiveAnimations.put(animationId, animation);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:31,代码来源:NativeAnimatedNodesManager.java

示例15: setSource

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactProp(name = "source")
public void setSource(WebView view, @Nullable ReadableMap source) {
  if (source != null) {
    if (source.hasKey("html")) {
      String html = source.getString("html");
      if (source.hasKey("baseUrl")) {
        view.loadDataWithBaseURL(
            source.getString("baseUrl"), html, HTML_MIME_TYPE, HTML_ENCODING, null);
      } else {
        view.loadData(html, HTML_MIME_TYPE, HTML_ENCODING);
      }
      return;
    }
    if (source.hasKey("uri")) {
      String url = source.getString("uri");
      String previousUrl = view.getUrl();
      if (previousUrl != null && previousUrl.equals(url)) {
        return;
      }
      if (source.hasKey("method")) {
        String method = source.getString("method");
        if (method.equals(HTTP_METHOD_POST)) {
          byte[] postData = null;
          if (source.hasKey("body")) {
            String body = source.getString("body");
            try {
              postData = body.getBytes("UTF-8");
            } catch (UnsupportedEncodingException e) {
              postData = body.getBytes();
            }
          }
          if (postData == null) {
            postData = new byte[0];
          }
          view.postUrl(url, postData);
          return;
        }
      }
      HashMap<String, String> headerMap = new HashMap<>();
      if (source.hasKey("headers")) {
        ReadableMap headers = source.getMap("headers");
        ReadableMapKeySetIterator iter = headers.keySetIterator();
        while (iter.hasNextKey()) {
          String key = iter.nextKey();
          if ("user-agent".equals(key.toLowerCase(Locale.ENGLISH))) {
            if (view.getSettings() != null) {
              view.getSettings().setUserAgentString(headers.getString(key));
            }
          } else {
            headerMap.put(key, headers.getString(key));
          }
        }
      }
      view.loadUrl(url, headerMap);
      return;
    }
  }
  view.loadUrl(BLANK_URL);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:60,代码来源:ReactWebViewManager.java


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