Java Code Examples for androidx.fragment.app.DialogFragment#setArguments()
The following examples show how to use
androidx.fragment.app.DialogFragment#setArguments() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArticleTabFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 6 votes |
private void createGotoDialog() { Bundle args = new Bundle(); args.putInt("page", mPagerAdapter.getCount()); args.putInt("floor", mReplyCount); DialogFragment df = new GotoDialogFragment(); df.setArguments(args); df.setTargetFragment(this, ActivityUtils.REQUEST_CODE_JUMP_PAGE); FragmentManager fm = getActivity().getSupportFragmentManager(); Fragment prev = fm.findFragmentByTag(GOTO_TAG); if (prev != null) { fm.beginTransaction().remove(prev).commit(); } df.show(fm, GOTO_TAG); }
Example 2
Source File: ConfigEditorFragment.java From InviZible with GNU General Public License v3.0 | 6 votes |
@Override public void onStop() { super.onStop(); String input = etConfigEditor.getText().toString(); if (input.isEmpty()) { return; } if (!input.equals(savedText) && getFragmentManager() != null) { DialogFragment dialogFragment = DialogSaveConfigChanges.newInstance(); Bundle bundle = new Bundle(); bundle.putString("moduleName", moduleName); bundle.putString("filePath", filePath); bundle.putString("fileText", input); dialogFragment.setArguments(bundle); dialogFragment.show(getFragmentManager(), "DialogSaveConfigChanges"); } }
Example 3
Source File: ActivityUtils.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 6 votes |
public static void startSearchDialog(AppCompatActivity activity, Bundle bundle) { if (UserManagerImpl.getInstance().getActiveUser() == null) { startLoginActivity(activity); return; } DialogFragment df = new SearchDialogFragment(); df.setArguments(bundle); final String dialogTag = SearchDialogFragment.class.getSimpleName(); FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(dialogTag); if (prev != null) { ft.remove(prev); } try { df.show(ft, dialogTag); } catch (Exception e) { } }
Example 4
Source File: ActivityUtils.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
private void noticebar(String title, String content, Context c) { if (c == null) return; NLog.d(TAG, "saying dialog"); Bundle b = new Bundle(); b.putString("title", title); b.putString("content", content); synchronized (lock) { try { DialogFragment df = new SayingDialogFragmentWithProgressBar(); df.setArguments(b); FragmentActivity fa = (FragmentActivity) c; FragmentManager fm = fa.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(dialogTag); if (prev != null) { ft.remove(prev); } ft.commit(); df.show(fm, dialogTag); this.df = df; } catch (Exception e) { NLog.e(this.getClass().getSimpleName(), NLog.getStackTraceString(e)); } } }
Example 5
Source File: BaseDialogFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
public static void show(FragmentManager fm, Bundle args, Class<?> target) { try { DialogFragment df = (DialogFragment) target.newInstance(); df.setArguments(args); df.show(fm, target.getSimpleName()); } catch (IllegalAccessException | java.lang.InstantiationException | IllegalStateException e) { e.printStackTrace(); } }
Example 6
Source File: InstallAppDialogFragment.java From java-android-developertools with Apache License 2.0 | 5 votes |
public static DialogFragment newInstance(String title, String message, String packageName) { DialogFragment dialogFragment = new InstallAppDialogFragment(); Bundle bundle = new Bundle(); bundle.putString("title", title); bundle.putString("message", message); bundle.putString("packageName", packageName); dialogFragment.setArguments(bundle); return dialogFragment; }
Example 7
Source File: UARTNewConfigurationDialogFragment.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static DialogFragment getInstance(final String name, final boolean duplicate) { final DialogFragment dialog = new UARTNewConfigurationDialogFragment(); final Bundle args = new Bundle(); args.putString(NAME, name); args.putBoolean(DUPLICATE, duplicate); dialog.setArguments(args); return dialog; }
Example 8
Source File: ActivityUtils.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
private void notice(String title, String content, Context c) { if (c == null) return; NLog.d(TAG, "saying dialog"); Bundle b = new Bundle(); b.putString("title", title); b.putString("content", content); synchronized (lock) { try { DialogFragment df = new SayingDialogFragment(); df.setArguments(b); FragmentActivity fa = (FragmentActivity) c; FragmentManager fm = fa.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(dialogTag); if (prev != null) { ft.remove(prev); } ft.commit(); df.show(fm, dialogTag); this.df = df; } catch (Exception e) { NLog.e(this.getClass().getSimpleName(), NLog.getStackTraceString(e)); } } }
Example 9
Source File: AccountSwitcherDialog.java From nextcloud-notes with GNU General Public License v3.0 | 5 votes |
public static DialogFragment newInstance(long currentAccountId) { DialogFragment dialog = new AccountSwitcherDialog(); Bundle args = new Bundle(); args.putLong(KEY_CURRENT_ACCOUNT_ID, currentAccountId); dialog.setArguments(args); return dialog; }
Example 10
Source File: NoteEditActivity.java From Notepad with Apache License 2.0 | 5 votes |
@Override public void showDeleteDialog() { Bundle bundle = new Bundle(); bundle.putInt("dialog_title", R.string.dialog_delete_button_title); DialogFragment deleteFragment = new DeleteDialogFragment(); deleteFragment.setArguments(bundle); deleteFragment.show(getSupportFragmentManager(), "delete"); }
Example 11
Source File: ExceptionDialogFragment.java From nextcloud-notes with GNU General Public License v3.0 | 5 votes |
public static DialogFragment newInstance(ArrayList<Throwable> exceptions) { final Bundle args = new Bundle(); args.putSerializable(KEY_THROWABLES, exceptions); final DialogFragment fragment = new ExceptionDialogFragment(); fragment.setArguments(args); return fragment; }
Example 12
Source File: CustomNotificationsDialogFragment.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
public static DialogFragment create(@NonNull GroupId groupId) { DialogFragment fragment = new CustomNotificationsDialogFragment(); Bundle args = new Bundle(); args.putString(ARG_GROUP_ID, groupId.toString()); fragment.setArguments(args); return fragment; }
Example 13
Source File: MainActivity.java From Notepad with Apache License 2.0 | 5 votes |
private void showDeleteDialog(boolean clearFilesToDelete) { if(clearFilesToDelete) filesToDelete = null; Bundle bundle = new Bundle(); bundle.putInt("dialog_title", filesToDelete == null || filesToDelete.length == 1 ? R.string.dialog_delete_button_title : R.string.dialog_delete_button_title_plural); DialogFragment deleteFragment = new DeleteDialogFragment(); deleteFragment.setArguments(bundle); deleteFragment.show(getSupportFragmentManager(), "delete"); }
Example 14
Source File: HelpDialogFragment.java From mcumgr-android with Apache License 2.0 | 5 votes |
@NonNull public static DialogFragment getInstance(@StringRes final int titleResId, @StringRes final int messageResId) { final DialogFragment fragment = new HelpDialogFragment(); final Bundle args = new Bundle(); args.putInt(ARG_TITLE_RES_ID, titleResId); args.putInt(ARG_MESSAGE_RES_ID, messageResId); fragment.setArguments(args); return fragment; }
Example 15
Source File: HostsActivity.java From MHViewer with Apache License 2.0 | 5 votes |
@Override public boolean onItemClick(EasyRecyclerView easyRecyclerView, View view, int position, long id) { Pair<String, String> pair = data.get(position); Bundle args = new Bundle(); args.putString(KEY_HOST, pair.first); args.putString(KEY_IP, pair.second); DialogFragment fragment = new EditHostDialogFragment(); fragment.setArguments(args); fragment.show(getSupportFragmentManager(), DIALOG_TAG_EDIT_HOST); return true; }
Example 16
Source File: NoteEditActivity.java From Notepad with Apache License 2.0 | 5 votes |
@Override public void showBackButtonDialog(String filename) { Bundle bundle = new Bundle(); bundle.putString("filename", filename); DialogFragment backFragment = new BackButtonDialogFragment(); backFragment.setArguments(bundle); backFragment.show(getSupportFragmentManager(), "back"); }
Example 17
Source File: ReactionsBottomSheetDialogFragment.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
public static DialogFragment create(long messageId, boolean isMms) { Bundle args = new Bundle(); DialogFragment fragment = new ReactionsBottomSheetDialogFragment(); args.putLong(ARGS_MESSAGE_ID, messageId); args.putBoolean(ARGS_IS_MMS, isMms); fragment.setArguments(args); return fragment; }
Example 18
Source File: ReactWithAnyEmojiBottomSheetDialogFragment.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
public static DialogFragment createForMessageRecord(@NonNull MessageRecord messageRecord) { DialogFragment fragment = new ReactWithAnyEmojiBottomSheetDialogFragment(); Bundle args = new Bundle(); args.putLong(ARG_MESSAGE_ID, messageRecord.getId()); args.putBoolean(ARG_IS_MMS, messageRecord.isMms()); fragment.setArguments(args); return fragment; }
Example 19
Source File: AllTasksListFragment.java From ActivityLauncher with ISC License | 4 votes |
@Override public boolean onContextItemSelected(MenuItem item) { ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo(); ExpandableListView list = getView().findViewById(R.id.expandableListView1); switch (ExpandableListView.getPackedPositionType(info.packedPosition)) { case ExpandableListView.PACKED_POSITION_TYPE_CHILD: MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition)); switch (item.getItemId()) { case 0: LauncherIconCreator.createLauncherIcon(getActivity(), activity); break; case 1: LauncherIconCreator.launchActivity(getActivity(), activity.component_name); break; case 2: DialogFragment dialog = new ShortcutEditDialogFragment(); Bundle args = new Bundle(); args.putParcelable("activity", activity.component_name); dialog.setArguments(args); dialog.show(getFragmentManager(), "ShortcutEditor"); break; } break; case ExpandableListView.PACKED_POSITION_TYPE_GROUP: MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition)); switch (item.getItemId()) { case 0: boolean success = LauncherIconCreator.createLauncherIcon(getActivity(), pack); Toast.makeText(getActivity(), getString(R.string.error_no_default_activity), Toast.LENGTH_LONG).show(); break; case 1: PackageManager pm = getActivity().getPackageManager(); Intent intent = pm.getLaunchIntentForPackage(pack.package_name); if (intent != null) { Toast.makeText(getActivity(), String.format(getText(R.string.starting_application).toString(), pack.name), Toast.LENGTH_LONG).show(); getActivity().startActivity(intent); } else { Toast.makeText(getActivity(), getString(R.string.error_no_default_activity), Toast.LENGTH_LONG).show(); } break; } } return super.onContextItemSelected(item); }
Example 20
Source File: CalleeMustAcceptMessageRequestDialogFragment.java From mollyim-android with GNU General Public License v3.0 | 3 votes |
public static DialogFragment create(@NonNull RecipientId recipientId) { DialogFragment fragment = new CalleeMustAcceptMessageRequestDialogFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_RECIPIENT_ID, recipientId); fragment.setArguments(args); return fragment; }