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


Java ReadableMap类代码示例

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


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

示例1: capture

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
@ReactMethod
public void capture(final ReadableMap options, final Promise promise) {
    int orientation = options.hasKey("orientation") ? options.getInt("orientation") : RCTCamera.getInstance().getOrientation();
    if (orientation == RCT_CAMERA_ORIENTATION_AUTO) {
        _sensorOrientationChecker.onResume();
        _sensorOrientationChecker.registerOrientationListener(new RCTSensorOrientationListener() {
            @Override
            public void orientationEvent() {
                int deviceOrientation = _sensorOrientationChecker.getOrientation();
                _sensorOrientationChecker.unregisterOrientationListener();
                _sensorOrientationChecker.onPause();
                captureWithOrientation(options, promise, deviceOrientation);
            }
        });
    } else {
        captureWithOrientation(options, promise, orientation);
    }
}
 
开发者ID:entria,项目名称:react-native-camera-face-detector,代码行数:19,代码来源:RCTCameraModule.java

示例2: getSourceIdConstraint

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
/**
 * Retreives "sourceId" constraint value.
 * @param mediaConstraints a <tt>ReadableMap</tt> which represents "GUM"
 * constraints argument
 * @return String value of "sourceId" optional "GUM" constraint or
 * <tt>null</tt> if not specified in the given map.
 */
private String getSourceIdConstraint(ReadableMap mediaConstraints) {
    if (mediaConstraints.hasKey("optional")
            && mediaConstraints.getType("optional") == ReadableType.Array) {
        ReadableArray optional = mediaConstraints.getArray("optional");

        for (int i = 0, size = optional.size(); i < size; i++) {
            if (optional.getType(i) == ReadableType.Map) {
                ReadableMap option = optional.getMap(i);

                if (option.hasKey("sourceId")
                        && option.getType("sourceId") == ReadableType.String) {
                    return option.getString("sourceId");
                }
            }
        }
    }
    return null;
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:26,代码来源:WebRTCModule.java

示例3: FrescoBasedReactTextInlineImageSpan

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
public FrescoBasedReactTextInlineImageSpan(
    Resources resources,
    int height,
    int width,
    @Nullable Uri uri,
    ReadableMap headers,
    AbstractDraweeControllerBuilder draweeControllerBuilder,
    @Nullable Object callerContext) {
  mDraweeHolder = new DraweeHolder(
      GenericDraweeHierarchyBuilder.newInstance(resources)
          .build()
  );
  mDraweeControllerBuilder = draweeControllerBuilder;
  mCallerContext = callerContext;

  mHeight = height;
  mWidth = width;
  mUri = (uri != null) ? uri : Uri.EMPTY;
  mHeaders = headers;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:FrescoBasedReactTextInlineImageSpan.java

示例4: createFragmentArguments

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
private Bundle createFragmentArguments(ReadableMap options) {
  final Bundle args = new Bundle();
  if (options.hasKey(ARG_DATE) && !options.isNull(ARG_DATE)) {
    args.putLong(ARG_DATE, (long) options.getDouble(ARG_DATE));
  }
  if (options.hasKey(ARG_MINDATE) && !options.isNull(ARG_MINDATE)) {
    args.putLong(ARG_MINDATE, (long) options.getDouble(ARG_MINDATE));
  }
  if (options.hasKey(ARG_MAXDATE) && !options.isNull(ARG_MAXDATE)) {
    args.putLong(ARG_MAXDATE, (long) options.getDouble(ARG_MAXDATE));
  }
  if (options.hasKey(ARG_MODE) && !options.isNull(ARG_MODE)) {
    args.putString(ARG_MODE, options.getString(ARG_MODE));
  }
  return args;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:DatePickerDialogModule.java

示例5: createView

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
/**
 * Invoked by React to create a new node with a given tag, class name and properties.
 */
public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
  ReactShadowNode cssNode = createShadowNode(className);
  ReactShadowNode rootNode = mShadowNodeRegistry.getNode(rootViewTag);
  cssNode.setReactTag(tag);
  cssNode.setViewClassName(className);
  cssNode.setRootNode(rootNode);
  cssNode.setThemedContext(rootNode.getThemedContext());

  mShadowNodeRegistry.addNode(cssNode);

  ReactStylesDiffMap styles = null;
  if (props != null) {
    styles = new ReactStylesDiffMap(props);
    cssNode.updateProperties(styles);
  }

  handleCreateView(cssNode, rootViewTag, styles);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:UIImplementation.java

示例6: stackTraceToString

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
private String stackTraceToString(String message, ReadableArray stack) {
  StringBuilder stringBuilder = new StringBuilder(message).append(", stack:\n");
  for (int i = 0; i < stack.size(); i++) {
    ReadableMap frame = stack.getMap(i);
    stringBuilder
        .append(frame.getString("methodName"))
        .append("@")
        .append(stackFrameToModuleId(frame))
        .append(frame.getInt("lineNumber"));
    if (frame.hasKey("column") &&
        !frame.isNull("column") &&
        frame.getType("column") == ReadableType.Number) {
      stringBuilder
          .append(":")
          .append(frame.getInt("column"));
    }
    stringBuilder.append("\n");
  }
  return stringBuilder.toString();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ExceptionsManagerModule.java

示例7: startAnimatingNode

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
@ReactMethod
public void startAnimatingNode(
    final int animationId,
    final int animatedNodeTag,
    final ReadableMap animationConfig,
    final Callback endCallback) {
  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatedNodesManager animatedNodesManager) {
      animatedNodesManager.startAnimatingNode(
        animationId,
        animatedNodeTag,
        animationConfig,
        endCallback);
    }
  });
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:NativeAnimatedModule.java

示例8: testArrayWithMaps

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
public void testArrayWithMaps() {
  mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnArrayWithMaps();
  waitForBridgeAndUIIdle();

  List<ReadableArray> calls = mRecordingTestModule.getArrayCalls();
  assertEquals(1, calls.size());
  ReadableArray array = calls.get(0);
  assertEquals(2, array.size());

  assertFalse(array.isNull(0));
  ReadableMap m1 = array.getMap(0);
  ReadableMap m2 = array.getMap(1);

  assertEquals("m1v1", m1.getString("m1k1"));
  assertEquals("m1v2", m1.getString("m1k2"));
  assertEquals("m2v1", m2.getString("m2k1"));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:CatalystNativeJSToJavaParametersTestCase.java

示例9: createIntent

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
private Intent createIntent(String action, ReadableMap extra) {
  final Intent intent = new Intent(action);
  for (
    ReadableMapKeySetIterator it = extra.keySetIterator();
    it.hasNextKey();
  ) {
    String key = it.nextKey();
    ReadableType type = extra.getType(key);
    switch(type) {
      case Null:
        break;
      case Boolean:
        intent.putExtra(key, extra.getBoolean(key));
        break;
      case Number:
        intent.putExtra(key, extra.getInt(key));
        break;
      case String:
        intent.putExtra(key, extra.getString(key));
        break;
      default:
        throw new IllegalArgumentException("Unsupported type " + type);
    }
  }
  return intent;
}
 
开发者ID:de-code,项目名称:react-native-android-speech-recognizer,代码行数:27,代码来源:RNAndroidSpeechRecognizerModule.java

示例10: setTextShadowOffset

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
@ReactProp(name = PROP_SHADOW_OFFSET)
public void setTextShadowOffset(ReadableMap offsetMap) {
  mTextShadowOffsetDx = 0;
  mTextShadowOffsetDy = 0;

  if (offsetMap != null) {
    if (offsetMap.hasKey(PROP_SHADOW_OFFSET_WIDTH) &&
        !offsetMap.isNull(PROP_SHADOW_OFFSET_WIDTH)) {
      mTextShadowOffsetDx =
          PixelUtil.toPixelFromDIP(offsetMap.getDouble(PROP_SHADOW_OFFSET_WIDTH));
    }
    if (offsetMap.hasKey(PROP_SHADOW_OFFSET_HEIGHT) &&
        !offsetMap.isNull(PROP_SHADOW_OFFSET_HEIGHT)) {
      mTextShadowOffsetDy =
          PixelUtil.toPixelFromDIP(offsetMap.getDouble(PROP_SHADOW_OFFSET_HEIGHT));
    }
  }

  markUpdated();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ReactTextShadowNode.java

示例11: createChannel

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
@ReactMethod
public void createChannel(ReadableMap options, final Promise promise) {
    final JSONObject attributes = RCTConvert.readableMapToJson(options.getMap("attributes"));
    final String uniqueName = options.getString("uniqueName");
    String friendlyName = options.getString("friendlyName");
    Channel.ChannelType type = (options.getString("type").compareTo("CHANNEL_TYPE_PRIVATE") == 0) ? Channel.ChannelType.PRIVATE : Channel.ChannelType.PUBLIC;

    channels().channelBuilder()
            .withUniqueName(uniqueName)
            .withFriendlyName(friendlyName)
            .withType(type)
            .withAttributes(attributes)
            .build(new CallbackListener<Channel>() {
                @Override
                public void onError(final ErrorInfo errorInfo) {
                    super.onError(errorInfo);
                    promise.reject("create-channel-error", "Error occurred while attempting to createChannel.");
                }

                @Override
                public void onSuccess(final Channel newChannel) {
                    promise.resolve(RCTConvert.Channel(newChannel));
                }
            });
}
 
开发者ID:ccm-innovation,项目名称:react-native-twilio-chat,代码行数:26,代码来源:RCTTwilioChatChannels.java

示例12: setActions

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
public void setActions(@Nullable ReadableArray actions) {
    Menu menu = getMenu();
    menu.clear();
    mActionsHolder.clear();
    if (actions != null) {
        for (int i = 0; i < actions.size(); i++) {
            ReadableMap action = actions.getMap(i);

            MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString("title"));
            setMenuItemIcon(item, action.getMap("icon"));
            if (action.getBoolean("disabled")) {
                item.setEnabled(false);
            }
        }
    }
}
 
开发者ID:timomeh,项目名称:react-native-android-bottom-navigation,代码行数:17,代码来源:RNBottomNavigation.java

示例13: setIconSource

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
private void setIconSource(ReadableMap source, IconControllerListener controllerListener,
                           DraweeHolder holder) {
    String uri = source != null ? source.getString("uri") : null;

    if (uri == null) {
        controllerListener.setIconImageInfo(null);
        controllerListener.setDrawable(null);
    } else if (uri.startsWith("http://") || uri.startsWith("https://") ||
            uri.startsWith("file://")) {
        controllerListener.setIconImageInfo(getIconImageInfo(source));
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setUri(Uri.parse(uri))
                .setControllerListener(controllerListener)
                .setOldController(holder.getController())
                .build();
        holder.setController(controller);
        holder.getTopLevelDrawable().setVisible(true, true);
    } else {
        controllerListener.setDrawable(getDrawableByName(uri));
    }
}
 
开发者ID:timomeh,项目名称:react-native-android-bottom-navigation,代码行数:22,代码来源:RNBottomNavigation.java

示例14: getView

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
private View getView(int position, View convertView, ViewGroup parent, boolean isDropdown) {
  ReadableMap item = getItem(position);

  if (convertView == null) {
    int layoutResId = isDropdown
        ? android.R.layout.simple_spinner_dropdown_item
        : android.R.layout.simple_spinner_item;
    convertView = mInflater.inflate(layoutResId, parent, false);
  }

  TextView textView = (TextView) convertView;
  textView.setText(item.getString("label"));
  if (!isDropdown && mPrimaryTextColor != null) {
    textView.setTextColor(mPrimaryTextColor);
  } else if (item.hasKey("color") && !item.isNull("color")) {
    textView.setTextColor(item.getInt("color"));
  }

  return convertView;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ReactPickerManager.java

示例15: buildColorStateList

import com.facebook.react.bridge.ReadableMap; //导入依赖的package包/类
private ColorStateList buildColorStateList(ReadableMap colorMap) {
    int[][] states = new int[][] {
            new int[] { android.R.attr.state_checked },
            new int[] {-android.R.attr.state_enabled },
            new int[] { },
    };

    Map<String, String> colorStates = unifyColors(colorMap);

    int[] colors = new int[] {
            Color.parseColor(colorStates.get("active")),
            Color.parseColor(colorStates.get("disabled")),
            Color.parseColor(colorStates.get("default"))
    };

    return new ColorStateList(states, colors);
}
 
开发者ID:timomeh,项目名称:react-native-android-bottom-navigation,代码行数:18,代码来源:RNBottomNavigationManager.java


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