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


Java WritableMap.putInt方法代碼示例

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


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

示例1: asWritableMap

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
public WritableMap asWritableMap() {

		WritableMap map = Arguments.createMap();

		try {
			map.putString("name", device.getName());
			map.putBoolean("connected", connected);
			map.putString("id", device.getAddress()); // mac address
			map.putMap("advertising", byteArrayToWritableMap(advertisingData));
			map.putInt("rssi", advertisingRSSI);
		} catch (Exception e) { // this shouldn't happen
			e.printStackTrace();
		}

		return map;
	}
 
開發者ID:lenglengiOS,項目名稱:react-native-blue-manager,代碼行數:17,代碼來源:Peripheral.java

示例2: startListeningToAnimatedNodeValue

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@ReactMethod
public void startListeningToAnimatedNodeValue(final int tag) {
  final AnimatedNodeValueListener listener = new AnimatedNodeValueListener() {
    public void onValueUpdate(double value) {
      WritableMap onAnimatedValueData = Arguments.createMap();
      onAnimatedValueData.putInt("tag", tag);
      onAnimatedValueData.putDouble("value", value);
      getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
          .emit("onAnimatedValueUpdate", onAnimatedValueData);
    }
  };

  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatedNodesManager animatedNodesManager) {
      animatedNodesManager.startListeningToAnimatedNodeValue(tag, listener);
    }
  });
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:20,代碼來源:NativeAnimatedModule.java

示例3: checkProgress

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
/**
 * Checks download progress.
 */
private void checkProgress() {
  DownloadManager.Query query = new DownloadManager.Query();
  query.setFilterById(enqueue);
  Cursor cursor = dm.query(query);
  if (!cursor.moveToFirst()) {
    cursor.close();
    return;
  }
  long reference = cursor.getLong(cursor.getColumnIndex(DownloadManager.COLUMN_ID));

  int bytes_downloaded =
      cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
  int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));

  int progress = (int) ((bytes_downloaded * 100l) / bytes_total);
      WritableMap writableMap = new WritableNativeMap();
      writableMap.putInt("progress", progress);
      sendEvent(writableMap);

  if(progress >= 100) {
    future.cancel(true);
  }
}
 
開發者ID:humaniq,項目名稱:react-native-android-library-humaniq-api,代碼行數:27,代碼來源:DownloadModule.java

示例4: barcodeToWritableMap

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
static public WritableMap barcodeToWritableMap(Barcode barcode) {
    WritableMap map = Arguments.createMap();
    map.putInt    ("compositeFlag",    barcode.getCompositeFlag());
    map.putString ("data",             barcode.getData());
    map.putBoolean("isRecognized",     barcode.isRecognized());
    map.putBoolean("isGs1DataCarrier", barcode.isGs1DataCarrier());
    map.putInt    ("symbolCount",      barcode.getSymbolCount());
    map.putInt    ("symbology",        barcode.getSymbology());
    map.putString ("symbologyName",    barcode.getSymbologyName());
    map.putMap    ("location",         quadrilateralToWritableMap(barcode.getLocation()));
    return map;
}
 
開發者ID:salathegroup,項目名稱:react-native-scandit,代碼行數:13,代碼來源:ScanditBarcodeHelpers.java

示例5: buildError

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
public static WritableMap buildError(int code, String message) {
  WritableMap error = Arguments.createMap();
  error.putInt("code", code);
  if (message != null) {
    error.putString("message", message);
  }
  return error;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:9,代碼來源:PositionError.java

示例6: onReceive

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

    switch(intent.getAction()) {
        case "update-position-event":
            int nCurrentPosition = intent.getIntExtra("currentPosition", 0);
            params.putInt("currentPosition", nCurrentPosition);
            sendEvent("onPlaybackPositionUpdated", params);
            break;
        case "change-playback-action-event":
            String strAction = intent.getStringExtra("action");
            params.putString("action", strAction);
            sendEvent("onPlaybackActionChanged", params);
            break;
        case "change-playback-state-event":
            int nState = intent.getIntExtra("state", 0);
            if (mStateMap.containsKey(nState)) {
                params.putString("state", mStateMap.get(nState));
                sendEvent("onPlaybackStateChanged", params);
            }
            break;
        case "playback-error-event":
            String strError = intent.getStringExtra("msg");
            params.putString("msg", strError);
            sendEvent("onPlaybackError", params);
        default:
            break;
    }
}
 
開發者ID:AllThatSeries,項目名稱:react-native-streaming-audio-player,代碼行數:31,代碼來源:RNAudioPlayerModule.java

示例7: onIceConnectionChange

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onIceConnectionChange(PeerConnection.IceConnectionState iceConnectionState) {
    WritableMap params = Arguments.createMap();
    params.putInt("id", id);
    params.putString("iceConnectionState", iceConnectionStateString(iceConnectionState));

    webRTCModule.sendEvent("peerConnectionIceConnectionChanged", params);
}
 
開發者ID:angellsl10,項目名稱:react-native-webrtc,代碼行數:9,代碼來源:PeerConnectionObserver.java

示例8: onDataChannel

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onDataChannel(DataChannel dataChannel) {
    // XXX Unfortunately, the Java WebRTC API doesn't expose the id
    // of the underlying C++/native DataChannel (even though the
    // WebRTC standard defines the DataChannel.id property). As a
    // workaround, generated an id which will surely not clash with
    // the ids of the remotely-opened (and standard-compliant
    // locally-opened) DataChannels.
    int dataChannelId = -1;
    // The RTCDataChannel.id space is limited to unsigned short by
    // the standard:
    // https://www.w3.org/TR/webrtc/#dom-datachannel-id.
    // Additionally, 65535 is reserved due to SCTP INIT and
    // INIT-ACK chunks only allowing a maximum of 65535 streams to
    // be negotiated (as defined by the WebRTC Data Channel
    // Establishment Protocol).
    for (int i = 65536; i <= Integer.MAX_VALUE; ++i) {
        if (null == dataChannels.get(i, null)) {
            dataChannelId = i;
            break;
        }
    }
    if (-1 == dataChannelId) {
      return;
    }

    WritableMap dataChannelParams = Arguments.createMap();
    dataChannelParams.putInt("id", dataChannelId);
    dataChannelParams.putString("label", dataChannel.label());
    WritableMap params = Arguments.createMap();
    params.putInt("id", id);
    params.putMap("dataChannel", dataChannelParams);

    dataChannels.put(dataChannelId, dataChannel);
    registerDataChannelObserver(dataChannelId, dataChannel);

    webRTCModule.sendEvent("peerConnectionDidOpenDataChannel", params);
}
 
開發者ID:angellsl10,項目名稱:react-native-webrtc,代碼行數:39,代碼來源:PeerConnectionObserver.java

示例9: getMonitoredRegions

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@ReactMethod
public void getMonitoredRegions(Callback callback) {
    WritableArray array = new WritableNativeArray();
    for (Region region: mBeaconManager.getMonitoredRegions()) {
        WritableMap map = new WritableNativeMap();
        map.putString("identifier", region.getUniqueId());
        map.putString("uuid", region.getId1().toString());
        map.putInt("major", region.getId2() != null ? region.getId2().toInt() : 0);
        map.putInt("minor", region.getId3() != null ? region.getId3().toInt() : 0);
        array.pushMap(map);
    }
    callback.invoke(array);
}
 
開發者ID:MacKentoch,項目名稱:react-native-ibeacons,代碼行數:14,代碼來源:BeaconsAndroidModule.java

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

示例11: onEvent

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onEvent(int eventType, Bundle params) {
  Logger.debug(TAG, "onEvent: " + eventType);
  WritableMap data = Arguments.createMap();
  data.putInt("eventType", eventType);
  data.putMap("params", Arguments.fromBundle(params));
  emit(SPEECH_TO_TEXT, data);
}
 
開發者ID:marshmelloX,項目名稱:react-native-stt,代碼行數:9,代碼來源:SpeechRecognitionListener.java

示例12: onError

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onError(int error) {
  Logger.error(TAG, "onError: " + error);
  WritableMap data = Arguments.createMap();
  data.putInt("error", error);
  emit(SPEECH_TO_TEXT, data);
}
 
開發者ID:marshmelloX,項目名稱:react-native-stt,代碼行數:8,代碼來源:SpeechRecognitionListener.java

示例13: onSaveSketch

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private void onSaveSketch(SketchViewContainer root, SketchFile sketchFile) {
  WritableMap event = Arguments.createMap();
  event.putString("localFilePath", sketchFile.localFilePath);
  event.putInt("imageWidth", sketchFile.width);
  event.putInt("imageHeight", sketchFile.height);
  sendEvent(root, "onSaveSketch", event);
}
 
開發者ID:keshavkaul,項目名稱:react-native-sketch-view,代碼行數:8,代碼來源:RNSketchViewManager.java

示例14: onError

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
@Override
public void onError(int error) {
  Log.i(TAG, "onError: " + error);
  if (isEnabled(ListenerEvents.ON_ERROR)) {
    WritableMap data = Arguments.createMap();
    data.putInt("error", error);
    emit(ListenerEvents.ON_ERROR, data);
  }
}
 
開發者ID:de-code,項目名稱:react-native-android-speech-recognizer,代碼行數:10,代碼來源:ListenerMapRecognitionListener.java

示例15: serializeEventData

import com.facebook.react.bridge.WritableMap; //導入方法依賴的package包/類
private WritableMap serializeEventData () {
    WritableMap eventData = Arguments.createMap();
    eventData.putInt("progress", progress);

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


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