List of usage examples for android.os Bundle putBooleanArray
public void putBooleanArray(@Nullable String key, @Nullable boolean[] value)
From source file:Main.java
@SuppressWarnings("unchecked") private static void putArray(String key, ArrayList arrayList, Bundle bundle) { if (arrayList.size() == 0) { bundle.putBooleanArray(key, new boolean[] {}); } else {//from w w w. j a v a2s.c om verifyArrayListIsSingleType(arrayList); if (arrayList.get(0) instanceof String) { bundle.putStringArray(key, toStringArray((ArrayList<String>) arrayList)); } else if (arrayList.get(0) instanceof Integer) { bundle.putIntArray(key, toIntArray((ArrayList<Integer>) arrayList)); } else if (arrayList.get(0) instanceof Float) { bundle.putFloatArray(key, toFloatArray((ArrayList<Float>) arrayList)); } else if (arrayList.get(0) instanceof Double) { bundle.putDoubleArray(key, toDoubleArray((ArrayList<Double>) arrayList)); } else if (arrayList.get(0) instanceof Boolean) { bundle.putBooleanArray(key, toBooleanArray((ArrayList<Boolean>) arrayList)); } else if (arrayList.get(0) instanceof HashMap) { bundle.putParcelableArray(key, toBundleArray((ArrayList<HashMap>) arrayList)); } else if (arrayList.get(0) instanceof ArrayList) { Log.w("RNNavigation", "Arrays of arrays passed in props are converted to dictionaries with indexes as keys"); Bundle innerArray = new Bundle(); for (int i = 0; i < arrayList.size(); i++) { putArray(String.valueOf(i), (ArrayList) arrayList.get(i), innerArray); } bundle.putParcelable(key, innerArray); } } }
From source file:com.iskrembilen.quasseldroid.gui.dialogs.HideEventsDialog.java
public static @NonNull HideEventsDialog newInstance(Buffer buffer) { HideEventsDialog fragment = new HideEventsDialog(); String[] filterList = IrcMessage.Type.getFilterList(); boolean[] checked = new boolean[filterList.length]; ArrayList<IrcMessage.Type> filters = buffer.getFilters(); for (int i = 0; i < checked.length; i++) { checked[i] = (filters.contains(IrcMessage.Type.valueOf(filterList[i]))); }/*from w ww. jav a 2 s .c o m*/ Bundle args = new Bundle(); args.putStringArray("filterlist", filterList); args.putBooleanArray("checked", checked); args.putInt("bufferid", buffer.getInfo().id); fragment.setArguments(args); return fragment; }
From source file:net.reichholf.dreamdroid.fragment.dialogs.MultiChoiceDialog.java
public static MultiChoiceDialog newInstance(int titleId, CharSequence[] items, boolean[] checkedItems, int positiveStringId, int negativeStringId) { MultiChoiceDialog fragment = new MultiChoiceDialog(); Bundle args = new Bundle(); args.putInt(KEY_TITLE_ID, titleId);//w ww . j a v a 2s .c o m args.putStringArrayList(KEY_ITEMS, BundleHelper.toStringArrayList(items)); args.putBooleanArray(KEY_CHECKED_ITEMS, checkedItems); args.putInt(KEY_POSITIVE_STRING_ID, positiveStringId); fragment.setArguments(args); return fragment; }
From source file:dev.drsoran.moloko.fragments.dialogs.ChooseTagsDialogFragment.java
public final static void show(FragmentActivity activity, Collection<String> tags) { final Bundle config = new Bundle(2); String[] tagsArray = new String[tags.size()]; tagsArray = tags.toArray(tagsArray); config.putStringArray(Config.TAG_STRINGS, tagsArray); config.putBooleanArray(Config.SELECTION_STATE, new boolean[tagsArray.length]); show(activity, config);// ww w . j a v a 2s . c o m }
From source file:com.facebook.LegacyTokenCacheTest.java
private static void putBooleanArray(String key, Bundle bundle) { int length = random.nextInt(50); boolean[] array = new boolean[length]; for (int i = 0; i < length; i++) { array[i] = random.nextBoolean(); }//from w ww.jav a 2 s. co m bundle.putBooleanArray(key, array); }
From source file:com.frostwire.android.gui.dialogs.HandpickedTorrentDownloadDialog.java
public static HandpickedTorrentDownloadDialog newInstance(Context ctx, TorrentInfo tinfo, String magnetUri, long torrentFetcherDownloadTokenId) { ///*w w w. j a v a 2s . com*/ // ideas: - pre-selected file(s) to just check the one(s) // - passing a file path // - passing a byte[] to create the tinfo from. final HandpickedTorrentDownloadDialog dlg = new HandpickedTorrentDownloadDialog(); // this creates a bundle that gets passed to setArguments(). It's supposed to be ready // before the dialog is attached to the underlying activity, after we attach to it, then // we are able to use such Bundle to create our adapter. final TorrentFileEntryList torrentInfoList = getTorrentInfoList(tinfo.files()); boolean[] allChecked = new boolean[torrentInfoList.list.size()]; for (int i = 0; i < allChecked.length; i++) { allChecked[i] = true; } dlg.prepareArguments(R.drawable.download_icon, tinfo.name(), ctx.getString(R.string.pick_the_files_you_want_to_download_from_this_torrent), JsonUtils.toJson(torrentInfoList), SelectionMode.MULTIPLE_SELECTION); final Bundle arguments = dlg.getArguments(); arguments.putByteArray(BUNDLE_KEY_TORRENT_INFO_DATA, tinfo.bencode()); arguments.putString(BUNDLE_KEY_MAGNET_URI, magnetUri); arguments.putLong(BUNDLE_KEY_TORRENT_FETCHER_DOWNLOAD_TOKEN_ID, torrentFetcherDownloadTokenId); arguments.putBooleanArray(BUNDLE_KEY_CHECKED_OFFSETS, allChecked); return dlg; }
From source file:r2b.apps.view.base.BaseDialog.java
/** * Set dialog style and functionality./* w w w . j a va 2 s. co m*/ * * @param iconRes 0 disabled * @param title null disabled * @param text null disabled * @param isCancelable By default true * @param positiveButonTextRes 0 disabled * @param negativeButonTextRes 0 disabled * @param multiChoiceListArrayRes 0 disabled * @param multiChoiceDefaultSelected null no selected * @return BaseDialog */ public static BaseDialog newInstance(int iconRes, String title, String text, boolean isCancelable, int positiveButonTextRes, int negativeButonTextRes, int multiChoiceListArrayRes, boolean[] multiChoiceDefaultSelected) { BaseDialog f = new BaseDialog(); Bundle args = new Bundle(); args.putInt(ICON_RES_KEY, iconRes); args.putString(TITLE_KEY, title); args.putString(TEXT_KEY, text); args.putBoolean(IS_CANCELABLE_KEY, isCancelable); args.putInt(POSITIVE_BUTTON_TEXT_RES, positiveButonTextRes); args.putInt(NEGATIVE_BUTTON_TEXT_RES, negativeButonTextRes); args.putInt(MULTI_CHOICE_LIST_ARRAY_RES, multiChoiceListArrayRes); args.putBooleanArray(MULTI_CHOICE_DEFAULT_SELECTED, multiChoiceDefaultSelected); f.setArguments(args); return f; }
From source file:org.proninyaroslav.libretorrent.fragments.DetailTorrentPiecesFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putBooleanArray(TAG_PIECES, pieces); outState.putInt(TAG_ALL_PIECES_COUNT, allPiecesCount); outState.putInt(TAG_PIECE_SIZE, pieceSize); outState.putInt(TAG_DOWNLOADED_PIECES, downloadedPieces); super.onSaveInstanceState(outState); }
From source file:eu.trentorise.smartcampus.eb.fragments.experience.AssignCollectionFragment.java
@Override public void onSaveInstanceState(Bundle out) { super.onSaveInstanceState(out); out.putBooleanArray("selected", selected == null ? new boolean[0] : selected); out.putStringArrayList("selectedIds", selectedIds == null ? new ArrayList<String>() : new ArrayList<String>(selectedIds)); out.putStringArray("items", items); }
From source file:net.reichholf.dreamdroid.fragment.dialogs.MultiChoiceDialog.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putString("WORKAROUND_FOR_BUG_19917_KEY", "WORKAROUND_FOR_BUG_19917_VALUE"); outState.putBooleanArray("checkedItems", mCheckedItems); super.onSaveInstanceState(outState); }