List of usage examples for android.support.v4.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:com.remdo.app.MainActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (v.getId() == R.id.deviceList) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle(devices[info.position]); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.context_device_config, menu); }/*from w w w .j a v a 2 s.co m*/ if (v.getId() == R.id.tv_geo_footer) { DialogFragment newdialog = new ServiceConfigFragment(); Bundle args = new Bundle(); args.putInt("service", R.id.tv_geo_footer); args.putInt("minutes", dm.getServcieMinutes("Geo")); newdialog.setArguments(args); newdialog.show(getSupportFragmentManager(), null); } if (v.getId() == R.id.tv_alerts_footer) { DialogFragment newdialog = new ServiceConfigFragment(); Bundle args = new Bundle(); args.putInt("service", R.id.tv_alerts_footer); args.putInt("minutes", dm.getServcieMinutes("Alerts")); newdialog.setArguments(args); newdialog.show(getSupportFragmentManager(), null); } }
From source file:com.google.plus.samples.photohunt.PlusClientFragment.java
private void showErrorDialog(DialogFragment errorDialog) { DialogFragment oldErrorDialog = (DialogFragment) getFragmentManager().findFragmentByTag(TAG_ERROR_DIALOG); if (oldErrorDialog != null) { oldErrorDialog.dismiss();//from www .j a v a2s. c o m } hideProgressDialog(); errorDialog.show(getFragmentManager(), TAG_ERROR_DIALOG); }
From source file:de.vanita5.twittnuker.fragment.support.UserListFragment.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { final AsyncTwitterWrapper twitter = getTwitterWrapper(); final ParcelableUserList userList = mUserList; if (twitter == null || userList == null) return false; switch (item.getItemId()) { case MENU_ADD: { if (userList.user_id != userList.account_id) return false; final Intent intent = new Intent(INTENT_ACTION_SELECT_USER); intent.setClass(getActivity(), UserListSelectorActivity.class); intent.putExtra(EXTRA_ACCOUNT_ID, userList.account_id); startActivityForResult(intent, REQUEST_SELECT_USER); break;/*from w ww. j a va 2s. c o m*/ } case MENU_DELETE: { if (userList.user_id != userList.account_id) return false; DestroyUserListDialogFragment.show(getFragmentManager(), userList); break; } case MENU_EDIT: { final Bundle args = new Bundle(); args.putLong(EXTRA_ACCOUNT_ID, userList.account_id); args.putString(EXTRA_LIST_NAME, userList.name); args.putString(EXTRA_DESCRIPTION, userList.description); args.putBoolean(EXTRA_IS_PUBLIC, userList.is_public); args.putLong(EXTRA_LIST_ID, userList.id); final DialogFragment f = new EditUserListDialogFragment(); f.setArguments(args); f.show(getFragmentManager(), "edit_user_list_details"); return true; } case MENU_FOLLOW: { if (userList.is_following) { DestroyUserListSubscriptionDialogFragment.show(getFragmentManager(), userList); } else { twitter.createUserListSubscriptionAsync(userList.account_id, userList.id); } return true; } default: { if (item.getIntent() != null) { try { startActivity(item.getIntent()); } catch (final ActivityNotFoundException e) { if (Utils.isDebugBuild()) Log.w(LOGTAG, e); return false; } } break; } } return true; }
From source file:com.abcvoipsip.ui.SipHome.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case ACCOUNTS_MENU: startActivity(new Intent(this, AccountsEditList.class)); return true; case PARAMS_MENU: startActivity(new Intent(this, MainPrefs.class)); return true; case CLOSE_MENU: Log.d(THIS_FILE, "CLOSE"); if (prefProviderWrapper.isValidConnectionForIncoming()) { // Alert user that we will disable for all incoming calls as // he want to quit new AlertDialog.Builder(this).setTitle(R.string.warning) .setMessage(getString(R.string.disconnect_and_incoming_explaination)) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // prefWrapper.disableAllForIncoming(); prefProviderWrapper.setPreferenceBooleanValue(PreferencesWrapper.HAS_BEEN_QUIT, true); disconnectAndQuit(); }/*from ww w . j a va 2 s. c o m*/ }).setNegativeButton(R.string.cancel, null).show(); } else { ArrayList<String> networks = prefProviderWrapper.getAllIncomingNetworks(); if (networks.size() > 0) { String msg = getString(R.string.disconnect_and_will_restart, TextUtils.join(", ", networks)); Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); } disconnectAndQuit(); } return true; case HELP_MENU: // Create the fragment and show it as a dialog. DialogFragment newFragment = Help.newInstance(); newFragment.show(getSupportFragmentManager(), "dialog"); return true; case DISTRIB_ACCOUNT_SIGNUP_MENU: // Open the signup page Intent itt = new Intent(Intent.ACTION_VIEW); itt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); itt.setData(Uri.parse("http://m.abc-voip.com/#page2")); startActivity(itt); return true; case DISTRIB_ACCOUNT_MENU: WizardInfo distribWizard = CustomDistribution.getCustomDistributionWizard(); Cursor c = getContentResolver().query(SipProfile.ACCOUNT_URI, new String[] { SipProfile.FIELD_ID }, SipProfile.FIELD_WIZARD + "=?", new String[] { distribWizard.id }, null); Intent it = new Intent(this, BasePrefsWizard.class); it.putExtra(SipProfile.FIELD_WIZARD, distribWizard.id); Long accountId = null; if (c != null && c.getCount() > 0) { try { c.moveToFirst(); accountId = c.getLong(c.getColumnIndex(SipProfile.FIELD_ID)); } catch (Exception e) { Log.e(THIS_FILE, "Error while getting wizard", e); } finally { c.close(); } } if (accountId != null) { it.putExtra(SipProfile.FIELD_ID, accountId); } startActivityForResult(it, REQUEST_EDIT_DISTRIBUTION_ACCOUNT); return true; default: break; } return super.onOptionsItemSelected(item); }
From source file:eu.trentorise.smartcampus.eb.fragments.experience.EditExpFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: getActivity().onBackPressed();/*from w ww. ja va 2 s.c o m*/ break; case R.id.expmenu_done: case R.id.expmenu_save: exp.setTitle(mTitleSwitch.getValue()); exp.setDescription(mDescrSwitch.getValue()); if (validate(exp)) { new SaveTask().execute(); } break; case R.id.expmenu_attach_audio: onCaptureOption(new String[] { CATCH_TYPES.AUDIO.toString() }, null); break; case R.id.expmenu_attach_camera_photo: onCaptureOption(new String[] { CATCH_TYPES.IMAGE_CAMERA.toString() }, null); break; case R.id.expmenu_attach_camera_video: onCaptureOption(new String[] { CATCH_TYPES.VIDEO_CAMERA.toString() }, null); break; case R.id.expmenu_attach_gallery_photo: onCaptureOption(new String[] { CATCH_TYPES.IMAGE_GALLERY.toString() }, null); break; case R.id.expmenu_attach_gallery_video: onCaptureOption(new String[] { CATCH_TYPES.VIDEO_GALLERY.toString() }, null); break; case R.id.expmenu_attach_qrcode: onCaptureOption(new String[] { CATCH_TYPES.QRCODE.toString() }, null); break; case R.id.expmenu_attach_text: DialogFragment textFragment = new EditNoteFragment(); textFragment.setArguments(EditNoteFragment.prepare("", exp.getContents().size())); textFragment.show(getActivity().getSupportFragmentManager(), "exp_content_note"); break; case R.id.expmenu_remove: DialogFragment newFragment = new DeleteExperienceFragment(); newFragment.setArguments(DeleteExperienceFragment.prepare(exp.getId())); newFragment.show(getActivity().getSupportFragmentManager(), "exp_delete"); break; case R.id.expmenu_assign_collection: DialogFragment assignFragment = new AssignCollectionFragment(); assignFragment.setArguments(AssignCollectionFragment.prepare(exp.getId(), exp.getCollectionIds())); assignFragment.show(getActivity().getSupportFragmentManager(), "exp_assign_colls"); break; case R.id.expmenu_share: ShareEntityObject obj = new ShareEntityObject(exp.getEntityId(), exp.getTitle(), Constants.ENTITY_TYPE_EXPERIENCE); SharingHelper.share(getActivity(), obj); break; case R.id.expmenu_map: case R.id.expmenu_export: Toast.makeText(getActivity(), R.string.not_implemented, Toast.LENGTH_SHORT).show(); // TODO break; default: break; } return super.onOptionsItemSelected(item); }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog telling the user what to do before the QR code scanner is * displayed, and starts the QR code activity. * /*from ww w .j a va 2s . c o m*/ * @param activity * the caller activity */ public static void pairInboundInstructions(final FragmentActivity activity) { DialogFragment dialog = new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = getBuilder(activity); View layout = View.inflate(getContext(), R.layout.pair_inbound_instructions, null); builder.setView(layout); ((TextView) layout.findViewById(R.id.instructions)) .setText(getResources().getString(R.string.new_inbound_instructions)); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE", "QR_CODE_MODE"); getActivity().startActivityForResult(intent, MainActivity.QR_CODE_SCANNED); } }); return builder.create(); } }; dialog.show(activity.getSupportFragmentManager(), "instruction"); }
From source file:it.imwatch.nfclottery.MainActivity.java
/** * Shows a dialog containing a list of everybody that has won so far. *//* ww w . j a v a 2s.c o m*/ private void showWinners() { DialogFragment newFragment = new WinnersListDialog(); newFragment.show(getSupportFragmentManager(), "winnersDialog"); }
From source file:com.anjalimacwan.MainActivity.java
private void checkForAndroidWear() { // Notepad Plugin for Android Wear sends intent with "plugin_install_complete" extra, // in order to verify that the main Notepad app is installed correctly if (getIntent().hasExtra("plugin_install_complete")) { if (getSupportFragmentManager().findFragmentByTag("WearPluginDialogFragmentAlt") == null) { DialogFragment wearDialog = new WearPluginDialogFragmentAlt(); wearDialog.show(getSupportFragmentManager(), "WearPluginDialogFragmentAlt"); }//from w ww . j a v a 2 s .c o m SharedPreferences pref = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.putBoolean("show_wear_dialog", false); editor.apply(); } else { boolean hasAndroidWear = false; @SuppressWarnings("unused") PackageInfo pInfo; try { pInfo = getPackageManager().getPackageInfo("com.google.android.wearable.app", 0); hasAndroidWear = true; } catch (PackageManager.NameNotFoundException e) { /* Gracefully fail */ } if (hasAndroidWear) { try { pInfo = getPackageManager().getPackageInfo("com.anjalimacwan.wear", 0); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(ComponentName .unflattenFromString("com.anjalimacwan.wear/com.anjalimacwan.wear.MobileMainActivity")); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } catch (PackageManager.NameNotFoundException e) { SharedPreferences pref = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE); if (pref.getBoolean("show_wear_dialog", true) && getSupportFragmentManager().findFragmentByTag("WearPluginDialogFragment") == null) { DialogFragment wearDialog = new WearPluginDialogFragment(); wearDialog.show(getSupportFragmentManager(), "WearPluginDialogFragment"); } } catch (ActivityNotFoundException e) { /* Gracefully fail */ } } } }
From source file:it.imwatch.nfclottery.MainActivity.java
/** * Shows a dialog that asks the user the confirmation to clear the * winners' status from the database.// w w w . jav a 2s . co m */ private void showClearWinnersConfirmation() { DialogFragment newFragment = new ClearWinnersDialog(); newFragment.show(getSupportFragmentManager(), "clearwinnersdialog"); }
From source file:it.imwatch.nfclottery.MainActivity.java
/** Shows the alert dialog asking the user the confirmation to delete all the contacts from DB */ private void showClearDbConfirmation() { DialogFragment newFragment = new ClearDBAlertDialog(); newFragment.show(getSupportFragmentManager(), "cleardialog"); }