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