当前位置: 首页>>代码示例>>Java>>正文


Java Arguments.createMap方法代码示例

本文整理汇总了Java中com.facebook.react.bridge.Arguments.createMap方法的典型用法代码示例。如果您正苦于以下问题:Java Arguments.createMap方法的具体用法?Java Arguments.createMap怎么用?Java Arguments.createMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.bridge.Arguments的用法示例。


在下文中一共展示了Arguments.createMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCameraInfo

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public WritableMap getCameraInfo(int index) {
    CameraInfo info = new CameraInfo();

    Size size = null;
    try {
        Camera.getCameraInfo(index, info);
        Camera camera = Camera.open(index);
        size = getMaxSupportedVideoSize(camera);
        camera.release();
    } catch (Exception var3) {
        Logging.e("CameraEnumerationAndroid", "getCameraInfo failed on index " + index, var3);

        return null;
    }
    WritableMap params = Arguments.createMap();
    String facing = info.facing == 1 ? "front" : "back";
    params.putString("label", "Camera " + index + ", Facing " + facing + ", Orientation " + info.orientation);
    params.putString("id", "" + index);
    params.putString("facing", facing);
    params.putString("kind", "video");
    params.putString("maxWidth", String.valueOf(size.width));
    params.putString("maxHeight", String.valueOf(size.height));

    return params;
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:27,代码来源:WebRTCModule.java

示例2: returnMapForVoice

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
private WritableMap returnMapForVoice(Voice voice) {
	WritableMap voiceData = Arguments.createMap();
	voiceData.putString("voiceName", voice.getName());
	voiceData.putString("languageName", voice.getLocale().getDisplayLanguage());
	voiceData.putString("languageCode", voice.getLocale().getISO3Language());
	voiceData.putString("languageString", voice.getLocale().toString());
	voiceData.putString("countryName", voice.getLocale().getDisplayCountry());
	voiceData.putString("countryCode", voice.getLocale().getISO3Country());

	return voiceData;
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:12,代码来源:RNAndroidTextToSpeechModule.java

示例3: dispatch

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap eventData = null;

  if (mImageUri != null || mEventType == ON_LOAD) {
    eventData = Arguments.createMap();

    if (mImageUri != null) {
      eventData.putString("uri", mImageUri);
    }

    if (mEventType == ON_LOAD) {
      WritableMap source = Arguments.createMap();
      source.putDouble("width", mWidth);
      source.putDouble("height", mHeight);
      if (mImageUri != null) {
        source.putString("url", mImageUri);
      }
      eventData.putMap("source", source);
    }
  }

  rctEventEmitter.receiveEvent(getViewTag(), getEventName(), eventData);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:25,代码来源:ImageLoadEvent.java

示例4: listenVolume

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
private void listenVolume(final ReactApplicationContext reactContext) {
    volumeBR = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals("android.media.VOLUME_CHANGED_ACTION")) {
                WritableMap para = Arguments.createMap();
                para.putDouble("value", getNormalizationVolume(VOL_MUSIC));
                para.putDouble(VOL_VOICE_CALL, getNormalizationVolume(VOL_VOICE_CALL));
                para.putDouble(VOL_SYSTEM, getNormalizationVolume(VOL_SYSTEM));
                para.putDouble(VOL_RING, getNormalizationVolume(VOL_RING));
                para.putDouble(VOL_MUSIC, getNormalizationVolume(VOL_MUSIC));
                para.putDouble(VOL_ALARM, getNormalizationVolume(VOL_ALARM));
                para.putDouble(VOL_NOTIFICATION, getNormalizationVolume(VOL_NOTIFICATION));
                reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                        .emit("EventVolume", para);
            }
        }
    };
    filter = new IntentFilter("android.media.VOLUME_CHANGED_ACTION");

    reactContext.registerReceiver(volumeBR, filter);
}
 
开发者ID:c19354837,项目名称:react-native-system-setting,代码行数:23,代码来源:SystemSetting.java

示例5: locationToMap

import com.facebook.react.bridge.Arguments; //导入方法依赖的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;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:LocationModule.java

示例6: onCharacteristicChanged

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
	super.onCharacteristicChanged(gatt, characteristic);

	byte[] dataValue = characteristic.getValue();
	Log.d(LOG_TAG, "Read: " + BleManager.bytesToHex(dataValue) + " from peripheral: " + device.getAddress());

	WritableMap map = Arguments.createMap();
	map.putString("peripheral", device.getAddress());
	map.putString("characteristic", characteristic.getUuid().toString());
	map.putString("service", characteristic.getService().getUuid().toString());
	map.putString("value", BleManager.bytesToHex(dataValue));
	sendEvent("BleManagerDidUpdateValueForCharacteristic", map);

       if(dataCallback!=null){
           dataCallback.invoke("data ok",map);
       }
}
 
开发者ID:lenglengiOS,项目名称:react-native-blue-manager,代码行数:19,代码来源:Peripheral.java

示例7: serializeEventData

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
private WritableMap serializeEventData() {
  WritableMap eventData = Arguments.createMap();

  WritableMap contentSize = Arguments.createMap();
  contentSize.putDouble("width", mContentWidth);
  contentSize.putDouble("height", mContentHeight);
  eventData.putMap("contentSize", contentSize);

  eventData.putInt("target", getViewTag());
  return eventData;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:ReactContentSizeChangedEvent.java

示例8: onFaceDetection

import com.facebook.react.bridge.Arguments; //导入方法依赖的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);
        }
    }
}
 
开发者ID:entria,项目名称:react-native-camera-face-detector,代码行数:36,代码来源:RCTCameraViewFinder.java

示例9: decodePermissions

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
public static WritableMap decodePermissions(BluetoothGattCharacteristic characteristic) {

		// NOTE: props strings need to be consistent across iOS and Android
		WritableMap props = Arguments.createMap();
		int permissions = characteristic.getPermissions();

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ) != 0x0 ) {
			props.putString("Read", "Read");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE) != 0x0 ) {
			props.putString("Write", "Write");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED) != 0x0 ) {
			props.putString("ReadEncrypted", "ReadEncrypted");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED) != 0x0 ) {
			props.putString("WriteEncrypted", "WriteEncrypted");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM) != 0x0 ) {
			props.putString("ReadEncryptedMITM", "ReadEncryptedMITM");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED_MITM) != 0x0 ) {
			props.putString("WriteEncryptedMITM", "WriteEncryptedMITM");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED) != 0x0 ) {
			props.putString("WriteSigned", "WriteSigned");
		}

		if ((permissions & BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED_MITM) != 0x0 ) {
			props.putString("WriteSignedMITM", "WriteSignedMITM");
		}

		return props;
	}
 
开发者ID:lenglengiOS,项目名称:react-native-blue-manager,代码行数:41,代码来源:Helper.java

示例10: UserInfo

import com.facebook.react.bridge.Arguments; //导入方法依赖的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;
}
 
开发者ID:ccm-innovation,项目名称:react-native-twilio-chat,代码行数:12,代码来源:RCTConvert.java

示例11: serializeEventData

import com.facebook.react.bridge.Arguments; //导入方法依赖的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;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:30,代码来源:ScrollEvent.java

示例12: serializeEventData

import com.facebook.react.bridge.Arguments; //导入方法依赖的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

示例13: toWritableMap

import com.facebook.react.bridge.Arguments; //导入方法依赖的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;
}
 
开发者ID:CanalTP,项目名称:RNNavitiaSDK,代码行数:30,代码来源:MapUtil.java

示例14: scanSettingsToWritableMap

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
static public WritableMap scanSettingsToWritableMap(ScanSettings scanSettings) {
    WritableMap map;
    try {
        JSONObject json = scanSettings.toJSON();

        // Handle values that, strangely, are not put in json by Scandit framework
        if (!json.has("cameraFacingPreference")) {
            json.put("cameraFacingPreference", cameraFacingPreferenceToString(scanSettings.getCameraFacingPreference()));
        }
        if (!json.has("recognitionMode")) {
            json.put("recognitionMode", recognitionModeToString(scanSettings.getRecognitionMode()));
        }
        if (!json.has("codeCachingDuration")) {
            json.put("codeCachingDuration", scanSettings.getCodeCachingDuration());
        }
        if (!json.has("codeDuplicateFilter")) {
            json.put("codeDuplicateFilter", scanSettings.getCodeDuplicateFilter());
        }
        if (!json.has("codeRejectionEnabled")) {
            json.put("codeRejectionEnabled", scanSettings.isCodeRejectionEnabled());
        }
        if (!json.has("highDensityModeEnabled")) {
            json.put("highDensityModeEnabled", scanSettings.isHighDensityModeEnabled());
        }
        if (!json.has("matrixScanEnabled")) {
            json.put("matrixScanEnabled", scanSettings.isMatrixScanEnabled());
        }
        if (!json.has("maxNumberOfCodesPerFrame")) {
            json.put("maxNumberOfCodesPerFrame", scanSettings.getMaxNumberOfCodesPerFrame());
        }
        if (!json.has("relativeZoom")) {
            json.put("relativeZoom", scanSettings.getRelativeZoom());
        }
        if (!json.has("scanningHotSpot")) {
            json.put("scanningHotSpot", pointToWritableMap(scanSettings.getScanningHotSpot()));
        }
        if (!json.has("areaSettingsLandscape")) {
            json.put("areaSettingsLandscape", scanAreaToWritableMap(scanSettings.getAreaSettingsLandscape()));
        }
        if (!json.has("areaSettingsPortrait")) {
            json.put("areaSettingsPortrait", scanAreaToWritableMap(scanSettings.getAreaSettingsPortrait()));
        }

        // Handle values that, strangely, are put as codes instead of strings
        json.put("workingRange", workingRangeToString(scanSettings.getWorkingRange()));

        // TODO: textRecognition

        map = jsonObjectToWritableMap(json);

    } catch (JSONException e) {
        Log.e("React", "Could not convert scan settings to JSON");
        map = Arguments.createMap();
    }
    return map;
}
 
开发者ID:salathegroup,项目名称:react-native-scandit,代码行数:57,代码来源:ScanditBarcodeHelpers.java

示例15: emitSubscription

import com.facebook.react.bridge.Arguments; //导入方法依赖的package包/类
private void emitSubscription(String method, String message) {
    WritableMap params = Arguments.createMap();
    params.putString("method", method);
    params.putString("message", message);
    ReactNativeEventUtil.sendEvent(mReactContext, "nearbySubscribe", params);
}
 
开发者ID:miguelespinoza,项目名称:react-native-nearby,代码行数:7,代码来源:NearbyModule.java


注:本文中的com.facebook.react.bridge.Arguments.createMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。