List of usage examples for android.support.v4.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:de.tobiasbielefeld.solitaire.ui.GameManager.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { DialogFragment restartDialog = new RestartDialog(); restartDialog.show(getSupportFragmentManager(), "restartDialog"); return true; }/*from w w w . j a v a 2 s .c om*/ return super.onKeyDown(keyCode, event); }
From source file:com.primalpond.hunt.TheHunt.java
/** Pop up a dialog to choose a prey from a predefined list of preys * @see com.primalpond.hunt.PreyChangeDialog#PreyChangeDialog() * @param view// w w w . ja va 2 s . c o m */ public void showPreyChangeDialog(View view) { DialogFragment newFragment = new PreyChangeDialog(); newFragment.show(getSupportFragmentManager(), "preyChangeDialog"); }
From source file:com.wordpress.ebc81.rtl_ais_android.DeviceOpenActivity.java
/** * * @param id//from w w w . java 2s . co m * @param args */ public void showDialog(final DialogManager.dialogs id, final String... args) { final FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); final Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. final DialogFragment newFragment = DialogManager.invokeDialog(id, args); try { newFragment.show(ft, "dialog"); } catch (Throwable t) { t.printStackTrace(); } ; }
From source file:com.qubling.sidekick.ui.module.ModuleSearchActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // case R.id.menu_sign_in_out: // AuthenticationHelper auth = new AuthenticationHelper(this); // Map<String, AuthenticatorDescription> authenticatorMap = auth.getAuthenticatorMap(); // List<Account> accounts = auth.getAccounts(); // // if (accounts.size() == 0) { // AlertDialog.Builder builder = new AlertDialog.Builder(this); // // builder.setTitle(R.string.error_no_accounts_to_pick_title); // builder.setIcon(android.R.drawable.ic_dialog_alert); // builder.setMessage(R.string.error_no_accounts_to_pick); // builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { // // @Override // public void onClick(DialogInterface dialog, int which) { // dialog.dismiss(); // } // }); // builder.show(); // } // else { // AlertDialog.Builder builder = new AlertDialog.Builder(this); // // List<Map<String, Object>> accountList = new ArrayList<Map<String,Object>>(accounts.size()); // for (Account account : accounts) { // Map<String, Object> accountMap = new HashMap<String, Object>(2); // AuthenticatorDescription authDesc = authenticatorMap.get(account.type); // String authName = account.type; // Resources authRes = null; // try { // authRes = getPackageManager().getResourcesForApplication(authDesc.packageName); // authName = authRes.getString(authDesc.labelId); // } // catch (NameNotFoundException e) { // Log.e("ModuleSearchActivity", "Could not find label for " + account.type); // } // // accountMap.put("label", account.name + " (" + authName + ")"); // if (authRes != null) { // accountMap.put("icon", new Pair<Resources, Integer>(authRes, authDesc.iconId)); // } // // accountList.add(accountMap); // } // // String[] from = new String[] { "label", "icon" }; // int[] to = new int[] { R.id.account_name, R.id.account_type_icon }; // // SimpleAdapter accountAdapter = new SimpleAdapter(this, accountList, R.layout.account_list_item, from, to); // accountAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { // // @Override // public boolean setViewValue(View view, Object data, String textRepresentation) { // if (view instanceof ImageView && data instanceof Pair<?, ?>) { // ImageView image = (ImageView) view; // Pair<?, ?> pair = (Pair<?, ?>) data; // // try { // Resources accountResources = (Resources) pair.first; // Integer iconId = (Integer) pair.second; // Drawable accountIcon = accountResources.getDrawable(iconId); // image.setImageDrawable(accountIcon); // } // // // This will NEVER happen! ... yeah right ... // catch (ClassCastException e) { // return false; // } // // return true; // } // // return false; // } // }); // // builder.setTitle(R.string.dialog_select_account); // builder.setAdapter(accountAdapter, null); // builder.show(); // } // return true; case R.id.menu_about: DialogFragment dialog = new AboutDialogFragment(); dialog.show(getSupportFragmentManager(), "about"); return true; default:// ww w . j a v a 2s .c o m return super.onOptionsItemSelected(item); } }
From source file:com.zion.htf.ui.fragment.ArtistDetailsFragment.java
/** * Displays a dialog to configure a new reminder for the current set *//* w w w .ja v a 2 s .co m*/ private void showAddAlarmDialog() { Bundle args = new Bundle(); args.putInt("set_id", this.setId); DialogFragment newFragment = TimeToPickerFragment.newInstance(args); newFragment.setTargetFragment(this, 0); newFragment.show(this.getActivity().getSupportFragmentManager(), "timeToPicker"); }
From source file:com.businessappstation.superstarmmjdispensaries.MapsFragment.java
@Override public void onInfoWindowClick(Marker marker) { //create Dialog, that proposes to "call", "go to webpage", "drop a message" to email //perform nullcheck String dispID = getIdFromValue(visibleMarkers, marker).toString(); HashMap<String, String> markerHashMap = mDispensariesList.get(Integer.parseInt(dispID) - 1); Bundle args = new Bundle(); args.putString("name", markerHashMap.get("name")); args.putString("email", markerHashMap.get("email")); args.putString("url", markerHashMap.get("url")); args.putString("phone", markerHashMap.get("phone")); DialogFragment dialogFragment = AlertDialogFragment.newInstance(args); dialogFragment.show(getFragmentManager(), "dialog");//?? }
From source file:com.zion.htf.ui.fragment.ArtistDetailsFragment.java
/** * Displays a dialog to edit a reminder for the current set *///from ww w . ja v a 2s . c o m private void showEditAlarmDialog() { Bundle args = new Bundle(); args.putInt("set_id", this.setId); args.putInt("alarm_id", this.alarm.getId()); args.putBoolean("edit_mode", true); DialogFragment newFragment = TimeToPickerFragment.newInstance(args); newFragment.setTargetFragment(this, 0); newFragment.show(this.getActivity().getSupportFragmentManager(), "timeToPicker"); }
From source file:com.google.android.gms.samples.plus.ShareActivity.java
@Override public void onClick(View view) { switch (view.getId()) { case R.id.share_button: final int errorCode = GooglePlusUtil.checkGooglePlusApp(this); if (errorCode == GooglePlusUtil.SUCCESS) { // Create an ACTION_SEND intent to share to Google+ with attribution. // Include a deep link in the intent to a resource in your app. // When the user clicks on the deep link, ParseDeepLinkActivity will // immediately route to that resource. Uri thumbnail = Uri.parse(getString(R.string.plus_deep_link_metadata_thumbnail_url)); Intent shareIntent = PlusShare.Builder.from(this).setText(mEditShareText.getText().toString()) .setType("text/plain") .setContent(ShareActivity.TAG, getString(R.string.plus_deep_link_metadata_title), getString(R.string.plus_deep_link_metadata_description), thumbnail) .getIntent();/*w w w .j ava 2 s.c om*/ startActivity(shareIntent); } else { // Prompt the user to install the Google+ app. DialogFragment fragment = new GooglePlusErrorDialogFragment(); Bundle args = new Bundle(); args.putInt(GooglePlusErrorDialogFragment.ARG_ERROR_CODE, errorCode); args.putInt(GooglePlusErrorDialogFragment.ARG_REQUEST_CODE, REQUEST_CODE_RESOLVE_GOOGLE_PLUS_ERROR); fragment.setArguments(args); fragment.show(getSupportFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT); } break; } }
From source file:com.fa.mastodon.fragment.SFragment.java
protected void viewMedia(String url, Status.MediaAttachment.Type type) { switch (type) { case IMAGE: { DialogFragment newFragment = ViewMediaFragment.newInstance(url); FragmentTransaction ft = getFragmentManager().beginTransaction(); newFragment.show(ft, "view_media"); break;/*ww w. ja v a 2 s . co m*/ } case GIFV: case VIDEO: { Intent intent = new Intent(getContext(), ViewVideoActivity.class); intent.putExtra("url", url); startActivity(intent); break; } case UNKNOWN: { /* Intentionally do nothing. This case is here is to handle when new attachment * types are added to the API before code is added here to handle them. So, the * best fallback is to just show the preview and ignore requests to view them. */ break; } } }
From source file:com.twolinessoftware.smarterlist.activity.BaseActivity.java
public void showDialogFragment(DialogFragment fragment) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev);// ww w .j ava2 s.c o m } fragment.show(ft, "dialog"); }