本文整理匯總了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;
}