當前位置: 首頁>>代碼示例>>Java>>正文


Java MapBuilder.newHashMap方法代碼示例

本文整理匯總了Java中com.facebook.react.common.MapBuilder.newHashMap方法的典型用法代碼示例。如果您正苦於以下問題:Java MapBuilder.newHashMap方法的具體用法?Java MapBuilder.newHashMap怎麽用?Java MapBuilder.newHashMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.react.common.MapBuilder的用法示例。


在下文中一共展示了MapBuilder.newHashMap方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import com.facebook.react.common.MapBuilder; //導入方法依賴的package包/類
public static ReactQueueConfigurationImpl create(
    ReactQueueConfigurationSpec spec,
    QueueThreadExceptionHandler exceptionHandler) {
  Map<MessageQueueThreadSpec, MessageQueueThreadImpl> specsToThreads = MapBuilder.newHashMap();

  MessageQueueThreadSpec uiThreadSpec = MessageQueueThreadSpec.mainThreadSpec();
  MessageQueueThreadImpl uiThread =
    MessageQueueThreadImpl.create( uiThreadSpec, exceptionHandler);
  specsToThreads.put(uiThreadSpec, uiThread);

  MessageQueueThreadImpl jsThread = specsToThreads.get(spec.getJSQueueThreadSpec());
  if (jsThread == null) {
    jsThread = MessageQueueThreadImpl.create(spec.getJSQueueThreadSpec(), exceptionHandler);
  }

  MessageQueueThreadImpl nativeModulesThread =
      specsToThreads.get(spec.getNativeModulesQueueThreadSpec());
  if (nativeModulesThread == null) {
    nativeModulesThread =
        MessageQueueThreadImpl.create(spec.getNativeModulesQueueThreadSpec(), exceptionHandler);
  }

  return new ReactQueueConfigurationImpl(uiThread, nativeModulesThread, jsThread);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:25,代碼來源:ReactQueueConfigurationImpl.java

示例2: getConstants

import com.facebook.react.common.MapBuilder; //導入方法依賴的package包/類
@Override
public Map<String, Object> getConstants() {
  final Context context = getContext();
  final Locale locale = context.getResources().getConfiguration().locale;

  final Map<String, Object> constants = MapBuilder.newHashMap();
  constants.put("isRTL", sharedI18nUtilInstance.isRTL(context));
  constants.put("localeIdentifier", locale.toString());
  return constants;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:11,代碼來源:I18nManagerModule.java

示例3: getConstants

import com.facebook.react.common.MapBuilder; //導入方法依賴的package包/類
@Override
public Map<String, Object> getConstants() {
  final Map<String, Object> constants = MapBuilder.newHashMap();
  constants.put(DURATION_SHORT_KEY, Toast.LENGTH_SHORT);
  constants.put(DURATION_LONG_KEY, Toast.LENGTH_LONG);
  constants.put(GRAVITY_TOP_KEY, Gravity.TOP | Gravity.CENTER_HORIZONTAL);
  constants.put(GRAVITY_BOTTOM_KEY, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
  constants.put(GRAVITY_CENTER, Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
  return constants;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:11,代碼來源:ToastModule.java

示例4: getConstants

import com.facebook.react.common.MapBuilder; //導入方法依賴的package包/類
@Override
public Map<String, Object> getConstants() {
  final Context context = getReactApplicationContext().getBaseContext();
  final Locale locale = context.getResources().getConfiguration().locale;

  final Map<String, Object> constants = MapBuilder.newHashMap();
  constants.put("isRTL", sharedI18nUtilInstance.isRTL(getReactApplicationContext()));
  constants.put("localeIdentifier", locale.toString());
  return constants;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:11,代碼來源:I18nManagerModule.java

示例5: for

import com.facebook.react.common.MapBuilder; //導入方法依賴的package包/類
/**
 * Generates map of constants that is then exposed by {@link UIManagerModule}. The constants map
 * contains the following predefined fields for 'customBubblingEventTypes' and
 * 'customDirectEventTypes'. Provided list of {@param viewManagers} is then used to populate
 * content of those predefined fields using
 * {@link ViewManager#getExportedCustomBubblingEventTypeConstants} and
 * {@link ViewManager#getExportedCustomDirectEventTypeConstants} respectively. Each view manager
 * is in addition allowed to expose viewmanager-specific constants that are placed under the key
 * that corresponds to the view manager's name (see {@link ViewManager#getName}). Constants are
 * merged into the map of {@link UIManagerModule} base constants that is stored in
 * {@link UIManagerModuleConstants}.
 * TODO(6845124): Create a test for this
 */
/* package */ static Map<String, Object> createConstants(
  List<ViewManager> viewManagers,
  boolean lazyViewManagersEnabled) {
  Map<String, Object> constants = UIManagerModuleConstants.getConstants();
  Map bubblingEventTypesConstants = UIManagerModuleConstants.getBubblingEventTypeConstants();
  Map directEventTypesConstants = UIManagerModuleConstants.getDirectEventTypeConstants();

  for (ViewManager viewManager : viewManagers) {
    SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "constants for ViewManager")
      .arg("ViewManager", viewManager.getName())
      .flush();
    try {
      Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
      if (viewManagerBubblingEvents != null) {
        recursiveMerge(bubblingEventTypesConstants, viewManagerBubblingEvents);
      }
      Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
      if (viewManagerDirectEvents != null) {
        recursiveMerge(directEventTypesConstants, viewManagerDirectEvents);
      }
      Map viewManagerConstants = MapBuilder.newHashMap();
      Map customViewConstants = viewManager.getExportedViewConstants();
      if (customViewConstants != null) {
        viewManagerConstants.put("Constants", customViewConstants);
      }
      Map viewManagerCommands = viewManager.getCommandsMap();
      if (viewManagerCommands != null) {
        viewManagerConstants.put("Commands", viewManagerCommands);
      }
      Map<String, String> viewManagerNativeProps = viewManager.getNativeProps();
      if (!viewManagerNativeProps.isEmpty()) {
        viewManagerConstants.put("NativeProps", viewManagerNativeProps);
      }
      if (!viewManagerConstants.isEmpty()) {
        constants.put(viewManager.getName(), viewManagerConstants);
      }
    } finally {
      Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    }
  }

  constants.put(CUSTOM_BUBBLING_EVENT_TYPES_KEY, bubblingEventTypesConstants);
  constants.put(CUSTOM_DIRECT_EVENT_TYPES_KEY, directEventTypesConstants);
  constants.put("AndroidLazyViewManagersEnabled", lazyViewManagersEnabled);

  return constants;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:61,代碼來源:UIManagerModuleConstantsHelper.java


注:本文中的com.facebook.react.common.MapBuilder.newHashMap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。