Java Code Examples for androidx.fragment.app.DialogFragment#show()
The following examples show how to use
androidx.fragment.app.DialogFragment#show() .
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: 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 2
Source File: LicensesFragment.java From mimi-reader with Apache License 2.0 | 6 votes |
/** * Builds and displays a licenses fragment for you. Requires "/res/raw/licenses.html" and * "/res/layout/licenses_fragment.xml" to be present. * * @param fm A fragment manager instance used to display this LicensesFragment. */ public static void displayLicensesFragment(FragmentManager fm, @RawRes int htmlResToShow, String title) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. final DialogFragment newFragment; if (TextUtils.isEmpty(title)) { newFragment = LicensesFragment.newInstance(htmlResToShow); } else { newFragment = LicensesFragment.newInstance(htmlResToShow, title); } if (newFragment != null) { newFragment.show(ft, FRAGMENT_TAG); } }
Example 3
Source File: LoginActivity.java From tindroid with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); switch (id) { case R.id.action_settings: { showFragment(FRAGMENT_SETTINGS); return true; } case R.id.action_signup: { showFragment(FRAGMENT_SIGNUP); return true; } case R.id.action_about: DialogFragment about = new AboutDialogFragment(); about.show(getSupportFragmentManager(), "about"); return true; default: return super.onOptionsItemSelected(item); } }
Example 4
Source File: SettingsFragment.java From prayer-times-android with Apache License 2.0 | 6 votes |
@SuppressWarnings("RestrictedApi") @Override public void onDisplayPreferenceDialog(Preference preference) { if (preference instanceof NumberPickerPreference) { boolean handled = false; if (getCallbackFragment() instanceof OnPreferenceDisplayDialogCallback) { handled = ((OnPreferenceDisplayDialogCallback) getCallbackFragment()).onPreferenceDisplayDialog(this, preference); } if (!handled && getActivity() instanceof OnPreferenceDisplayDialogCallback) { handled = ((OnPreferenceDisplayDialogCallback) getActivity()).onPreferenceDisplayDialog(this, preference); } if (handled) { return; } if (getFragmentManager().findFragmentByTag("numberpicker") != null) { return; } DialogFragment f = NumberPickerPreference.NumberPickerPreferenceDialogFragmentCompat.newInstance(preference.getKey()); f.setTargetFragment(this, 0); f.show(getFragmentManager(), "numberpicker"); } else super.onDisplayPreferenceDialog(preference); }
Example 5
Source File: CorrectedPreferenceFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@Override public void onDisplayPreferenceDialog(Preference preference) { DialogFragment dialogFragment = null; if (preference instanceof ColorPickerPreference) { dialogFragment = ColorPickerPreferenceDialogFragmentCompat.newInstance(preference.getKey()); } else if (preference instanceof CustomDefaultPreference) { dialogFragment = CustomDefaultPreference.CustomDefaultPreferenceDialogFragmentCompat.newInstance(preference.getKey()); } if (dialogFragment != null) { dialogFragment.setTargetFragment(this, 0); dialogFragment.show(getFragmentManager(), "android.support.v7.preference.PreferenceFragment.DIALOG"); } else { super.onDisplayPreferenceDialog(preference); } }
Example 6
Source File: EipFragment.java From bitmask_android with GNU General Public License v3.0 | 5 votes |
public void showDonationReminderDialog() { try { FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( getActivity().getSupportFragmentManager()).removePreviousFragment( DonationReminderDialog.TAG); DialogFragment newFragment = new DonationReminderDialog(); newFragment.setCancelable(false); newFragment.show(fragmentTransaction, DonationReminderDialog.TAG); } catch (IllegalStateException | NullPointerException e) { e.printStackTrace(); } }
Example 7
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 8
Source File: DialogUtils.java From CommonUtils with Apache License 2.0 | 5 votes |
public static void showDialog(@Nullable FragmentActivity activity, @NonNull DialogFragment dialog, @Nullable String tag) { if (activity == null) return; FragmentManager manager = activity.getSupportFragmentManager(); try { dialog.show(manager, tag); } catch (IllegalStateException ex) { Log.e(TAG, "Failed showing dialog.", ex); // We can't do nothing } }
Example 9
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 10
Source File: HostsActivity.java From EhViewer 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 11
Source File: IconShapeFragment.java From candybar with Apache License 2.0 | 5 votes |
public static void showIconShapeChooser(@NonNull FragmentManager fm) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } try { DialogFragment dialog = IconShapeFragment.newInstance(); dialog.show(ft, TAG); } catch (IllegalArgumentException | IllegalStateException ignored) { } }
Example 12
Source File: BaseNoteFragment.java From nextcloud-notes with GNU General Public License v3.0 | 5 votes |
/** * Opens a dialog in order to chose a category */ public void showEditTitleDialog() { saveNote(null); final String fragmentId = "fragment_edit_title"; FragmentManager manager = requireActivity().getSupportFragmentManager(); Fragment frag = manager.findFragmentByTag(fragmentId); if (frag != null) { manager.beginTransaction().remove(frag).commit(); } DialogFragment editTitleFragment = EditTitleDialogFragment.newInstance(note.getTitle()); editTitleFragment.setTargetFragment(this, 0); editTitleFragment.show(manager, fragmentId); }
Example 13
Source File: PickersActivity.java From android-test with Apache License 2.0 | 5 votes |
private void showPickerUi(DialogFragment fragment, String tag) { if (null == fragment && TextUtils.isEmpty(tag)) { return; } fragment.show(getSupportFragmentManager(), tag); }
Example 14
Source File: CreditsFragment.java From candybar with Apache License 2.0 | 5 votes |
public static void showCreditsDialog(FragmentManager fm, int type) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } try { DialogFragment dialog = CreditsFragment.newInstance(type); dialog.show(ft, TAG); } catch (IllegalStateException | IllegalArgumentException ignored) { } }
Example 15
Source File: ViewUtils.java From SmartPack-Kernel-Manager with GNU General Public License v3.0 | 5 votes |
public static void showDialog(FragmentManager manager, DialogFragment fragment) { FragmentTransaction ft = manager.beginTransaction(); Fragment prev = manager.findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); fragment.show(ft, "dialog"); }
Example 16
Source File: DetailChannelActivity.java From TDTChannels-APP with MIT License | 4 votes |
private void loadVideo(String streamURL) { Toast.makeText(this, getString(R.string.channel_detail_reproducing_tv), Toast.LENGTH_SHORT).show(); DialogFragment newFragment = VideoDialogFragment.newInstance(streamURL); newFragment.show(getSupportFragmentManager(), "VideoDialog"); }
Example 17
Source File: MediaConsentUtils.java From edx-app-android with Apache License 2.0 | 4 votes |
private static void showDialog(FragmentActivity activity, DialogFragment dialogFragment, String tag) { dialogFragment.show(activity.getSupportFragmentManager(), tag); }
Example 18
Source File: CreatePoiFragment.java From AndroidApp with Mozilla Public License 2.0 | 4 votes |
public void featureSelectorDialog() { DialogFragment dialogFragment = PoiFeatureDialogFragment.newInstance(); dialogFragment.setTargetFragment(this, 1); dialogFragment.show(getActivity().getSupportFragmentManager(), "PoiFeatureDialogFragment"); }
Example 19
Source File: FragmentResultNavigator.java From aptoide-client-v8 with GNU General Public License v3.0 | 4 votes |
@Override public void navigateToDialogFragment(DialogFragment fragment) { final String tag = Integer.toString(fragmentManager.getBackStackEntryCount()); fragment.show(fragmentManager, tag); }
Example 20
Source File: CreatePoiFragment.java From AndroidApp with Mozilla Public License 2.0 | 4 votes |
public void showTimePickerDialog() { DialogFragment dialogFragment = new TimePickerFragment(); dialogFragment.setTargetFragment(this, 0); dialogFragment.show(getActivity().getSupportFragmentManager(), "timePicker"); }