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


Java ReadableArray.getString方法代码示例

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


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

示例1: getStringArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private String[] getStringArray(ReadableMap map, String key) {
    ReadableArray array = getArray(map, key);
    if (array == null) return null;

    ArrayList<String> list = new ArrayList<>();
    for (int i = 0; i < array.size(); i++) {
        if (array.getType(i) == ReadableType.String) {
            String str = array.getString(i);
            if (!isEmpty(str)) {
                list.add(str);
            }
        }
    }

    String[] arr = new String[list.size()];
    return list.toArray(arr);
}
 
开发者ID:joonhocho,项目名称:react-native-mail-compose,代码行数:18,代码来源:RNMailComposeModule.java

示例2: arrayGetByType

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private void arrayGetByType(ReadableArray array, int index, String typeToAskFor) {
  if (typeToAskFor.equals("double")) {
    array.getDouble(index);
  } else if (typeToAskFor.equals("int")) {
    array.getInt(index);
  } else if (typeToAskFor.equals("string")) {
    array.getString(index);
  } else if (typeToAskFor.equals("array")) {
    array.getArray(index);
  } else if (typeToAskFor.equals("map")) {
    array.getMap(index);
  } else if (typeToAskFor.equals("boolean")) {
    array.getBoolean(index);
  } else {
    throw new RuntimeException("Unknown type: " + typeToAskFor);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:CatalystNativeJSToJavaParametersTestCase.java

示例3: registerNotificationsReceiveNotificationActions

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private void registerNotificationsReceiveNotificationActions(ReadableArray actions) {
    IntentFilter intentFilter = new IntentFilter();
    // Add filter for each actions.
    for (int i = 0; i < actions.size(); i++) {
        String action = actions.getString(i);
        intentFilter.addAction(getReactApplicationContext().getPackageName() + "." + action);
    }
    getReactApplicationContext().registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Bundle bundle = intent.getBundleExtra("notification");

            // Notify the action.
            mJsDelivery.notifyNotificationAction(bundle);

            // Dismiss the notification popup.
            NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
            int notificationID = Integer.parseInt(bundle.getString("id"));
            manager.cancel(notificationID);
        }
    }, intentFilter);
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:23,代码来源:RNPushNotificationModule.java

示例4: createIceServers

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private List<PeerConnection.IceServer> createIceServers(ReadableArray iceServersArray) {
    final int size = (iceServersArray == null) ? 0 : iceServersArray.size();
    List<PeerConnection.IceServer> iceServers = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        ReadableMap iceServerMap = iceServersArray.getMap(i);
        boolean hasUsernameAndCredential = iceServerMap.hasKey("username") && iceServerMap.hasKey("credential");
        if (iceServerMap.hasKey("url")) {
            if (hasUsernameAndCredential) {
                iceServers.add(new PeerConnection.IceServer(iceServerMap.getString("url"), iceServerMap.getString("username"), iceServerMap.getString("credential")));
            } else {
                iceServers.add(new PeerConnection.IceServer(iceServerMap.getString("url")));
            }
        } else if (iceServerMap.hasKey("urls")) {
            switch (iceServerMap.getType("urls")) {
                case String:
                    if (hasUsernameAndCredential) {
                        iceServers.add(new PeerConnection.IceServer(iceServerMap.getString("urls"), iceServerMap.getString("username"), iceServerMap.getString("credential")));
                    } else {
                        iceServers.add(new PeerConnection.IceServer(iceServerMap.getString("urls")));
                    }
                    break;
                case Array:
                    ReadableArray urls = iceServerMap.getArray("urls");
                    for (int j = 0; j < urls.size(); j++) {
                        String url = urls.getString(j);
                        if (hasUsernameAndCredential) {
                            iceServers.add(new PeerConnection.IceServer(url,iceServerMap.getString("username"), iceServerMap.getString("credential")));
                        } else {
                            iceServers.add(new PeerConnection.IceServer(url));
                        }
                    }
                    break;
            }
        }
    }
    return iceServers;
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:38,代码来源:WebRTCModule.java

示例5: toArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static Object[] toArray(ReadableArray readableArray) {
  Object[] array = new Object[readableArray.size()];

  for (int i = 0; i < readableArray.size(); i++) {
    ReadableType type = readableArray.getType(i);

    switch (type) {
      case Null:
        array[i] = null;
        break;
      case Boolean:
        array[i] = readableArray.getBoolean(i);
        break;
      case Number:
        array[i] = readableArray.getDouble(i);
        break;
      case String:
        array[i] = readableArray.getString(i);
        break;
      case Map:
        array[i] = MapUtil.toMap(readableArray.getMap(i));
        break;
      case Array:
        array[i] = ArrayUtil.toArray(readableArray.getArray(i));
        break;
    }
  }

  return array;
}
 
开发者ID:davidstoneham,项目名称:react-native-mssql,代码行数:31,代码来源:ArrayUtil.java

示例6: readableArrayToStringArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static String[] readableArrayToStringArray(ReadableArray readableArray) {
    String[] arr = new String[readableArray.size()];
    for (int i = 0; i < readableArray.size(); i++) {
        arr[i] = readableArray.getString(i);
    }

    return arr;
}
 
开发者ID:reneweb,项目名称:react-native-tensorflow,代码行数:9,代码来源:ArrayConverter.java

示例7: toArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static Object[] toArray(ReadableArray readableArray) {
    Object[] array = new Object[readableArray.size()];

    for (int i = 0; i < readableArray.size(); i++) {
        ReadableType type = readableArray.getType(i);

        switch (type) {
            case Null:
                array[i] = null;
                break;
            case Boolean:
                array[i] = readableArray.getBoolean(i);
                break;
            case Number:
                array[i] = readableArray.getDouble(i);
                break;
            case String:
                array[i] = readableArray.getString(i);
                break;
            case Map:
                array[i] = MapUtil.toMap(readableArray.getMap(i));
                break;
            case Array:
                array[i] = ArrayUtil.toArray(readableArray.getArray(i));
                break;
        }
    }

    return array;
}
 
开发者ID:dangerfarms,项目名称:react-native-batch,代码行数:31,代码来源:ArrayUtil.java

示例8: setTabNames

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@ReactProp(name = "tabNames")
public void setTabNames(TabbedViewPager viewPager, ReadableArray readableArray) {
  String[] names = new String[readableArray.size()];
  for (int i = 0; i < readableArray.size(); i++) {
    names[i] = readableArray.getString(i);
  }
  viewPager.setTabNames(names);
}
 
开发者ID:madhu314,项目名称:react-native-tabbed-view-pager-android,代码行数:9,代码来源:TabbedViewPagerManager.java

示例9: subscribe

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@ReactMethod
public void subscribe(ReadableArray channels) {
    if(channels != null && channels.size() > 0) {
        for(int i = 0; i < channels.size(); i++) {
            String channel = channels.getString(i);
            this.subscribeChannel(channel);
        }
    }
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:10,代码来源:RNPushNotificationModule.java

示例10: extractHeaders

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
 * Extracts the headers from the Array. If the format is invalid, this method will return null.
 */
private @Nullable Headers extractHeaders(
    @Nullable ReadableArray headersArray,
    @Nullable ReadableMap requestData) {
  if (headersArray == null) {
    return null;
  }
  Headers.Builder headersBuilder = new Headers.Builder();
  for (int headersIdx = 0, size = headersArray.size(); headersIdx < size; headersIdx++) {
    ReadableArray header = headersArray.getArray(headersIdx);
    if (header == null || header.size() != 2) {
      return null;
    }
    String headerName = header.getString(0);
    String headerValue = header.getString(1);
    if (headerName == null || headerValue == null) {
      return null;
    }
    headersBuilder.add(headerName, headerValue);
  }
  if (headersBuilder.get(USER_AGENT_HEADER_NAME) == null && mDefaultUserAgent != null) {
    headersBuilder.add(USER_AGENT_HEADER_NAME, mDefaultUserAgent);
  }

  // Sanitize content encoding header, supported only when request specify payload as string
  boolean isGzipSupported = requestData != null && requestData.hasKey(REQUEST_BODY_KEY_STRING);
  if (!isGzipSupported) {
    headersBuilder.removeAll(CONTENT_ENCODING_HEADER_NAME);
  }

  return headersBuilder.build();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:35,代码来源:NetworkingModule.java

示例11: for

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
 * Build the String[] arguments needed for an SQL selection, i.e.:
 *  {a, b, c}
 * to be used in the SQL select statement: WHERE key in (?, ?, ?)
 */
/* package */ static String[] buildKeySelectionArgs(ReadableArray keys, int start, int count) {
  String[] selectionArgs = new String[count];
  for (int keyIndex = 0; keyIndex < count; keyIndex++) {
    selectionArgs[keyIndex] = keys.getString(start + keyIndex);
  }
  return selectionArgs;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:AsyncLocalStorageUtil.java

示例12: showAlert

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@ReactMethod
public void showAlert(
    ReadableMap options,
    Callback errorCallback,
    Callback actionCallback) {
    System.out.println("Pilipa Alert Module showAlert");

  FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper();
  if (fragmentManagerHelper == null) {
    errorCallback.invoke("Tried to show an alert while not attached to an Activity");
    return;
  }

  final Bundle args = new Bundle();
  if (options.hasKey(KEY_TITLE)) {
    args.putString(AlertFragment.ARG_TITLE, options.getString(KEY_TITLE));
  }
  if (options.hasKey(KEY_MESSAGE)) {
    args.putString(AlertFragment.ARG_MESSAGE, options.getString(KEY_MESSAGE));
  }
  if (options.hasKey(KEY_BUTTON_POSITIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_POSITIVE, options.getString(KEY_BUTTON_POSITIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEGATIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_NEGATIVE, options.getString(KEY_BUTTON_NEGATIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEUTRAL)) {
    args.putString(AlertFragment.ARG_BUTTON_NEUTRAL, options.getString(KEY_BUTTON_NEUTRAL));
  }
  if (options.hasKey(KEY_ITEMS)) {
    ReadableArray items = options.getArray(KEY_ITEMS);
    CharSequence[] itemsArray = new CharSequence[items.size()];
    for (int i = 0; i < items.size(); i ++) {
      itemsArray[i] = items.getString(i);
    }
    args.putCharSequenceArray(AlertFragment.ARG_ITEMS, itemsArray);
  }
  if (options.hasKey(KEY_CANCELABLE)) {
    args.putBoolean(KEY_CANCELABLE, options.getBoolean(KEY_CANCELABLE));
  }

  fragmentManagerHelper.showNewAlert(mIsInForeground, args, actionCallback);
}
 
开发者ID:pilipa-cn,项目名称:react-native-alert,代码行数:44,代码来源:DialogModule.java

示例13: printColumnsText

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
 * 打印表格的一行,可以指定列宽、对齐方式
 *
 * @param colsTextArr  各列文本字符串数组
 * @param colsWidthArr 各列宽度数组(以英文字符计算, 每个中文字符占两个英文字符, 每个宽度大于0)
 * @param colsAlign    各列对齐方式(0居左, 1居中, 2居右)
 *                     备注: 三个参数的数组长度应该一致, 如果colsText[i]的宽度大于colsWidth[i], 则文本换行
 */
@ReactMethod
public void printColumnsText(ReadableArray colsTextArr, ReadableArray colsWidthArr, ReadableArray colsAlign, final Promise p) {
    final IWoyouService ss = woyouService;
    final String[] clst = new String[colsTextArr.size()];
    for (int i = 0; i < colsTextArr.size(); i++) {
        clst[i] = colsTextArr.getString(i);
    }
    final int[] clsw = new int[colsWidthArr.size()];
    for (int i = 0; i < colsWidthArr.size(); i++) {
        clsw[i] = colsWidthArr.getInt(i);
    }
    final int[] clsa = new int[colsAlign.size()];
    for (int i = 0; i < colsAlign.size(); i++) {
        clsa[i] = colsAlign.getInt(i);
    }
    ThreadPoolManager.getInstance().executeTask(new Runnable() {
        @Override
        public void run() {
            try {
                ss.printColumnsText(clst, clsw, clsa, new ICallback.Stub() {
                    @Override
                    public void onRunResult(boolean isSuccess) {
                        if (isSuccess) {
                            p.resolve(null);
                        } else {
                            p.reject("0", isSuccess + "");
                        }
                    }

                    @Override
                    public void onReturnString(String result) {
                        p.resolve(result);
                    }

                    @Override
                    public void onRaiseException(int code, String msg) {
                        p.reject("" + code, msg);
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
                Log.i(TAG, "ERROR: " + e.getMessage());
                p.reject("" + 0, e.getMessage());
            }
        }
    });
}
 
开发者ID:januslo,项目名称:react-native-sunmi-inner-printer,代码行数:56,代码来源:SunmiInnerPrinterModule.java

示例14: draw

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, Paint paint, float opacity) {
  if (mFrame == null) {
    return;
  }
  opacity *= mOpacity;
  if (opacity <= MIN_OPACITY_FOR_DRAW) {
    return;
  }
  if (!mFrame.hasKey(PROP_LINES)) {
    return;
  }
  ReadableArray linesProp = mFrame.getArray(PROP_LINES);
  if (linesProp == null || linesProp.size() == 0) {
    return;
  }

  // only set up the canvas if we have something to draw
  saveAndSetupCanvas(canvas);
  String[] lines = new String[linesProp.size()];
  for (int i = 0; i < lines.length; i++) {
    lines[i] = linesProp.getString(i);
  }
  String text = TextUtils.join("\n", lines);
  if (setupStrokePaint(paint, opacity)) {
    applyTextPropertiesToPaint(paint);
    if (mPath == null) {
      canvas.drawText(text, 0, -paint.ascent(), paint);
    } else {
      canvas.drawTextOnPath(text, mPath, 0, 0, paint);
    }
  }
  if (setupFillPaint(paint, opacity)) {
    applyTextPropertiesToPaint(paint);
    if (mPath == null) {
      canvas.drawText(text, 0, -paint.ascent(), paint);
    } else {
      canvas.drawTextOnPath(text, mPath, 0, 0, paint);
    }
  }
  restoreCanvas(canvas);
  markUpdateSeen();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:44,代码来源:ARTTextShadowNode.java

示例15: showAlert

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
@ReactMethod
public void showAlert(
    ReadableMap options,
    Callback errorCallback,
    Callback actionCallback) {
  FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper();
  if (fragmentManagerHelper == null) {
    errorCallback.invoke("Tried to show an alert while not attached to an Activity");
    return;
  }

  final Bundle args = new Bundle();
  if (options.hasKey(KEY_TITLE)) {
    args.putString(AlertFragment.ARG_TITLE, options.getString(KEY_TITLE));
  }
  if (options.hasKey(KEY_MESSAGE)) {
    args.putString(AlertFragment.ARG_MESSAGE, options.getString(KEY_MESSAGE));
  }
  if (options.hasKey(KEY_BUTTON_POSITIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_POSITIVE, options.getString(KEY_BUTTON_POSITIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEGATIVE)) {
    args.putString(AlertFragment.ARG_BUTTON_NEGATIVE, options.getString(KEY_BUTTON_NEGATIVE));
  }
  if (options.hasKey(KEY_BUTTON_NEUTRAL)) {
    args.putString(AlertFragment.ARG_BUTTON_NEUTRAL, options.getString(KEY_BUTTON_NEUTRAL));
  }
  if (options.hasKey(KEY_ITEMS)) {
    ReadableArray items = options.getArray(KEY_ITEMS);
    CharSequence[] itemsArray = new CharSequence[items.size()];
    for (int i = 0; i < items.size(); i ++) {
      itemsArray[i] = items.getString(i);
    }
    args.putCharSequenceArray(AlertFragment.ARG_ITEMS, itemsArray);
  }
  if (options.hasKey(KEY_CANCELABLE)) {
    args.putBoolean(KEY_CANCELABLE, options.getBoolean(KEY_CANCELABLE));
  }

  fragmentManagerHelper.showNewAlert(mIsInForeground, args, actionCallback);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:42,代码来源:DialogModule.java


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