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