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


Java ReadableMap.getMap方法代码示例

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


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

示例1: setProfile

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactProp(name = "profile")
public void setProfile(AspectFrameLayout view, @Nullable ReadableMap profile) {
    ReadableMap video = profile.getMap("video");
    ReadableMap audio = profile.getMap("audio");
    int encodingSize = profile.getInt("encodingSize");

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(video.getInt("fps"), video.getInt("bps"), video.getInt("maxFrameInterval"));//fps bps maxFrameInterval
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mProfile.setEncodingSizeLevel(encodingSize);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
 
开发者ID:pili-engineering,项目名称:pili-react-native,代码行数:17,代码来源:PiliStreamingViewManager.java

示例2: writeLocationExifData

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private void writeLocationExifData(ReadableMap options, ExifInterface exif) {
    if(!options.hasKey("metadata"))
        return;

    ReadableMap metadata = options.getMap("metadata");
    if (!metadata.hasKey("location"))
        return;

    ReadableMap location = metadata.getMap("location");
    if(!location.hasKey("coords"))
        return;

    try {
        ReadableMap coords = location.getMap("coords");
        double latitude = coords.getDouble("latitude");
        double longitude = coords.getDouble("longitude");

        GPS.writeExifData(latitude, longitude, exif);
    } catch (IOException e) {
        Log.e(TAG, "Couldn't write location data", e);
    }
}
 
开发者ID:jonathan68,项目名称:react-native-camera,代码行数:23,代码来源:MutableImage.java

示例3: 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

示例4: setProfile

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactProp(name = "profile")
public void setProfile(View view, @Nullable ReadableMap profile) {
    ReadableMap audio = profile.getMap("audio");

    StreamingProfile.VideoProfile vProfile =
            new StreamingProfile.VideoProfile(0,0,0);//hack for bad API

    StreamingProfile.AudioProfile aProfile =
            new StreamingProfile.AudioProfile(audio.getInt("rate"), audio.getInt("bitrate")); //audio sample rate, audio bitrate
    StreamingProfile.AVProfile avProfile = new StreamingProfile.AVProfile(vProfile, aProfile);
    mProfile.setAVProfile(avProfile);
    mMediaStreamingManager.setStreamingProfile(mProfile);

}
 
开发者ID:pili-engineering,项目名称:pili-react-native,代码行数:15,代码来源:PiliAudioStreamingViewManager.java

示例5: setUserInfo

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactMethod
public void setUserInfo(final ReadableMap options, final Callback callback) {
    Map<String, String> info = new HashMap<>();
    if (!hasAndNotEmpty(options, "sdk_token")) {
        return;
    }
    String token = options.getString("sdk_token");
    if (token == null) {
        token = UUID.randomUUID().toString();
    }
    //token 必填
    info.put(UdeskConst.UdeskUserInfo.USER_SDK_TOKEN, token);
    //以下信息是可选
    if (hasAndNotEmpty(options, "nick_name")) {
        info.put(UdeskConst.UdeskUserInfo.NICK_NAME, options.getString("nick_name"));
    }
    if (hasAndNotEmpty(options, "email")) {
        info.put(UdeskConst.UdeskUserInfo.EMAIL, options.getString("email"));
    }
    if (hasAndNotEmpty(options, "cellphone")) {
        info.put(UdeskConst.UdeskUserInfo.CELLPHONE, options.getString("cellphone"));
    }
    if (hasAndNotEmpty(options, "description")) {
        info.put(UdeskConst.UdeskUserInfo.DESCRIPTION, options.getString("description"));
    }
    ReadableMap field = options.getMap("customer_field");
    if (field!= null && field.hasKey("TextField_10075")) {
        Map<String, String> fields = new HashMap<>();
        fields.put("TextField_10075", field.getString("TextField_10075"));
        UdeskSDKManager.getInstance().setUserInfo(mReactContext.getApplicationContext(), token, info, fields);
    } else {
        UdeskSDKManager.getInstance().setUserInfo(mReactContext.getApplicationContext(), token, info);
    }
}
 
开发者ID:lennyup,项目名称:react-native-udesk,代码行数:35,代码来源:UdeskModule.java

示例6: 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

示例7: cropImage

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * Crop an image. If all goes well, the success callback will be called with the file:// URI of
 * the new image as the only argument. This is a temporary file - consider using
 * CameraRollManager.saveImageWithTag to save it in the gallery.
 *
 * @param uri the MediaStore URI of the image to crop
 * @param options crop parameters specified as {@code {offset: {x, y}, size: {width, height}}}.
 *        Optionally this also contains  {@code {targetSize: {width, height}}}. If this is
 *        specified, the cropped image will be resized to that size.
 *        All units are in pixels (not DPs).
 * @param success callback to be invoked when the image has been cropped; the only argument that
 *        is passed to this callback is the file:// URI of the new image
 * @param error callback to be invoked when an error occurs (e.g. can't create file etc.)
 */
@ReactMethod
public void cropImage(
    String uri,
    ReadableMap options,
    final Callback success,
    final Callback error) {
  ReadableMap offset = options.hasKey("offset") ? options.getMap("offset") : null;
  ReadableMap size = options.hasKey("size") ? options.getMap("size") : null;
  if (offset == null || size == null ||
      !offset.hasKey("x") || !offset.hasKey("y") ||
      !size.hasKey("width") || !size.hasKey("height")) {
    throw new JSApplicationIllegalArgumentException("Please specify offset and size");
  }
  if (uri == null || uri.isEmpty()) {
    throw new JSApplicationIllegalArgumentException("Please specify a URI");
  }

  CropTask cropTask = new CropTask(
      getReactApplicationContext(),
      uri,
      (int) offset.getDouble("x"),
      (int) offset.getDouble("y"),
      (int) size.getDouble("width"),
      (int) size.getDouble("height"),
      success,
      error);
  if (options.hasKey("displaySize")) {
    ReadableMap targetSize = options.getMap("displaySize");
    cropTask.setTargetSize(targetSize.getInt("width"), targetSize.getInt("height"));
  }
  cropTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:47,代码来源:ImageEditingManager.java

示例8: StyleAnimatedNode

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
StyleAnimatedNode(ReadableMap config, NativeAnimatedNodesManager nativeAnimatedNodesManager) {
  ReadableMap style = config.getMap("style");
  ReadableMapKeySetIterator iter = style.keySetIterator();
  mPropMapping = new HashMap<>();
  while (iter.hasNextKey()) {
    String propKey = iter.nextKey();
    int nodeIndex = style.getInt(propKey);
    mPropMapping.put(propKey, nodeIndex);
  }
  mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:StyleAnimatedNode.java

示例9: testNestedMap

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public void testNestedMap() {
  mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnNestedMap();
  waitForBridgeAndUIIdle();

  List<ReadableMap> calls = mRecordingTestModule.getMapCalls();
  assertEquals(1, calls.size());
  ReadableMap map = calls.get(0);
  assertNotNull(map);

  assertTrue(map.hasKey("weHaveToGoDeeper"));
  assertFalse(map.isNull("weHaveToGoDeeper"));
  ReadableMap nestedMap = map.getMap("weHaveToGoDeeper");
  assertTrue(nestedMap.hasKey("inception"));
  assertTrue(nestedMap.getBoolean("inception"));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:CatalystNativeJSToJavaParametersTestCase.java

示例10: PropsAnimatedNode

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
PropsAnimatedNode(ReadableMap config, NativeAnimatedNodesManager nativeAnimatedNodesManager) {
  ReadableMap props = config.getMap("props");
  ReadableMapKeySetIterator iter = props.keySetIterator();
  mPropMapping = new HashMap<>();
  while (iter.hasNextKey()) {
    String propKey = iter.nextKey();
    int nodeIndex = props.getInt(propKey);
    mPropMapping.put(propKey, nodeIndex);
  }
  mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:PropsAnimatedNode.java

示例11: getMap

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


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