當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。