List of usage examples for android.support.v4.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:com.bonsai.btcreceive.ViewTransactionActivity.java
protected DialogFragment showModalDialog(String title, String msg) { DialogFragment df = new MyDialogFragment(); Bundle args = new Bundle(); args.putString("title", title); args.putString("msg", msg); args.putBoolean("hasOK", false); df.setArguments(args);//from w w w . j av a 2 s.co m df.show(getSupportFragmentManager(), "note"); return df; }
From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.MyHealthHubGlassMainActivity.java
private void openSelectSensorType(Bundle extras, String sensorType, String[] names) { DialogFragment deviceDialog = new SelectDeviceDialogFragment(); extras.putInt("position", 0); extras.putBoolean("device", false); extras.putString("sensorType", sensorType); extras.putStringArray("names", names); deviceDialog.setArguments(extras);//w w w . ja va2s. c o m getFragmentManager().beginTransaction(); deviceDialog.show(getSupportFragmentManager().beginTransaction(), "deviceDialog"); }
From source file:com.m2dl.mini_projet.mini_projet_android.MainActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { Uri selectedImage = imageUri; getContentResolver().notifyChange(selectedImage, null); ContentResolver cr = getContentResolver(); try { myBitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage); myBitmap = BitmapUtil.resize(myBitmap); imageFilePath = imageUri.getPath(); ExifInterface exif = new ExifInterface(imageFilePath); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: myBitmap = BitmapUtil.rotateImage(myBitmap, 90); break; case ExifInterface.ORIENTATION_ROTATE_180: myBitmap = BitmapUtil.rotateImage(myBitmap, 180); break; }/*from ww w .jav a 2 s. c o m*/ String dialogTitle; String dialogMessage; if (!isGPSOn) { dialogTitle = "Golocalisation GPS..."; dialogMessage = "Veuillez activer votre GPS puis patienter pendant la golocalisation"; } else { dialogTitle = "Golocalisation GPS..."; dialogMessage = "Veuillez patienter pendant la golocalisation"; } final ProgressDialog progDialog = ProgressDialog.show(MainActivity.this, dialogTitle, dialogMessage, true); new Thread() { public void run() { try { while (coordLat.equals(0.0d) && coordLong.equals(0.0d)) ; FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); DialogFragment newFragment = PhotoDialogFragment.newInstance(myBitmap, coordLat, coordLong, imageFilePath); newFragment.show(ft, "dialog"); } catch (Exception e) { Log.e(TAG, e.getMessage()); } progDialog.dismiss(); } }.start(); } catch (Exception e) { Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT).show(); Log.e("Camera", e.toString()); } } } }
From source file:com.ohso.omgubuntu.BaseFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (BaseActivity.isSidebarActive()) ((BaseActivity) getActivity()).toggleSidebarFragment(); switch (item.getItemId()) { case R.id.activity_main_menu_refresh: setRefreshing();/*from ww w. ja v a 2s . c o m*/ return true; case R.id.activity_main_menu_read_all: DialogFragment fragment = new AlertDialogFragment(); fragment.setTargetFragment(this, 0); fragment.show(getSherlockActivity().getSupportFragmentManager(), "mark_as_read"); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.cerema.cloud2.files.FileOperationsHelper.java
public void sendDownloadedFile(OCFile file) { if (file != null) { String storagePath = file.getStoragePath(); String encodedStoragePath = WebdavUtils.encodePath(storagePath); Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); // set MimeType sendIntent.setType(file.getMimetype()); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + encodedStoragePath)); sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action // Show dialog, without the own app String[] packagesToExclude = new String[] { mFileActivity.getPackageName() }; DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude); chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); } else {// ww w . j a v a2s . c o m Log_OC.wtf(TAG, "Trying to send a NULL OCFile"); } }
From source file:com.snippet.app.ProgressDialogActivity.java
public void showDialogFragment(final DialogFragment dialogFragment) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag(DIALOG_TAG); if (prev != null) { ft.remove(prev);//from w w w. j a v a 2s. c o m } // Don't add to back stack. Adding to back stack makes popping up // removed fragment when DialogFragment crushed with IllegalStateException. //ft.addToBackStack(null); if (dialogFragment != null) { dialogFragment.show(ft, DIALOG_TAG); } }
From source file:mobisocial.musubi.ui.PhotoEditorActivity.java
void showDialog(DialogFragment dialog) { // DialogFragment.show() will take care of adding the fragment // in a transaction. We also want to remove any currently showing // dialog, so make our own transaction and take care of that here. FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev);/*from w w w . j a v a 2s . c om*/ } ft.addToBackStack(null); dialog.show(ft, "dialog"); }
From source file:com.notepadlite.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 ww w . j av 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) { } if (hasAndroidWear) { try { pInfo = getPackageManager().getPackageInfo("com.notepadlite.wear", 0); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(ComponentName .unflattenFromString("com.notepadlite.wear/com.notepadlite.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) { } } } }
From source file:com.owncloud.android.ui.helpers.FileOperationsHelper.java
public void sendDownloadedFile(OCFile file) { if (file != null) { Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); // set MimeType sendIntent.setType(file.getMimetype()); sendIntent.putExtra(Intent.EXTRA_STREAM, file.getExposedFileUri(mFileActivity)); sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action // Show dialog, without the own app String[] packagesToExclude = new String[] { mFileActivity.getPackageName() }; DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude); chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); } else {/*from w w w . ja v a2 s . c o m*/ Log_OC.e(TAG, "Trying to send a NULL OCFile"); } }
From source file:emu.project64.settings.BaseSettingsFragment.java
@Override public void onDisplayPreferenceDialog(Preference preference) { DialogFragment dialogFragment = null; if (preference instanceof SeekBarPreference) { dialogFragment = SeekBarPreferencePreferenceDialogFragmentCompat.newInstance(preference.getKey()); } else if (preference instanceof TwoLinesListPreference) { dialogFragment = TwoLinesListPreferenceDialogFragmentCompat.newInstance(preference.getKey()); } else {//ww w . j a v a 2 s . co m super.onDisplayPreferenceDialog(preference); } if (dialogFragment != null) { dialogFragment.setTargetFragment(this, 0); dialogFragment.show(getFragmentManager(), DIALOG_FRAGMENT_TAG); } }