List of usage examples for android.support.v4.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:com.morlunk.mumbleclient.channel.ChannelMenu.java
@Override public boolean onMenuItemClick(MenuItem item) { boolean adding = false; switch (item.getItemId()) { case R.id.context_channel_join: mService.joinChannel(mChannel.getId()); break;//from w ww . j ava 2s .c o m case R.id.context_channel_add: adding = true; case R.id.context_channel_edit: ChannelEditFragment addFragment = new ChannelEditFragment(); Bundle args = new Bundle(); if (adding) args.putInt("parent", mChannel.getId()); else args.putInt("channel", mChannel.getId()); args.putBoolean("adding", adding); addFragment.setArguments(args); addFragment.show(mFragmentManager, "ChannelAdd"); break; case R.id.context_channel_remove: AlertDialog.Builder adb = new AlertDialog.Builder(mContext); adb.setTitle(R.string.confirm); adb.setMessage(R.string.confirm_delete_channel); adb.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mService.removeChannel(mChannel.getId()); } }); adb.setNegativeButton(android.R.string.cancel, null); adb.show(); break; case R.id.context_channel_view_description: Bundle commentArgs = new Bundle(); commentArgs.putInt("channel", mChannel.getId()); commentArgs.putString("comment", mChannel.getDescription()); commentArgs.putBoolean("editing", false); DialogFragment commentFragment = (DialogFragment) Fragment.instantiate(mContext, ChannelDescriptionFragment.class.getName(), commentArgs); commentFragment.show(mFragmentManager, ChannelDescriptionFragment.class.getName()); break; case R.id.context_channel_pin: long serverId = mService.getConnectedServer().getId(); boolean pinned = mDatabase.isChannelPinned(serverId, mChannel.getId()); if (!pinned) mDatabase.addPinnedChannel(serverId, mChannel.getId()); else mDatabase.removePinnedChannel(serverId, mChannel.getId()); break; case R.id.context_channel_link: { IChannel channel = mService.getSessionChannel(); if (!item.isChecked()) { mService.linkChannels(channel, mChannel); } else { mService.unlinkChannels(channel, mChannel); } break; } case R.id.context_channel_unlink_all: mService.unlinkAllChannels(mChannel); break; case R.id.context_channel_shout: { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(R.string.shout_configure); LinearLayout layout = new LinearLayout(mContext); layout.setOrientation(LinearLayout.VERTICAL); final CheckBox subchannelBox = new CheckBox(mContext); subchannelBox.setText(R.string.shout_include_subchannels); layout.addView(subchannelBox); final CheckBox linkedBox = new CheckBox(mContext); linkedBox.setText(R.string.shout_include_linked); layout.addView(linkedBox); builder.setView(layout); builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (mService == null || mService.getConnectionState() != JumbleService.ConnectionState.CONNECTED) return; // Unregister any existing voice target. if (mService.getVoiceTargetMode() == VoiceTargetMode.WHISPER) { mService.unregisterWhisperTarget(mService.getVoiceTargetId()); } WhisperTargetChannel channelTarget = new WhisperTargetChannel(mChannel, linkedBox.isChecked(), subchannelBox.isChecked(), null); byte id = mService.registerWhisperTarget(channelTarget); if (id > 0) { mService.setVoiceTargetId(id); } else { Toast.makeText(mContext, R.string.shout_failed, Toast.LENGTH_LONG).show(); } } }); builder.setNegativeButton(android.R.string.cancel, null); builder.show(); break; } default: return false; } return true; }
From source file:com.example.scheme.MyPalettesActivity.java
public void showNewPaletteDialog() { DialogFragment dialog = new NewPaletteDialogFragment(); dialog.show(getSupportFragmentManager(), "NewPaletteDialogFragment"); }
From source file:de.vanita5.twittnuker.activity.support.DataExportActivity.java
@Override public void onFilePicked(final File file) { if (file == null) { finish();//from w w w .j a v a2s . co m return; } final DialogFragment df = new DataExportImportTypeSelectorDialogFragment(); final Bundle args = new Bundle(); args.putString(EXTRA_PATH, file.getAbsolutePath()); args.putString(EXTRA_TITLE, getString(R.string.export_settings_type_dialog_title)); df.setArguments(args); df.show(getSupportFragmentManager(), "select_export_type"); }
From source file:de.damdi.fitness.activity.start_training.FExDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.fex_detail_menu, menu); // configure menu_item_add_entry MenuItem menu_item_add_entry = (MenuItem) menu.findItem(R.id.menu_item_add_entry); menu_item_add_entry.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { showDialog();//w ww. j a v a 2s.com return true; } }); // configure menu_item_license_info MenuItem menu_item_license_info = (MenuItem) menu.findItem(R.id.menu_item_license_info); menu_item_license_info.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.license_info)); String license = ""; if (mExercise.getImageLicenseMap().values().iterator().hasNext()) { license = mExercise.getImageLicenseMap().values().iterator().next(); } else { license = getString(R.string.no_license_available); } builder.setMessage(license); builder.create().show(); return true; } }); // configure menu_item_license_info MenuItem menu_item_history = (MenuItem) menu.findItem(R.id.menu_item_history); menu_item_history.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = DialogFragmentTrainingEntryTable.newInstance(mExercise); newFragment.show(ft, "dialog"); return true; } }); // configure menu_item_description MenuItem menu_item_description = (MenuItem) menu.findItem(R.id.menu_item_description); menu_item_description.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { if (mExercise.getDescription() == null || mExercise.getDescription().equals("")) { Toast.makeText(getActivity(), getString(R.string.no_description_available), Toast.LENGTH_LONG) .show(); return true; } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.description)); builder.setMessage(Html.fromHtml(mExercise.getDescription())); builder.create().show(); return true; } }); }
From source file:de.hackerspacebremen.StartActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { boolean result = true; switch (item.getItemId()) { case R.id.settings: final Intent intent = new Intent(this, SettingActivity.class); startActivity(intent);//from w ww. ja v a2 s . c o m break; case R.id.change: this.manageFragment(FragmentState.CHANGE_SHOWN, null); item.setVisible(false); break; // case R.id.map: // this.manageFragment(FragmentState.MAP_SHOWN, null); // item.setVisible(false); // break; // case R.id.news: // this.manageFragment(FragmentState.NEWS_SHOWN, null); // item.setVisible(false); // break; case R.id.about: // use support library with fragment dialog instead final FragmentTransaction transaction = this.getSupportFragmentManager().beginTransaction(); final DialogFragment newFragment = new AboutDialogFragment(); newFragment.show(transaction, "dialog"); break; case R.id.refresh: EventBus.getDefault().post(new RefreshEvent()); break; default: result = super.onOptionsItemSelected(item); } return result; }
From source file:com.ohso.omgubuntu.ArticleActivity.java
private void openArticle() { articleSource.open();/*from w w w . j av a 2 s. c o m*/ Article article = articleSource.getArticle(activeArticle, true); if (article == null) { OnArticleLoaded newArticleLoad = new OnArticleLoaded() { @Override public void articleLoaded(Article article) { currentArticle = article; article.setUnread(0); articleSource.createArticle(article, true, true); setContents(article); articleSource.close(); } @Override public void articleError() { DialogFragment fragment = AlertDialogFragment.newInstance(activeArticle); fragment.show(getSupportFragmentManager(), "article_error"); articleSource.close(); } }; new Article().getLatest(newArticleLoad, activeArticle); } else { currentArticle = article; articleSource.close(); setContents(article); if (article.isUnread()) { articleSource.open(); articleSource.setArticleToUnread(false, article.getPath()); articleSource.close(); } } invalidateOptionsMenu(); }
From source file:com.mattprecious.notisync.profile.SecondaryCustomProfileActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();/*from w ww. j ava2 s. com*/ return true; case R.id.menu_save: validate(); if (errorFlags > 0) { Crouton.showText(this, R.string.custom_profile_fix_errors, Style.ALERT); } else { if (save()) { setResult(RESULT_OK); finish(); } else { Crouton.showText(this, R.string.custom_profile_error, Style.ALERT); } } return true; case R.id.menu_discard: setResult(RESULT_CANCELED); finish(); return true; case R.id.menu_delete: if (delete()) { setResult(MainActivity.RESULT_CODE_PROFILE_DELETED, getIntent()); finish(); } else { Crouton.showText(this, R.string.custom_profile_error, Style.ALERT); } return true; case R.id.menu_help: DialogFragment helpFragment = new CustomHelpDialogFragment(); helpFragment.show(getSupportFragmentManager(), null); return true; } return super.onOptionsItemSelected(item); }
From source file:com.mplayer_remote.SettingsForAPP.java
/** * Metoda wywoywana przez system Android przy starcie aktywnoci. * Tu nastpuje wyczytanie ustawie aplikacji i zainicjowanie GUI aktywnoci. * @see android.app.Activity#onCreate(android.os.Bundle) *//*from ww w. j av a 2s . c o m*/ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(false); //ustawianie GUI setContentView(R.layout.layout_for_settingsforserverlist); settingsForAPPSharedPreferences = getSharedPreferences("settings_for_APP", 0); isThisFirstRunboolean = settingsForAPPSharedPreferences.getBoolean("is_this_first_run", true); isCryptoEnabledboolean = settingsForAPPSharedPreferences.getBoolean("is_crypto_enabled", true); //byo false showOnlyMediaTypeFilesBoolean = settingsForAPPSharedPreferences.getBoolean(SHOW_ONLY_MEDIA_TYPE_FILES, true); if (savedInstanceState == null) { Intent intent_from_ServerList = getIntent(); //getIntent() zwraca obiekt Intent ktry wystartowa Activity appPasswordcharArray = intent_from_ServerList.getCharArrayExtra("app_password"); } else { appPasswordcharArray = savedInstanceState.getCharArray("appPasswordcharArray"); } Log.v(TAG, "aktualny isThisFirstRunboolean: " + isThisFirstRunboolean); Log.v(TAG, "aktualny isCryptoEnabledboolean: " + isCryptoEnabledboolean); if (appPasswordcharArray != null) { String appPasswordcharArrayConvertedToString = new String(appPasswordcharArray); Log.v(TAG, "Aktuane appPasswordcharArray: " + appPasswordcharArrayConvertedToString); } //creating a XML Context mContext = getApplicationContext(); aXMLReaderWriter = new XMLReaderWriter(mContext); if (isCryptoEnabledboolean == true && appPasswordcharArray != null) { //appPasswordcharArray == null try { serverListArrayList = aXMLReaderWriter .decryptFileWithXMLAndParseItToServerList(appPasswordcharArray); } catch (WrongPasswordException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getApplicationContext(), R.string.wrong_app_password_exeption, Toast.LENGTH_SHORT) .show(); finish(); //something is wrong } } else { try { serverListArrayList = aXMLReaderWriter .decryptFileWithXMLAndParseItToServerList("default_password".toCharArray()); } catch (WrongPasswordException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getApplicationContext(), R.string.wrong_app_password_exeption, Toast.LENGTH_SHORT) .show(); finish(); //something is wrong } } useEencryptionCheckBox = (CheckBox) findViewById(R.id.use_encryption_in_SettingForServer_checkBox); useEencryptionCheckBox.setChecked(isCryptoEnabledboolean); useEencryptionCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (useEencryptionCheckBox.isChecked() == true) { isCryptoEnabledboolean = true; isThisFirstRunboolean = true; } else { isCryptoEnabledboolean = false; } SharedPreferences settings_for_activity_ServerList = getSharedPreferences("settings_for_APP", 0); SharedPreferences.Editor editor = settings_for_activity_ServerList.edit(); editor.putBoolean("is_crypto_enabled", isCryptoEnabledboolean); editor.putBoolean("is_this_first_run", isThisFirstRunboolean); // Commit the edits! editor.commit(); if (useEencryptionCheckBox.isChecked() == true) { Toast.makeText(getApplicationContext(), R.string.text_for_toast_Edit_server_data_fill_server_password_field, Toast.LENGTH_LONG) .show(); aXMLReaderWriter.createEncryptedXMLFileWithServerList(serverListArrayList, appPasswordcharArray); } else { //appPasswordcharArray = "default_password".toCharArray(); for (int i = 0; i < serverListArrayList.size(); i++) { serverListArrayList.get(i).setPassword("".toCharArray()); } aXMLReaderWriter.createEncryptedXMLFileWithServerList(serverListArrayList, "default_password".toCharArray()); } } }); showOnlyMediaTypeFilesCheckBox = (CheckBox) findViewById((R.id.show_only_media_type_files_checkBox)); showOnlyMediaTypeFilesCheckBox.setChecked(showOnlyMediaTypeFilesBoolean); showOnlyMediaTypeFilesCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (showOnlyMediaTypeFilesCheckBox.isChecked() == true) { showOnlyMediaTypeFilesBoolean = true; } else { showOnlyMediaTypeFilesBoolean = false; } SharedPreferences settings_for_activity_ServerList = getSharedPreferences("settings_for_APP", 0); SharedPreferences.Editor editor = settings_for_activity_ServerList.edit(); editor.putBoolean(SHOW_ONLY_MEDIA_TYPE_FILES, showOnlyMediaTypeFilesBoolean); //Commit the edits! editor.commit(); } }); knowFileExtensionsTextView = (TextView) findViewById(R.id.know_file_extensions); knowFileExtensionsTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.v(TAG, "klikem knowFileExtensionsTextView"); DialogFragment newFragment = new KnowFileExtensionsDialogFragment(); newFragment.show(getSupportFragmentManager(), "KnowFileExtensionsDialogFragment"); } }); }
From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.activities.SensorSettingsActivity.java
private void openSelectSensorType() { Bundle extras = getIntent().getExtras(); DialogFragment deviceDialog = new SelectDeviceDialogFragment(); extras.putInt("position", -1); extras.putBoolean("device", false); deviceDialog.setArguments(extras);//from w w w .ja v a 2s .c o m getFragmentManager().beginTransaction(); deviceDialog.show(getSupportFragmentManager().beginTransaction(), "deviceDialog"); }
From source file:com.example.android.pantry.scanner.BarcodeScannerActivity.java
public void showSearchDialog(String message) { DialogFragment fragment = SearchDialogFragment.newInstance("External Search", message, this); fragment.show(getSupportFragmentManager(), "search_request"); }