List of usage examples for android.support.v4.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:com.anjalimacwan.MainActivity.java
private void showDeleteDialog(boolean clearFilesToDelete) { if (clearFilesToDelete) filesToDelete = null;//from ww w . j a va 2 s. c o m 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"); }
From source file:com.github.yuukis.businessmap.app.ContactsTaskFragment.java
private void showProgress() { String title = getString(R.string.title_geocoding); String message = getString(R.string.message_geocoding); int max = mGeocodingResultCache.size(); Bundle args = new Bundle(); args.putString(ProgressDialogFragment.TITLE, title); args.putString(ProgressDialogFragment.MESSAGE, message); args.putBoolean(ProgressDialogFragment.CANCELABLE, true); args.putInt(ProgressDialogFragment.MAX, max); final DialogFragment dialog = ProgressDialogFragment.newInstance(); dialog.setArguments(args);/*ww w . j a v a 2 s. c o m*/ if (getActivity() != null) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { dialog.show(getActivity().getSupportFragmentManager(), ProgressDialogFragment.TAG); } }); } }
From source file:it.imwatch.nfclottery.MainActivity.java
/** Shows a dialog to let the user to manually insert a contact into DB */ private void showManualInsertNewContactDialog() { DialogFragment newFragment = new InsertContactDialog(); newFragment.show(getSupportFragmentManager(), "insertdialog"); }
From source file:ar.rulosoft.mimanganu.PreferencesFragment.java
@Override public final void onDisplayPreferenceDialog(Preference preference) { DialogFragment fragment; if (preference instanceof PreferencesListDir) { fragment = PreferenceListDirFragment.newInstance(preference); fragment.setTargetFragment(this, 0); fragment.show(getFragmentManager(), "android.support.v7.preference.PreferenceFragment.DIALOG"); } else if (preference instanceof ColorListDialogPref) { fragment = ColorListDialogFragment.newInstance(preference); fragment.setTargetFragment(this, 0); fragment.show(getFragmentManager(), "android.support.v7.preference.PreferenceFragment.DIALOG"); } else//from ww w. j a v a 2 s . com super.onDisplayPreferenceDialog(preference); }
From source file:com.ubergeek42.WeechatAndroid.WeechatActivity.java
@Subscribe @WorkerThread/* ww w .j a v a 2 s . c om*/ @Cat public void onEvent(final ExceptionEvent event) { final Exception e = event.e; if ((e instanceof SSLPeerUnverifiedException) || (e instanceof SSLException && e.getCause() instanceof CertificateException && e.getCause().getCause() instanceof CertPathValidatorException)) { SSLHandler.Result r = SSLHandler.checkHostname(P.host, P.port); if (r.certificate == null) return; DialogFragment fragment = r.verified ? UntrustedCertificateDialog.newInstance(r.certificate) : InvalidHostnameDialog.newInstance(r.certificate); fragment.show(getSupportFragmentManager(), "ssl-error"); Weechat.runOnMainThread(this::disconnect); return; } String message = TextUtils.isEmpty(e.getMessage()) ? e.getClass().getSimpleName() : e.getMessage(); Weechat.showLongToast(R.string.error, message); }
From source file:com.cttapp.bby.mytlc.layer8apps.MyTlc.java
private void showChangeLog() { DialogFragment fragment; // Create a new instance of the fragmentDialog fragment = ChangelogDialog.newInstance(); // Show the dialog with the "progress" tag for later reference fragment.show(getSupportFragmentManager(), "changeLog"); }
From source file:com.cttapp.bby.mytlc.layer8apps.MyTlc.java
/************ * PURPOSE: Shows our fragment dialog that we use for * progress updates/* www . j a va2 s. c o m*/ * ARGUMENTS: null * RETURNS: void * AUTHOR: Devin Collins <agent14709@gmail.com> *************/ private void showProgress() { DialogFragment fragment; // Create a new instance of the fragmentDialog fragment = TLCProgressDialog.newInstance(); // Show the dialog with the "progress" tag for later reference fragment.show(getSupportFragmentManager(), "progress"); }
From source file:com.anjalimacwan.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // Set action bar elevation getSupportActionBar().setElevation(getResources().getDimensionPixelSize(R.dimen.action_bar_elevation)); }/* www. j ava 2 s . co m*/ // Show dialog if this is the user's first time running Notepad SharedPreferences prefMain = getPreferences(Context.MODE_PRIVATE); if (prefMain.getInt("first-run", 0) == 0) { // Show welcome dialog if (getSupportFragmentManager().findFragmentByTag("firstrunfragment") == null) { DialogFragment firstRun = new FirstRunDialogFragment(); firstRun.show(getSupportFragmentManager(), "firstrunfragment"); } } else { // Check to see if Android Wear app is installed, and offer to install the Notepad Plugin checkForAndroidWear(); // The following code is only present to support existing users of Notepad on Google Play // and can be removed if using this source code for a different app // Convert old preferences to new ones SharedPreferences pref = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE); if (prefMain.getInt("sort-by", -1) == 0) { SharedPreferences.Editor editor = pref.edit(); SharedPreferences.Editor editorMain = prefMain.edit(); editor.putString("sort_by", "date"); editorMain.putInt("sort-by", -1); editor.apply(); editorMain.apply(); } else if (prefMain.getInt("sort-by", -1) == 1) { SharedPreferences.Editor editor = pref.edit(); SharedPreferences.Editor editorMain = prefMain.edit(); editor.putString("sort_by", "name"); editorMain.putInt("sort-by", -1); editor.apply(); editorMain.apply(); } if (pref.getString("font_size", "null").equals("null")) { SharedPreferences.Editor editor = pref.edit(); editor.putString("font_size", "large"); editor.apply(); } // Rename any saved drafts from 1.3.x File oldDraft = new File(getFilesDir() + File.separator + "draft"); File newDraft = new File(getFilesDir() + File.separator + String.valueOf(System.currentTimeMillis())); if (oldDraft.exists()) oldDraft.renameTo(newDraft); } // Begin a new FragmentTransaction FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // This fragment shows NoteListFragment as a sidebar (only seen in tablet mode landscape) if (!(getSupportFragmentManager().findFragmentById(R.id.noteList) instanceof NoteListFragment)) transaction.replace(R.id.noteList, new NoteListFragment(), "NoteListFragment"); // This fragment shows NoteListFragment in the main screen area (only seen on phones and tablet mode portrait), // but only if it doesn't already contain NoteViewFragment or NoteEditFragment. // If NoteListFragment is already showing in the sidebar, use WelcomeFragment instead if (!((getSupportFragmentManager().findFragmentById(R.id.noteViewEdit) instanceof NoteEditFragment) || (getSupportFragmentManager().findFragmentById(R.id.noteViewEdit) instanceof NoteViewFragment))) { if ((getSupportFragmentManager().findFragmentById(R.id.noteViewEdit) == null && findViewById(R.id.layoutMain).getTag().equals("main-layout-large")) || ((getSupportFragmentManager() .findFragmentById(R.id.noteViewEdit) instanceof NoteListFragment) && findViewById(R.id.layoutMain).getTag().equals("main-layout-large"))) transaction.replace(R.id.noteViewEdit, new WelcomeFragment(), "NoteListFragment"); else if (findViewById(R.id.layoutMain).getTag().equals("main-layout-normal")) transaction.replace(R.id.noteViewEdit, new NoteListFragment(), "NoteListFragment"); } // Commit fragment transaction transaction.commit(); }
From source file:com.slushpupie.deskclock.DeskClock.java
/** Called when a menu item is selected */ @Override//www . j av a 2 s . c o m public boolean onOptionsItemSelected(MenuItem menuItem) { if (menuItem.getItemId() == R.id.menu_prefs) { Intent intent = new Intent().setClass(this, DeskClockPreferenceActivity.class); startActivityForResult(intent, 0); } if (menuItem.getItemId() == R.id.menu_changelog) { DialogFragment df = ChangelogDialog.newInstance(); df.show(getSupportFragmentManager(), "dialog"); } return true; }
From source file:com.playground.notification.app.activities.AppActivity.java
/** * Show {@link android.support.v4.app.DialogFragment}. * * @param _dlgFrg An instance of {@link android.support.v4.app.DialogFragment}. * @param _tagName Tag name for dialog, default is "dlg". To grantee that only one instance of {@link android.support.v4.app.DialogFragment} can been seen. *//* ww w . j a v a 2s .com*/ public void showDialogFragment(DialogFragment _dlgFrg, String _tagName) { try { if (_dlgFrg != null) { DialogFragment dialogFragment = _dlgFrg; FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); // Ensure that there's only one dialog to the user. Fragment prev = getSupportFragmentManager().findFragmentByTag("dlg"); if (prev != null) { ft.remove(prev); } try { if (TextUtils.isEmpty(_tagName)) { dialogFragment.show(ft, "dlg"); } else { dialogFragment.show(ft, _tagName); } } catch (Exception e) { } } } catch (Exception e) { } }