當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。