本文整理汇总了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;
}
示例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);
}
});
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}