當前位置: 首頁>>代碼示例>>Java>>正文


Java WritableMap.putBoolean方法代碼示例

本文整理匯總了Java中com.facebook.react.bridge.WritableMap.putBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java WritableMap.putBoolean方法的具體用法?Java WritableMap.putBoolean怎麽用?Java WritableMap.putBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.react.bridge.WritableMap的用法示例。


在下文中一共展示了WritableMap.putBoolean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: locationToMap

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private static WritableMap locationToMap(Location location) {
  WritableMap map = Arguments.createMap();
  WritableMap coords = Arguments.createMap();
  coords.putDouble("latitude", location.getLatitude());
  coords.putDouble("longitude", location.getLongitude());
  coords.putDouble("altitude", location.getAltitude());
  coords.putDouble("accuracy", location.getAccuracy());
  coords.putDouble("heading", location.getBearing());
  coords.putDouble("speed", location.getSpeed());
  map.putMap("coords", coords);
  map.putDouble("timestamp", location.getTime());

  if (android.os.Build.VERSION.SDK_INT >= 18) {
    map.putBoolean("mocked", location.isFromMockProvider());
  }

  return map;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:19,代碼來源:LocationModule.java

示例2: onReceive

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
  final String action = intent.getAction();

  if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
    final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
            BluetoothAdapter.ERROR);
    boolean active = false;
    switch (state) {
      case BluetoothAdapter.STATE_OFF:
        active = false;
        break;
      case BluetoothAdapter.STATE_ON:
        active = true;
        break;
    }

    final WritableMap eventMap = new WritableNativeMap();
    eventMap.putString(EVENT_TYPE, "bluetooth");
    eventMap.putBoolean(EVENT_STATUS, active);
    getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(RN_CONNECTIVITY_STATUS_TOPIC, eventMap);
  }
}
 
開發者ID:nearit,項目名稱:react-native-connectivity-status,代碼行數:24,代碼來源:RNConnectivityStatusModule.java

示例3: phoneSignalStrengthsUpdated

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void phoneSignalStrengthsUpdated(SignalStrength signalStrength) {
    WritableMap map = Arguments.createMap();
    map.putInt("cdmaDbm", signalStrength.getCdmaDbm());
    map.putInt("cdmaEcio()", signalStrength.getCdmaEcio());
    map.putInt("evdoDbm", signalStrength.getEvdoDbm());
    map.putInt("evdoEcio", signalStrength.getEvdoEcio());
    map.putInt("evdoSnr", signalStrength.getEvdoSnr());
    map.putInt("gsmBitErrorRate", signalStrength.getGsmBitErrorRate());
    map.putInt("gsmSignalStrength", signalStrength.getGsmSignalStrength());
    map.putBoolean("gsm", signalStrength.isGsm());

    WritableMap result = Arguments.createMap();
    result.putString("type", "LISTEN_SIGNAL_STRENGTHS");
    result.putMap("data", map);

    sendEvent(PHONE_STATE_LISTENER, result);
}
 
開發者ID:rafaellincoln,項目名稱:react-native-telephony,代碼行數:19,代碼來源:TelephonyModule.java

示例4: serializeEventData

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private WritableMap serializeEventData() {
  WritableMap eventData = Arguments.createMap();
  eventData.putInt("target", getViewTag());
  eventData.putDouble("value", getValue());
  eventData.putBoolean("fromUser", isFromUser());
  return eventData;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:8,代碼來源:ReactSliderEvent.java

示例5: createWebViewEvent

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private WritableMap createWebViewEvent(WebView webView, String url) {
  WritableMap event = Arguments.createMap();
  event.putDouble("target", webView.getId());
  // Don't use webView.getUrl() here, the URL isn't updated to the new value yet in callbacks
  // like onPageFinished
  event.putString("url", url);
  event.putBoolean("loading", !mLastLoadFailed && webView.getProgress() != 100);
  event.putString("title", webView.getTitle());
  event.putBoolean("canGoBack", webView.canGoBack());
  event.putBoolean("canGoForward", webView.canGoForward());
  return event;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:13,代碼來源:ReactWebViewManager.java

示例6: onFaceDetection

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onFaceDetection(Camera.Face[] faces, Camera camera) {
    if (faces.length > 0) {
        Matrix matrix = new Matrix();
        boolean frontCamera = (getCameraType() == RCTCameraModule.RCT_CAMERA_TYPE_FRONT);

        int height = getHeight();
        int width = getWidth();

        matrix.setScale(frontCamera ? -1 : 1, 1);
        matrix.postRotate(RCTCamera.getInstance().getOrientation());
        matrix.postScale(width / 2000f, height / 2000f);
        matrix.postTranslate(width / 2f, height / 2f);

        double pixelDensity = getPixelDensity();

        for (Camera.Face face : faces) {
            RectF faceRect = new RectF(face.rect);
            matrix.mapRect(faceRect);

            WritableMap faceEvent;
            faceEvent = Arguments.createMap();
            faceEvent.putInt("faceID", face.id);
            faceEvent.putBoolean("isFrontCamera", frontCamera);

            faceEvent.putDouble("x", faceRect.left / pixelDensity);
            faceEvent.putDouble("y", faceRect.top / pixelDensity);
            faceEvent.putDouble("h", faceRect.height() / pixelDensity);
            faceEvent.putDouble("w", faceRect.width() / pixelDensity);

            ((ReactContext) getContext()).getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                    .emit("CameraFaceDetected", faceEvent);
        }
    }
}
 
開發者ID:entria,項目名稱:react-native-camera-face-detector,代碼行數:36,代碼來源:RCTCameraViewFinder.java

示例7: toWritableMap

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
public static WritableMap toWritableMap(Map<String, Object> map) {
  WritableMap writableMap = Arguments.createMap();
  Iterator iterator = map.entrySet().iterator();

  while (iterator.hasNext()) {
    Map.Entry pair = (Map.Entry)iterator.next();
    Object value = pair.getValue();

    if (value == null) {
      writableMap.putNull((String) pair.getKey());
    } else if (value instanceof Boolean) {
      writableMap.putBoolean((String) pair.getKey(), (Boolean) value);
    } else if (value instanceof Double) {
      writableMap.putDouble((String) pair.getKey(), (Double) value);
    } else if (value instanceof Integer) {
      writableMap.putInt((String) pair.getKey(), (Integer) value);
    } else if (value instanceof String) {
      writableMap.putString((String) pair.getKey(), (String) value);
    } else if (value instanceof Map) {
      writableMap.putMap((String) pair.getKey(), MapUtil.toWritableMap((Map<String, Object>) value));
    } else if (value.getClass() != null && value.getClass().isArray()) {
      writableMap.putArray((String) pair.getKey(), ArrayUtil.toWritableArray((Object[]) value));
    }

    iterator.remove();
  }

  return writableMap;
}
 
開發者ID:davidstoneham,項目名稱:react-native-mssql,代碼行數:30,代碼來源:MapUtil.java

示例8: serializeEventData

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private WritableMap serializeEventData() {
  WritableMap contentInset = Arguments.createMap();
  contentInset.putDouble("top", 0);
  contentInset.putDouble("bottom", 0);
  contentInset.putDouble("left", 0);
  contentInset.putDouble("right", 0);

  WritableMap contentOffset = Arguments.createMap();
  contentOffset.putDouble("x", PixelUtil.toDIPFromPixel(mScrollX));
  contentOffset.putDouble("y", PixelUtil.toDIPFromPixel(mScrollY));

  WritableMap contentSize = Arguments.createMap();
  contentSize.putDouble("width", PixelUtil.toDIPFromPixel(mContentWidth));
  contentSize.putDouble("height", PixelUtil.toDIPFromPixel(mContentHeight));

  WritableMap layoutMeasurement = Arguments.createMap();
  layoutMeasurement.putDouble("width", PixelUtil.toDIPFromPixel(mScrollViewWidth));
  layoutMeasurement.putDouble("height", PixelUtil.toDIPFromPixel(mScrollViewHeight));

  WritableMap event = Arguments.createMap();
  event.putMap("contentInset", contentInset);
  event.putMap("contentOffset", contentOffset);
  event.putMap("contentSize", contentSize);
  event.putMap("layoutMeasurement", layoutMeasurement);

  event.putInt("target", getViewTag());
  event.putBoolean("responderIgnoreScroll", true);
  return event;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:30,代碼來源:ScrollEvent.java

示例9: pauseThisSong

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
/**
 * Pause playback
 */
@ReactMethod
public void pauseThisSong() {

    DemoPlayer.getInstance().pause();

    IS_SONG_PAUSED = true;

    //Stop Progressbar update
    ((MainActivity) getCurrentActivity()).getSongProgressHandler().removeCallbacks(updateProgressTask);
    WritableMap params = Arguments.createMap();
    params.putBoolean(KEY_SONG_PAUSED, IS_SONG_PAUSED);
    sendEvent(reactAppContext, EVENT_UPDATE_PROGRESS, params);
}
 
開發者ID:hiteshsahu,項目名稱:React-Native-Music-Player,代碼行數:17,代碼來源:MusicPlayerModule.java

示例10: UserInfo

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
public static WritableMap UserInfo(UserInfo userInfo) {
    WritableMap map = Arguments.createMap();

    map.putString("identity", userInfo.getIdentity());
    map.putString("friendlyName", userInfo.getFriendlyName());
    map.putMap("attributes", jsonToWritableMap(userInfo.getAttributes()));
    map.putBoolean("isOnline", userInfo.isOnline());
    map.putBoolean("isNotifiable", userInfo.isNotifiable());

    return map;
}
 
開發者ID:ccm-innovation,項目名稱:react-native-twilio-chat,代碼行數:12,代碼來源:RCTConvert.java

示例11: getMap

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@ReactMethod(isBlockingSynchronousMethod = true)
WritableMap getMap() {
  WritableMap map = new WritableNativeMap();
  map.putBoolean("a", true);
  map.putBoolean("b", false);
  return map;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:8,代碼來源:CatalystNativeJavaToJSReturnValuesTestCase.java

示例12: putPageInfo

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private static void putPageInfo(Cursor photos, WritableMap response, int limit) {
  WritableMap pageInfo = new WritableNativeMap();
  pageInfo.putBoolean("has_next_page", limit < photos.getCount());
  if (limit < photos.getCount()) {
    photos.moveToPosition(limit - 1);
    pageInfo.putString(
        "end_cursor",
        photos.getString(photos.getColumnIndex(Images.Media.DATE_TAKEN)));
  }
  response.putMap("page_info", pageInfo);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:12,代碼來源:CameraRollManager.java

示例13: convertJsonToMap

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
public static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {
  WritableMap map = new WritableNativeMap();

  Iterator<String> iterator = jsonObject.keys();
  while (iterator.hasNext()) {
    String key = iterator.next();
    Object value = jsonObject.get(key);
    if (value instanceof JSONObject) {
      map.putMap(key, convertJsonToMap((JSONObject) value));
    } else if (value instanceof JSONArray) {
      map.putArray(key, convertJsonToArray((JSONArray) value));
    } else if (value instanceof Boolean) {
      map.putBoolean(key, (Boolean) value);
    } else if (value instanceof Integer) {
      map.putInt(key, (Integer) value);
    } else if (value instanceof Double) {
      System.out.println("double");
      map.putDouble(key, (Double) value);
    } else if (value instanceof String) {
      map.putString(key, (String) value);
      System.out.println("string");
    } else {
      map.putString(key, value.toString());
    }
  }
  return map;
}
 
開發者ID:humaniq,項目名稱:react-native-android-library-humaniq-api,代碼行數:28,代碼來源:ModelConverterUtils.java

示例14: serializeEventData

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private WritableMap serializeEventData () {
    WritableMap eventData = Arguments.createMap();
    eventData.putString("title", title);
    eventData.putBoolean("loading", isLoading);
    eventData.putString("url", url);
    eventData.putBoolean("canGoBack", canGoBack);
    eventData.putBoolean("canGoForward", canGoForward);

    return eventData;
}
 
開發者ID:KingBarbarian,項目名稱:react-native-android-new-crosswalk,代碼行數:11,代碼來源:NavigationStateChangeEvent.java

示例15: phoneCallForwardingIndicatorUpdated

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void phoneCallForwardingIndicatorUpdated(boolean cfi) {
    WritableMap map = Arguments.createMap();
    map.putBoolean("cfi", cfi);

    WritableMap result = Arguments.createMap();
    result.putString("type", "LISTEN_CALL_FORWARDING_INDICATOR");
    result.putMap("data", map);

    sendEvent(PHONE_STATE_LISTENER, result);
}
 
開發者ID:rafaellincoln,項目名稱:react-native-telephony,代碼行數:12,代碼來源:TelephonyModule.java


注:本文中的com.facebook.react.bridge.WritableMap.putBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。