当前位置: 首页>>代码示例>>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;未经允许,请勿转载。