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


Java WritableMap.putDouble方法代码示例

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


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

示例1: 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) {
            map.putDouble(key, (Double) value);
        } else if (value instanceof String)  {
            map.putString(key, (String) value);
        } else {
            map.putString(key, value.toString());
        }
    }
    return map;
}
 
开发者ID:salathegroup,项目名称:react-native-scandit,代码行数:26,代码来源:ReactBridgeHelpers.java

示例2: onReceivedError

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
@Override
public void onReceivedError(
    WebView webView,
    int errorCode,
    String description,
    String failingUrl) {
  super.onReceivedError(webView, errorCode, description, failingUrl);
  mLastLoadFailed = true;

  // In case of an error JS side expect to get a finish event first, and then get an error event
  // Android WebView does it in the opposite way, so we need to simulate that behavior
  emitFinishEvent(webView, failingUrl);

  WritableMap eventData = createWebViewEvent(webView, failingUrl);
  eventData.putDouble("code", errorCode);
  eventData.putString("description", description);

  dispatchEvent(
      webView,
      new TopLoadingErrorEvent(webView.getId(), eventData));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ReactWebViewManager.java

示例3: checkForKeyboardEvents

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
private void checkForKeyboardEvents() {
  getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea);
  final int heightDiff =
    DisplayMetricsHolder.getWindowDisplayMetrics().heightPixels - mVisibleViewArea.bottom;
  if (mKeyboardHeight != heightDiff && heightDiff > mMinKeyboardHeightDetected) {
    // keyboard is now showing, or the keyboard height has changed
    mKeyboardHeight = heightDiff;
    WritableMap params = Arguments.createMap();
    WritableMap coordinates = Arguments.createMap();
    coordinates.putDouble("screenY", PixelUtil.toDIPFromPixel(mVisibleViewArea.bottom));
    coordinates.putDouble("screenX", PixelUtil.toDIPFromPixel(mVisibleViewArea.left));
    coordinates.putDouble("width", PixelUtil.toDIPFromPixel(mVisibleViewArea.width()));
    coordinates.putDouble("height", PixelUtil.toDIPFromPixel(mKeyboardHeight));
    params.putMap("endCoordinates", coordinates);
    sendEvent("keyboardDidShow", params);
  } else if (mKeyboardHeight != 0 && heightDiff <= mMinKeyboardHeightDetected) {
    // keyboard is now hidden
    mKeyboardHeight = 0;
    sendEvent("keyboardDidHide", null);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ReactRootView.java

示例4: 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;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:LocationModule.java

示例5: getDimensionsConstants

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
private WritableMap getDimensionsConstants() {
  DisplayMetrics windowDisplayMetrics = DisplayMetricsHolder.getWindowDisplayMetrics();
  DisplayMetrics screenDisplayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics();

  WritableMap windowDisplayMetricsMap = Arguments.createMap();
  windowDisplayMetricsMap.putInt("width", windowDisplayMetrics.widthPixels);
  windowDisplayMetricsMap.putInt("height", windowDisplayMetrics.heightPixels);
  windowDisplayMetricsMap.putDouble("scale", windowDisplayMetrics.density);
  windowDisplayMetricsMap.putDouble("fontScale", mFontScale);
  windowDisplayMetricsMap.putDouble("densityDpi", windowDisplayMetrics.densityDpi);

  WritableMap screenDisplayMetricsMap = Arguments.createMap();
  screenDisplayMetricsMap.putInt("width", screenDisplayMetrics.widthPixels);
  screenDisplayMetricsMap.putInt("height", screenDisplayMetrics.heightPixels);
  screenDisplayMetricsMap.putDouble("scale", screenDisplayMetrics.density);
  screenDisplayMetricsMap.putDouble("fontScale", mFontScale);
  screenDisplayMetricsMap.putDouble("densityDpi", screenDisplayMetrics.densityDpi);

  WritableMap dimensionsMap = Arguments.createMap();
  dimensionsMap.putMap("windowPhysicalPixels", windowDisplayMetricsMap);
  dimensionsMap.putMap("screenPhysicalPixels", screenDisplayMetricsMap);

  return dimensionsMap;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:25,代码来源:DeviceInfoModule.java

示例6: serializeEventData

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
private WritableMap serializeEventData() {
  WritableMap eventData = Arguments.createMap();
  WritableMap range = Arguments.createMap();
  range.putDouble("start", mRangeStart);
  range.putDouble("end", mRangeEnd);

  eventData.putString("text", mText);
  eventData.putString("previousText", mPreviousText);
  eventData.putMap("range", range);

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

示例7: 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;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:30,代码来源:ScrollEvent.java

示例8: testPresetDate

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
public void testPresetDate() {
  final WritableMap options = new WritableNativeMap();
  options.putDouble("date", getDateInMillis(2020, 5, 6));

  final DialogFragment datePickerFragment = showDialog(options);
  final DatePicker datePicker =
      ((DatePickerDialog) datePickerFragment.getDialog()).getDatePicker();

  assertEquals(2020, datePicker.getYear());
  assertEquals(5, datePicker.getMonth());
  assertEquals(6, datePicker.getDayOfMonth());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:DatePickerDialogTestCase.java

示例9: dispatch

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap data = Arguments.createMap();
  data.putDouble("width", PixelUtil.toDIPFromPixel(mWidth));
  data.putDouble("height", PixelUtil.toDIPFromPixel(mHeight));
  rctEventEmitter.receiveEvent(getViewTag(), EVENT_NAME, data);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:ContentSizeChangeEvent.java

示例10: resolveLocationQueryPromise

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
/**
 * Resolves the pending promise for user current location request
 *
 * @param Location location to use for promise resolve
 *
 * @return void
 */
private void resolveLocationQueryPromise(Location location) {
    if (pendingPromise != null) {
        WritableMap writableMap = new WritableNativeMap();
        writableMap.putDouble("longitude", location.getLongitude());
        writableMap.putDouble("latitude", location.getLatitude());
        writableMap.putString("provider", location.getProvider());
        writableMap.putDouble("accuracy", location.getAccuracy());
        writableMap.putDouble("altitude", location.getAltitude());
        pendingPromise.resolve(writableMap);
    }
    pendingPromise = null;
}
 
开发者ID:toystars,项目名称:react-native-geo-fence,代码行数:20,代码来源:RNGeoFenceModule.java

示例11: setDefaultPitch

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
@ReactMethod
public void setDefaultPitch(float pitch, Promise promise) {
	if(notReady(promise)) return;

	int result = tts.setPitch(pitch);
	if(result == TextToSpeech.SUCCESS) {
		WritableMap map = Arguments.createMap();
		map.putString("status", "Success");
		map.putDouble("pitch", (double)pitch);
		promise.resolve(map);
	} else {
		promise.reject("error", "Unable to set pitch");
	}
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:15,代码来源:RNAndroidTextToSpeechModule.java

示例12: onRmsChanged

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
@Override
public void onRmsChanged(float rmsdB) {
  Logger.debug(TAG, "onRmsChanged: " + rmsdB);
  WritableMap data = Arguments.createMap();
  data.putDouble("rmsdB", rmsdB);
  emit(SPEECH_TO_TEXT, data);
}
 
开发者ID:marshmelloX,项目名称:react-native-stt,代码行数:8,代码来源:SpeechRecognitionListener.java

示例13: serializeEventData

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

示例14: jsonToWritableMap

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
public static WritableMap jsonToWritableMap(JSONObject jsonObject) {
    WritableMap writableMap = new WritableNativeMap();

    if (jsonObject == null) {
        return null;
    }


    Iterator<String> iterator = jsonObject.keys();
    if (!iterator.hasNext()) {
        return null;
    }


    try {
        while (iterator.hasNext()) {
            String key = iterator.next();
            Object value = jsonObject.get(key);
            if (value == null) {
                writableMap.putNull(key);
            } else if (value instanceof Boolean) {
                writableMap.putBoolean(key, (Boolean) value);
            } else if (value instanceof Integer) {
                writableMap.putInt(key, (Integer) value);
            } else if (value instanceof Double) {
                writableMap.putDouble(key, (Double) value);
            } else if (value instanceof String) {
                writableMap.putString(key, (String) value);
            } else if (value instanceof JSONObject) {
                writableMap.putMap(key, jsonToWritableMap((JSONObject) value));
            } else if (value instanceof JSONArray) {
                writableMap.putArray(key, jsonArrayToWritableArray((JSONArray) value));
            }
        }
    } catch (JSONException ex){
            // Do nothing and fail silently
    }

    return writableMap;
}
 
开发者ID:ccm-innovation,项目名称:react-native-twilio-chat,代码行数:41,代码来源:RCTConvert.java

示例15: serializeEventData

import com.facebook.react.bridge.WritableMap; //导入方法依赖的package包/类
private WritableMap serializeEventData() {
  WritableMap eventData = Arguments.createMap();
  eventData.putDouble("drawerState", getDrawerState());
  return eventData;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:6,代码来源:DrawerStateChangedEvent.java


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