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


Java Arguments类代码示例

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


Arguments类属于com.facebook.react.bridge包,在下文中一共展示了Arguments类的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: onInfo

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
    switch (what) {
        case MediaPlayer.MEDIA_INFO_BUFFERING_START:
            mEventEmitter.receiveEvent(getId(), Events.EVENT_STALLED.toString(), Arguments.createMap());
            break;
        case MediaPlayer.MEDIA_INFO_BUFFERING_END:
            mEventEmitter.receiveEvent(getId(), Events.EVENT_RESUME.toString(), Arguments.createMap());
            break;
        case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
            mEventEmitter.receiveEvent(getId(), Events.EVENT_READY_FOR_DISPLAY.toString(), Arguments.createMap());
            break;

        default:
    }
    return false;
}
 
开发者ID:12d,项目名称:react-native-videoplayer,代码行数:18,代码来源:ReactVideoView.java

示例3: queryCache

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
@ReactMethod
public void queryCache(final ReadableArray uris, final Promise promise) {
  // perform cache interrogation in async task as disk cache checks are expensive
  new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
    @Override
    protected void doInBackgroundGuarded(Void... params) {
      WritableMap result = Arguments.createMap();
      ImagePipeline imagePipeline = Fresco.getImagePipeline();
      for (int i = 0; i < uris.size(); i++) {
        String uriString = uris.getString(i);
        final Uri uri = Uri.parse(uriString);
        if (imagePipeline.isInBitmapMemoryCache(uri)) {
          result.putString(uriString, "memory");
        } else if (imagePipeline.isInDiskCacheSync(uri)) {
          result.putString(uriString, "disk");
        }
      }
      promise.resolve(result);
    }
  }.executeOnExecutor(GuardedAsyncTask.THREAD_POOL_EXECUTOR);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ImageLoaderModule.java

示例4: getEnginesInfo

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
@ReactMethod
public void getEnginesInfo(Promise promise) {
	if(notReady(promise)) return;

	try {
		WritableArray ttsInfo = Arguments.createArray();

		List<TextToSpeech.EngineInfo> engineList = tts.getEngines();
		Iterator iterator = engineList.iterator();
		while(iterator.hasNext()) {
			ttsInfo.pushString(iterator.next().toString());
		}

		promise.resolve(ttsInfo);
	} catch(Exception e) {
		promise.reject("error", "Unable to retrieve TTS Engine info for getEnginesInfo()", e);
	}
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:19,代码来源:RNAndroidTextToSpeechModule.java

示例5: handleError

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
private void handleError() {
  LogUtils.d(TAG, "handleError");
  if(tweetView != null) {
    tweetView.setVisibility(View.INVISIBLE);
  }

  WritableMap evt = Arguments.createMap();
  evt.putString("message", "Could not load tweet");

  ReactContext ctx = (ReactContext) getContext();
  ctx.getJSModule(RCTEventEmitter.class).receiveEvent(
          getId(),
          "onLoadError",
          evt);

}
 
开发者ID:netceteragroup,项目名称:react-native-twitterkit,代码行数:17,代码来源:TweetView.java

示例6: jsonToReact

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
public static WritableMap jsonToReact(JSONObject jsonObject) throws JSONException {
    WritableMap writableMap = Arguments.createMap();
    Iterator iterator = jsonObject.keys();
    while(iterator.hasNext()) {
        String key = (String) iterator.next();
        Object value = jsonObject.get(key);
        if (value instanceof Float || value instanceof Double) {
            writableMap.putDouble(key, jsonObject.getDouble(key));
        } else if (value instanceof Number) {
            writableMap.putInt(key, jsonObject.getInt(key));
        } else if (value instanceof String) {
            writableMap.putString(key, jsonObject.getString(key));
        } else if (value instanceof JSONObject) {
            writableMap.putMap(key,jsonToReact(jsonObject.getJSONObject(key)));
        } else if (value instanceof JSONArray){
            writableMap.putArray(key, jsonToReact(jsonObject.getJSONArray(key)));
        } else if (value == JSONObject.NULL){
            writableMap.putNull(key);
        }
    }

    return writableMap;
}
 
开发者ID:whitedogg13,项目名称:react-native-nfc-manager,代码行数:24,代码来源:JsonConvert.java

示例7: 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

示例8: checkForKeyboardEvents

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

示例9: _newAsyncObject

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
@ReactMethod
public void _newAsyncObject(final String name, String defaultValue) {
    try {
        JSONObject object = new JSONObject(defaultValue);
        TaplyticsVar var = new TaplyticsVar<>(name, object, new TaplyticsVarListener() {
            @Override
            public void variableUpdated(Object o) {
                WritableMap params = Arguments.createMap();
                params.putString("value", ((JSONObject) o).toString());
                sendEvent(name, params);
            }
        });
    } catch (JSONException e) {
        Log.e(tagName, e.getMessage());
    }
}
 
开发者ID:taplytics,项目名称:taplytics-react-native,代码行数:17,代码来源:TaplyticsReactModule.java

示例10: getIntentData

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
private WritableMap getIntentData(Intent intent) {
    WritableMap data = Arguments.createMap();
    JSONObject dataObject = new JSONObject();
    try {
        if (intent.hasExtra("tl_id")) {
            dataObject.put("tl_id", intent.getExtras().getString("tl_id"));
        }
        if (intent.hasExtra("custom_keys")) {
            dataObject.put("custom_keys", new JSONObject(intent.getExtras().getString("custom_keys")));
        }
    } catch (Throwable ignored) {
        //Ignore the bad JSON for now. Log here as you please.
    }
    data.putString("value", dataObject.toString());
    return data;
}
 
开发者ID:taplytics,项目名称:taplytics-react-native,代码行数:17,代码来源:TRNBroadcastReceiver.java

示例11: processDataSet

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
private void processDataSet(DataSet dataSet, WritableArray map) {
    //Log.i(TAG, "Data returned for Data type: " + dataSet.getDataType().getName());

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
    dateFormat.setTimeZone(TimeZone.getDefault());

    WritableMap stepMap = Arguments.createMap();

    for (DataPoint dp : dataSet.getDataPoints()) {
        Log.i(TAG, "\tData point:");
        Log.i(TAG, "\t\tType : " + dp.getDataType().getName());
        Log.i(TAG, "\t\tStart: " + dateFormat.format(dp.getStartTime(TimeUnit.MILLISECONDS)));
        Log.i(TAG, "\t\tEnd  : " + dateFormat.format(dp.getEndTime(TimeUnit.MILLISECONDS)));

        for(Field field : dp.getDataType().getFields()) {
            Log.i(TAG, "\t\tField: " + field.getName() +
                    " Value: " + dp.getValue(field));

            stepMap.putDouble("startDate", dp.getStartTime(TimeUnit.MILLISECONDS));
            stepMap.putDouble("endDate", dp.getEndTime(TimeUnit.MILLISECONDS));
            stepMap.putDouble("steps", dp.getValue(field).asInt());
            map.pushMap(stepMap);
        }
    }
}
 
开发者ID:StasDoskalenko,项目名称:react-native-google-fit,代码行数:26,代码来源:StepHistory.java

示例12: startListeningToAnimatedNodeValue

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

示例13: sendResponse

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
private void sendResponse(String status, String message, Promise promise) {
    Reprint.cancelAuthentication();
    response = Arguments.createMap();
    response.putString("status", status);
    response.putString("error", message);
    promise.resolve(response);
}
 
开发者ID:ElekenAgency,项目名称:react-native-touch-id-android,代码行数:8,代码来源:FingerprintModule.java

示例14: scheduleLocalNotification

import com.facebook.react.bridge.Arguments; //导入依赖的package包/类
@ReactMethod
public void scheduleLocalNotification(ReadableMap details) {
    Bundle bundle = Arguments.toBundle(details);
    // If notification ID is not provided by the user, generate one at random
    if (bundle.getString("id") == null) {
        bundle.putString("id", String.valueOf(mRandomNumberGenerator.nextInt()));
    }
    mRNPushNotificationHelper.sendNotificationScheduled(bundle);
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:10,代码来源:RNPushNotificationModule.java

示例15: onEvent

import com.facebook.react.bridge.Arguments; //导入依赖的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);
}
 
开发者ID:marshmelloX,项目名称:react-native-stt,代码行数:9,代码来源:SpeechRecognitionListener.java


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