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


Java ReadableMap.getBoolean方法代码示例

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


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

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

示例2: setActions

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public void setActions(@Nullable ReadableArray actions) {
    Menu menu = getMenu();
    menu.clear();
    mActionsHolder.clear();
    if (actions != null) {
        for (int i = 0; i < actions.size(); i++) {
            ReadableMap action = actions.getMap(i);

            MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString("title"));
            setMenuItemIcon(item, action.getMap("icon"));
            if (action.getBoolean("disabled")) {
                item.setEnabled(false);
            }
        }
    }
}
 
开发者ID:timomeh,项目名称:react-native-android-bottom-navigation,代码行数:17,代码来源:RNBottomNavigation.java

示例3: SocketClient

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
SocketClient(ReadableMap params, ReactContext reactContext) {
    //String addr, int port, boolean autoReconnect
    mReactContext = reactContext;
    dstAddress = params.getString("address");
    dstPort = params.getInt("port");
    if (params.hasKey("reconnect")) {
        reconnectOnClose = params.getBoolean("reconnect");
    }
    if (params.hasKey("maxReconnectAttempts")) {
        maxReconnectAttempts = params.getInt("maxReconnectAttempts");
    }
    if (params.hasKey("reconnectDelay")) {
        reconnectDelay = params.getInt("reconnectDelay");
    }

    Thread socketClientThread = new Thread(new SocketClientThread());
    socketClientThread.start();
}
 
开发者ID:davidstoneham,项目名称:react-native-sockets,代码行数:19,代码来源:SocketClient.java

示例4: setActions

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
void setActions(@Nullable ReadableArray actions) {
  Menu menu = getMenu();
  menu.clear();
  mActionsHolder.clear();
  if (actions != null) {
    for (int i = 0; i < actions.size(); i++) {
      ReadableMap action = actions.getMap(i);

      MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString(PROP_ACTION_TITLE));

      if (action.hasKey(PROP_ACTION_ICON)) {
        setMenuItemIcon(item, action.getMap(PROP_ACTION_ICON));
      }

      int showAsAction = action.hasKey(PROP_ACTION_SHOW)
          ? action.getInt(PROP_ACTION_SHOW)
          : MenuItem.SHOW_AS_ACTION_NEVER;
      if (action.hasKey(PROP_ACTION_SHOW_WITH_TEXT) &&
          action.getBoolean(PROP_ACTION_SHOW_WITH_TEXT)) {
        showAsAction = showAsAction | MenuItem.SHOW_AS_ACTION_WITH_TEXT;
      }
      item.setShowAsAction(showAsAction);
    }
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:26,代码来源:ReactToolbar.java

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

示例6: createDataChannel

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
void createDataChannel(String label, ReadableMap config) {
    DataChannel.Init init = new DataChannel.Init();
    if (config != null) {
        if (config.hasKey("id")) {
            init.id = config.getInt("id");
        }
        if (config.hasKey("ordered")) {
            init.ordered = config.getBoolean("ordered");
        }
        if (config.hasKey("maxRetransmitTime")) {
            init.maxRetransmitTimeMs = config.getInt("maxRetransmitTime");
        }
        if (config.hasKey("maxRetransmits")) {
            init.maxRetransmits = config.getInt("maxRetransmits");
        }
        if (config.hasKey("protocol")) {
            init.protocol = config.getString("protocol");
        }
        if (config.hasKey("negotiated")) {
            init.negotiated = config.getBoolean("negotiated");
        }
    }
    DataChannel dataChannel = peerConnection.createDataChannel(label, init);
    // XXX RTP data channels are not defined by the WebRTC standard, have
    // been deprecated in Chromium, and Google have decided (in 2015) to no
    // longer support them (in the face of multiple reported issues of
    // breakages).
    int dataChannelId = init.id;
    if (-1 != dataChannelId) {
        dataChannels.put(dataChannelId, dataChannel);
        registerDataChannelObserver(dataChannelId, dataChannel);
    }
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:34,代码来源:PeerConnectionObserver.java

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

示例8: 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, 0);
//        }

        // 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,代码来源:PiliPlayerViewManager.java

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

示例10: toObject

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * toObject extracts a value from a {@link ReadableMap} by its key,
 * and returns a POJO representing that object.
 *
 * @param readableMap The Map to containing the value to be converted
 * @param key         The key for the value to be converted
 * @return The converted POJO
 */
public static Object toObject(@Nullable ReadableMap readableMap, String key) {
    if (readableMap == null) {
        return null;
    }

    Object result;

    ReadableType readableType = readableMap.getType(key);
    switch (readableType) {
        case Null:
            result = key;
            break;
        case Boolean:
            result = readableMap.getBoolean(key);
            break;
        case Number:
            // Can be int or double.
            double tmp = readableMap.getDouble(key);
            if (tmp == (int) tmp) {
                result = (int) tmp;
            } else {
                result = tmp;
            }
            break;
        case String:
            result = readableMap.getString(key);
            break;
        case Map:
            result = toMap(readableMap.getMap(key));
            break;
        case Array:
            result = toList(readableMap.getArray(key));
            break;
        default:
            throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
    }

    return result;
}
 
开发者ID:hudl,项目名称:react-native-android-fragment,代码行数:48,代码来源:ReactUtil.java

示例11: RNWebGLTextureView

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public RNWebGLTextureView(ReadableMap config, View view) {
    super(config, view.getWidth(), view.getHeight());
    boolean continuous = config.hasKey("continuous") && config.getBoolean("continuous");
    yflip = config.hasKey("yflip") && config.getBoolean("yflip");
    this.view = view;
    if (continuous) {
        viewTreeObserver = view.getViewTreeObserver();
        viewTreeObserver.addOnDrawListener(this);
    }
    else {
        viewTreeObserver = null;
    }
    this.runOnGLThread(this);
}
 
开发者ID:gre,项目名称:react-native-webgl-view-shot,代码行数:15,代码来源:RNWebGLTextureView.java

示例12: fromReactMap

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private static LocationOptions fromReactMap(ReadableMap map) {
  // precision might be dropped on timeout (double -> int conversion), but that's OK
  long timeout =
      map.hasKey("timeout") ? (long) map.getDouble("timeout") : Long.MAX_VALUE;
  double maximumAge =
      map.hasKey("maximumAge") ? map.getDouble("maximumAge") : Double.POSITIVE_INFINITY;
  boolean highAccuracy =
      map.hasKey("enableHighAccuracy") && map.getBoolean("enableHighAccuracy");
  float distanceFilter = map.hasKey("distanceFilter") ?
    (float) map.getDouble("distanceFilter") :
    RCT_DEFAULT_LOCATION_ACCURACY;

  return new LocationOptions(timeout, maximumAge, highAccuracy, distanceFilter);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:15,代码来源:LocationModule.java

示例13: SpringAnimation

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
SpringAnimation(ReadableMap config) {
  mSpringFriction = config.getDouble("friction");
  mSpringTension = config.getDouble("tension");
  mCurrentState.velocity = config.getDouble("initialVelocity");
  mEndValue = config.getDouble("toValue");
  mRestSpeedThreshold = config.getDouble("restSpeedThreshold");
  mDisplacementFromRestThreshold = config.getDouble("restDisplacementThreshold");
  mOvershootClampingEnabled = config.getBoolean("overshootClamping");
  mIterations = config.hasKey("iterations") ? config.getInt("iterations") : 1;
  mHasFinished = mIterations == 0;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:SpringAnimation.java

示例14: 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_GET_AV_FRAME_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        if (liveStreaming) {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
        } else {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
        }
//        }

        // 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:pili-engineering,项目名称:pili-react-native,代码行数:42,代码来源:PiliPlayerViewManager.java

示例15: matches

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * User to find notifications:
 * <p>
 * https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/RCTPushNotificationManager.m#L294
 *
 * @param userInfo map of fields to match
 * @return true all fields in userInfo object match, false otherwise
 */
public boolean matches(ReadableMap userInfo) {
    Bundle bundle = toBundle();

    ReadableMapKeySetIterator iterator = userInfo.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();

        if (!bundle.containsKey(key))
            return false;

        switch (userInfo.getType(key)) {
            case Null: {
                if (bundle.get(key) != null)
                    return false;
                break;
            }
            case Boolean: {
                if (userInfo.getBoolean(key) != bundle.getBoolean(key))
                    return false;
                break;
            }
            case Number: {
                if ((userInfo.getDouble(key) != bundle.getDouble(key)) && (userInfo.getInt(key) != bundle.getInt(key)))
                    return false;
                break;
            }
            case String: {
                if (!userInfo.getString(key).equals(bundle.getString(key)))
                    return false;
                break;
            }
            case Map:
                return false;//there are no maps in the bundle
            case Array:
                return false;//there are no arrays in the bundle
        }
    }

    return true;
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:49,代码来源:RNPushNotificationAttributes.java


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