List of usage examples for android.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:by.zatta.pilight.MainActivity.java
private void openDialogFragment(DialogFragment dialogStandardFragment) { if (dialogStandardFragment != null) { FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); DialogFragment prev = (DialogFragment) fm.findFragmentByTag("dialog"); if (prev != null) { prev.dismiss();//from www.ja va 2 s .c om } try { dialogStandardFragment.show(ft, "dialog"); } catch (IllegalStateException e) { Log.w(TAG, "activity wasn't yet made"); } } }
From source file:me.albertonicoletti.latex.activities.EditorActivity.java
/** * On long clicking a document in the drawer, it shows a dialog asking what to do * @param view View// w w w. jav a 2 s.c o m */ @Override public void onDocumentLongClickListener(View view) { TextView m = (TextView) view.findViewById(R.id.drawer_file_path); Bundle args = new Bundle(); // Adds a "filename" parameter containing the filename args.putString("filepath", m.getText().toString()); // Creates the dialog and adds the parameter DialogFragment dialog = new DocumentOptionsDialog(); dialog.setArguments(args); // Opens thee dialog dialog.show(getFragmentManager(), "editor_drawer_longclick"); }
From source file:org.uoyabause.android.YabauseHandler.java
void startReport() { waiting_reault = true; DialogFragment newFragment = new ReportDialog(); newFragment.show(getFragmentManager(), "Report"); }
From source file:cz.yetanotherview.webcamviewer.app.actions.JsonFetcherDialog.java
private void showReportDialog() { DialogFragment reportDialog = new ReportDialog(); Bundle bundle = new Bundle(); bundle.putInt("newWebCams", newWebCams); bundle.putInt("duplicityWebCams", duplicityWebCams); bundle.putInt("updatedWebCams", updatedWebCams); reportDialog.setArguments(bundle);/*w w w .j a va 2 s . c o m*/ reportDialog.show(mActivity.getFragmentManager(), "ReportDialog"); }
From source file:se.liu.tddd77.bilsensor.MainActivity.java
public void handleRecord(ImageButton button) { //TODO: Start recording recButton = button;/* ww w . j a v a2s. c o m*/ if (!isRecording) { try { Backend.getInstance().resetSensorsData(); Backend.getInstance().sendSettingsRequestMessageSelected(20, activeSensorsIdList); if (Backend.getInstance().getServerStatus() == protobuf.Protocol.StatusMsg.StatusType.IDLE) Backend.getInstance().startDataCollection( "fromSurfplatta" + new java.util.Date(System.currentTimeMillis()).toString()); experimentName = Backend.getInstance().getTemporaryName(); } catch (BackendError e1) { // TODO Auto-generated catch block e1.printStackTrace(); } //TODO: Only allow reaction when done with setup? Log.i("MainActivity", "handleRecord: Started recording"); isRecording = true; recording = true; //timeout = true; recButton.setImageResource(R.drawable.recred); } else { DialogFragment recordFragment = new RecordDialog(); recordFragment.show(getFragmentManager(), "dialog"); //TODO: If cancel the save, continue running? } }
From source file:it.angrydroids.epub3reader.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.FirstEPUB: bookSelector = 0;/*from w w w . j a v a2 s. co m*/ Intent goToChooser1 = new Intent(this, FileChooser.class); goToChooser1.putExtra(getString(R.string.second), getString(R.string.time)); startActivityForResult(goToChooser1, 0); return true; case R.id.SecondEPUB: bookSelector = 1; Intent goToChooser2 = new Intent(this, FileChooser.class); goToChooser2.putExtra(getString(R.string.second), getString(R.string.time)); startActivityForResult(goToChooser2, 0); return true; case R.id.Front: if (navigator.exactlyOneBookOpen() == true || navigator.isParallelTextOn() == true) chooseLanguage(0); return true; case R.id.FirstFront: chooseLanguage(0); return true; case R.id.SecondFront: if (navigator.exactlyOneBookOpen() == false) chooseLanguage(1); else errorMessage(getString(R.string.error_onlyOneBookOpen)); return true; case R.id.PconS: try { boolean yes = navigator.synchronizeView(1, 0); if (!yes) { errorMessage(getString(R.string.error_onlyOneBookOpen)); } } catch (Exception e) { errorMessage(getString(R.string.error_cannotSynchronize)); } return true; case R.id.SconP: try { boolean ok = navigator.synchronizeView(0, 1); if (!ok) { errorMessage(getString(R.string.error_onlyOneBookOpen)); } } catch (Exception e) { errorMessage(getString(R.string.error_cannotSynchronize)); } return true; case R.id.Synchronize: boolean sync = navigator.flipSynchronizedReadingActive(); if (!sync) { errorMessage(getString(R.string.error_onlyOneBookOpen)); } return true; case R.id.Metadata: if (navigator.exactlyOneBookOpen() == true || navigator.isParallelTextOn() == true) { navigator.displayMetadata(0); } else { } return true; case R.id.meta1: if (!navigator.displayMetadata(0)) errorMessage(getString(R.string.error_metadataNotFound)); return true; case R.id.meta2: if (!navigator.displayMetadata(1)) errorMessage(getString(R.string.error_metadataNotFound)); return true; case R.id.tableOfContents: if (navigator.exactlyOneBookOpen() == true || navigator.isParallelTextOn() == true) navigator.displayTOC(0); return true; case R.id.toc1: if (!navigator.displayTOC(0)) errorMessage(getString(R.string.error_tocNotFound)); return true; case R.id.toc2: if (navigator.displayTOC(1)) errorMessage(getString(R.string.error_tocNotFound)); return true; case R.id.changeSize: try { DialogFragment newFragment = new SetPanelSize(); newFragment.show(getFragmentManager(), ""); } catch (Exception e) { errorMessage(getString(R.string.error_cannotChangeSizes)); } return true; case R.id.Style: // work in progress... try { if (navigator.exactlyOneBookOpen() == true) { DialogFragment newFragment = new ChangeCSSMenu(); newFragment.show(getFragmentManager(), ""); bookSelector = 0; } } catch (Exception e) { errorMessage(getString(R.string.error_CannotChangeStyle)); } return true; case R.id.StyleBook1: try { { DialogFragment newFragment = new ChangeCSSMenu(); newFragment.show(getFragmentManager(), ""); bookSelector = 0; } } catch (Exception e) { errorMessage(getString(R.string.error_CannotChangeStyle)); } return true; case R.id.StyleBook2: try { { DialogFragment newFragment = new ChangeCSSMenu(); newFragment.show(getFragmentManager(), ""); bookSelector = 1; } } catch (Exception e) { errorMessage(getString(R.string.error_CannotChangeStyle)); } return true; /* * case R.id.SyncScroll: syncScrollActivated = !syncScrollActivated; * return true; */ case R.id.audio: if (navigator.exactlyOneBookOpen() == true) if (!navigator.extractAudio(0)) errorMessage(getString(R.string.no_audio)); return true; case R.id.firstAudio: if (!navigator.extractAudio(0)) errorMessage(getString(R.string.no_audio)); return true; case R.id.secondAudio: if (!navigator.extractAudio(1)) errorMessage(getString(R.string.no_audio)); return true; case R.id.ScanBLE: Log.i(TAG, "Scanning button is pressed"); // auto scan and attach BLE device here. switch (mBLEState) { case UART_PROFILE_DISCONNECTED: Toast.makeText(this, "Scanning for BLE devices", Toast.LENGTH_SHORT).show(); scanBLEDevices(); item.setTitle("Scanning..."); break; case UART_PROFILE_CONNECTED: if (mDevice != null) { mService.disconnect(); } break; case UART_SCANNING_BLE_DEVICES: Toast.makeText(this, "Scanning for BLE devices", Toast.LENGTH_SHORT).show(); break; default: break; } // If success, change label to Disconnect BLE and notify a successful connection // Otherwise, keep the name and show info message return true; default: return super.onOptionsItemSelected(item); } }
From source file:no.digipost.android.gui.MainContentActivity.java
private void showCreateEditDialog(int content, boolean editFolder) { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag(EditFolderFragment.fragmentName); if (prev != null) { ft.remove(prev);// w w w . j a va 2s .c om } ft.addToBackStack(null); DialogFragment editFolderFragment = EditFolderFragment.newInstance(content, account.getValidationRules().getFolderName(), editFolder); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); editFolderFragment.show(ft, EditFolderFragment.fragmentName); }
From source file:com.sonaive.v2ex.ui.BaseActivity.java
private void setUpAccount() { profileImage = (ImageView) findViewById(R.id.profile_image); if (profileImage == null) { return;//from w w w . j av a 2 s . c o m } profileImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Create an instance of the dialog fragment and show it DialogFragment dialog = new SignInDialogFragment(); dialog.show(getFragmentManager(), "SignInDialogFragment"); } }); }
From source file:se.liu.tddd77.bilsensor.MainActivity.java
public void showRecordDialog() { Log.d("showRecordDialog", "RECORDDIALOG"); DialogFragment recordFragment = new RecordDialog(); ((RecordDialog) recordFragment).setETs(expName, expNotes); recordFragment.show(getFragmentManager(), "dialog"); }
From source file:cz.metaverse.android.bilingualreader.ReaderActivity.java
/** * Called when Menu option is selected./*from www .j a va 2 s .co m*/ */ @Override public boolean onOptionsItemSelected(MenuItem item) { // Pass the event to ActionBarDrawerToggle, if it returns true, then it has handled // the app icon touch event that opens/closes the navigation drawer. if (actionBarDrawerToggle.onOptionsItemSelected(item)) { return true; } // If a classic options-menu item was selected, close the navigation drawer if it was open. if (navigationDrawerLayout.isDrawerOpen(Gravity.START)) { navigationDrawerLayout.closeDrawer(Gravity.START); } // Now handle our menu items. switch (item.getItemId()) { // Change relative size of panels case R.id.change_size_menu_item: try { // Display dialog to pick new relative size of the panels. DialogFragment newFragment = new PanelSizeDialog(); newFragment.show(getFragmentManager(), ""); } catch (Exception e) { errorMessage(getString(R.string.error_cannotChangeSizes)); } return true; // Fullscreen case R.id.fullscreen_menu_item: // Switch to fullscreen switchFullscreen(); // Build an info dialog. AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.Fullscreen)); // Add OK and Cancel buttons builder.setPositiveButton(getString(R.string.OK), null); builder.setNegativeButton(getString(R.string.Cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { switchFullscreen(); } }); // Create the dialog builder.setMessage(R.string.fullscreen_dialog_info_notice); builder.create().show(); return true; // Toggle Scroll Sync case R.id.scroll_sync_menu_item: Boolean newDefaultScrollSyncMethodSet = governor.flipScrollSync(); if (governor.isScrollSync()) { // Display infotext if appropriate. InfotextDialog.showIfAppropriate(this, DontShowAgain.SCROLL_SYNC); if (newDefaultScrollSyncMethodSet != null && newDefaultScrollSyncMethodSet) { Toast.makeText(this, getString(R.string.Activated_Default_Scroll_sync_method), Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, getString(R.string.Activated_Scroll_sync), Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(this, getString(R.string.Deactivated_Scroll_sync), Toast.LENGTH_SHORT).show(); } return true; // Scroll Sync Options case R.id.scroll_sync_options_menu_item: new ScrollSyncDialog().show(getFragmentManager(), "ScrollSyncDialog"); return true; // Sync Chapters case R.id.sync_chapters_menu_item: if (!governor.flipChapterSync()) { errorMessage(getString(R.string.error_onlyOneBookOpen)); } if (governor.isChapterSync()) { // Display infotext if appropriate. if (!InfotextDialog.showIfAppropriate(this, DontShowAgain.CHAPTER_SYNC)) { // If infotext was not shown, show at least a toast. Toast.makeText(this, getString(R.string.Activated_Chapter_sync), Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(this, getString(R.string.Deactivated_Chapter_sync), Toast.LENGTH_SHORT).show(); } return true; // Bilingual ebook case R.id.bilingual_ebook_menu_item: if (governor.exactlyOneBookOpen() || governor.isReadingBilingualEbook()) { if (openBilingualBook(0)) { invalidateOptionsMenu(); } } return true; case R.id.bilingual_ebook_1_menu_item: if (openBilingualBook(0)) { invalidateOptionsMenu(); } return true; case R.id.bilingual_ebook_2_menu_item: if (!governor.exactlyOneBookOpen()) { if (openBilingualBook(1)) { invalidateOptionsMenu(); } } else { errorMessage(getString(R.string.error_onlyOneBookOpen)); } return true; // Display metadata of the book case R.id.metadata_menu_item: if (governor.exactlyOneBookOpen() == true || governor.isReadingBilingualEbook() == true) { governor.getPanelHolder(0).displayMetadata(); } else { } return true; case R.id.metadata_1_menu_item: if (!governor.getPanelHolder(0).displayMetadata()) errorMessage(getString(R.string.error_metadataNotFound)); return true; case R.id.metadata_2_menu_item: if (!governor.getPanelHolder(1).displayMetadata()) errorMessage(getString(R.string.error_metadataNotFound)); return true; // Table of contents case R.id.table_of_contents_menu_item: if (governor.exactlyOneBookOpen() == true || governor.isReadingBilingualEbook() == true) { governor.getPanelHolder(0).displayToC(); } return true; case R.id.table_of_contents_1_menu_item: if (!governor.getPanelHolder(0).displayToC()) errorMessage(getString(R.string.error_tocNotFound)); return true; case R.id.table_of_contents_2_menu_item: if (!governor.getPanelHolder(1).displayToC()) errorMessage(getString(R.string.error_tocNotFound)); return true; // Change style -- deprecated, replaced by Visual Options button in the navigation drawer. case R.id.style_menu_item: try { // Display the style dialog. if (governor.exactlyOneBookOpen() == true) { DialogFragment newFragment = new VisualOptionsDialog(); newFragment.show(getFragmentManager(), ""); bookSelector = 0; } } catch (Exception e) { errorMessage(getString(R.string.error_CannotChangeStyle)); } return true; case R.id.style_1_menu_item: try { // Display the style dialog. DialogFragment newFragment = new VisualOptionsDialog(); newFragment.show(getFragmentManager(), ""); bookSelector = 0; } catch (Exception e) { errorMessage(getString(R.string.error_CannotChangeStyle)); } return true; case R.id.style_2_menu_item: try { // Display the style dialog. DialogFragment newFragment = new VisualOptionsDialog(); newFragment.show(getFragmentManager(), ""); bookSelector = 1; } catch (Exception e) { errorMessage(getString(R.string.error_CannotChangeStyle)); } return true; // Audio shenanigans. case R.id.audio_menu_item: if (governor.exactlyOneBookOpen() == true) { if (!governor.getPanelHolder(0).extractAudio()) { errorMessage(getString(R.string.no_audio)); } } return true; case R.id.audio_1_menu_item: if (!governor.getPanelHolder(0).extractAudio()) errorMessage(getString(R.string.no_audio)); return true; case R.id.audio_2_menu_item: if (!governor.getPanelHolder(1).extractAudio()) errorMessage(getString(R.string.no_audio)); return true; // And finally, the default option. default: return super.onOptionsItemSelected(item); } }