public static boolean hasValidKey(String key, ReadableMap options) { return options != null && options.hasKey(key) && !options.isNull(key); } protected abstract String getPackage();
protected void openIntentChooser() throws ActivityNotFoundException { if(this.options.hasKey("forceDialog") && this.options.getBoolean("forceDialog")){ Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle); chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.reactContext.startActivity(chooser); }else{ this.getIntent().setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.reactContext.startActivity(this.getIntent()); } } }
if (options.hasKey("blured")) { getBluredImages = options.getBoolean("blured"); if (options.hasKey("artist")) { getArtistFromSong = options.getBoolean("artist"); if (options.hasKey("duration")) { getDurationFromSong = options.getBoolean("duration"); if (options.hasKey("title")) { getTitleFromSong = options.getBoolean("title"); if (options.hasKey("id")) { getIDFromSong = options.getBoolean("id"); if (options.hasKey("cover")) { getCoverFromSong = options.getBoolean("cover"); if (options.hasKey("genre")) { getGenreFromSong = options.getBoolean("genre"); if (options.hasKey("album")) { getAlbumFromSong = options.getBoolean("album"); if (options.hasKey("batchNumber")) { songsPerIteration = options.getInt("batchNumber"); if (options.hasKey("minimumSongDuration") && options.getInt("minimumSongDuration") > 0) { minimumSongDuration = options.getInt("minimumSongDuration");
static private OAuthRequest addParametersToRequest( OAuthRequest request, final String access_token, @Nullable final ReadableMap params ) { if (params != null && params.hasKey("params")) { ReadableMapKeySetIterator iterator = params.keySetIterator(); while (iterator.hasNextKey()) { String key = iterator.nextKey(); ReadableType readableType = params.getType(key); switch(readableType) { case String: String val = params.getString(key); // String escapedVal = Uri.encode(val); if (val.equals("access_token")) { val = access_token; } request.addParameter(key, val); break; default: throw new IllegalArgumentException("Could not read object with key: " + key); } } } return request; }
/** * Convert a JavaScript stack trace (see {@code parseErrorStack} JS module) to an array of * {@link StackFrame}s. */ public static StackFrame[] convertJsStackTrace(@Nullable ReadableArray stack) { int size = stack != null ? stack.size() : 0; StackFrame[] result = new StackFrame[size]; for (int i = 0; i < size; i++) { ReadableMap frame = stack.getMap(i); String methodName = frame.getString("methodName"); String fileName = frame.getString("file"); int lineNumber = -1; if (frame.hasKey(LINE_NUMBER_KEY) && !frame.isNull(LINE_NUMBER_KEY)) { lineNumber = frame.getInt(LINE_NUMBER_KEY); } int columnNumber = -1; if (frame.hasKey(COLUMN_KEY) && !frame.isNull(COLUMN_KEY)) { columnNumber = frame.getInt(COLUMN_KEY); } result[i] = new StackFrameImpl(fileName, methodName, lineNumber, columnNumber); } return result; }
if (options.hasKey("onPositive")) { mBuilder.onPositive(new MaterialDialog.SingleButtonCallback() { @Override if (options.hasKey("onNegative")) { mBuilder.onNegative(new MaterialDialog.SingleButtonCallback() { @Override if (options.hasKey("onNeutral")) { mBuilder.onNeutral(new MaterialDialog.SingleButtonCallback() { @Override if (options.hasKey("onAny")) { mBuilder.onAny(new MaterialDialog.SingleButtonCallback() { @Override if (options.hasKey("itemsCallback")) { mBuilder.itemsCallback(new MaterialDialog.ListCallback() { @Override if (options.hasKey("itemsCallbackSingleChoice")) { int selectedIndex = options.hasKey("selectedIndex") ? options.getInt("selectedIndex") : -1; mBuilder.itemsCallbackSingleChoice(selectedIndex, new MaterialDialog.ListCallbackSingleChoice() { @Override if (options.hasKey("itemsCallbackMultiChoice")) { if (options.hasKey("selectedIndices")) {
break; case "content": if(options.hasKey("contentIsHtml") && options.getBoolean("contentIsHtml")) { boolean defaultValue = options.hasKey("checkboxDefaultValue") && options.getBoolean("checkboxDefaultValue"); builder.checkBoxPrompt(options.getString("checkboxLabel"), defaultValue, null); break; case "progress": ReadableMap progress = options.getMap("progress"); boolean indeterminate = progress.hasKey("indeterminate") && progress.getBoolean("indeterminate"); boolean horizontal = progress.hasKey("style") && progress.getString("style").equals("horizontal"); if (horizontal) builder.progressIndeterminateStyle(horizontal); } else {
.title(options.hasKey("title") ? options.getString("title") : "") .adapter(simpleListAdapter, null) .autoDismiss(true);