List of usage examples for android.support.v4.app DialogFragment setArguments
public void setArguments(Bundle args)
From source file:net.reichholf.dreamdroid.activities.MainActivity.java
@Override public void showDialogFragment(Class<? extends DialogFragment> fragmentClass, Bundle args, String tag) { DialogFragment f = null; try {/*from ww w . j a va 2 s. c om*/ f = fragmentClass.newInstance(); f.setArguments(args); showDialogFragment(f, tag); } catch (InstantiationException e) { Log.e(TAG, e.getMessage()); } catch (IllegalAccessException e) { Log.e(TAG, e.getMessage()); } }
From source file:de.eidottermihi.rpicheck.activity.CustomCommandActivity.java
/** * Opens the command dialog./*from w w w . j ava2 s.com*/ * * @param keyPassphrase nullable: key passphrase */ private void openCommandDialog(final long commandId, final String keyPassphrase) { final CommandBean command = deviceDb.readCommand(commandId); final ArrayList<String> dynamicPlaceholders = parseDynamicPlaceholders(command.getCommand()); if (!dynamicPlaceholders.isEmpty()) { // need to get replacements for dynamic placeholders first DialogFragment placeholderDialog = new CommandPlaceholdersDialog(); Bundle args2 = new Bundle(); args2.putStringArrayList(CommandPlaceholdersDialog.ARG_PLACEHOLDERS, dynamicPlaceholders); args2.putSerializable(CommandPlaceholdersDialog.ARG_COMMAND, command); args2.putString(CommandPlaceholdersDialog.ARG_PASSPHRASE, keyPassphrase); placeholderDialog.setArguments(args2); placeholderDialog.show(getSupportFragmentManager(), "placeholders"); return; } parseNonPromptingAndShow(keyPassphrase, command); }
From source file:com.vuze.android.remote.activity.IntentHandler.java
public void editProfile(RemoteProfile remoteProfile) { DialogFragment dlg = remoteProfile.getRemoteType() == RemoteProfile.TYPE_LOOKUP ? new DialogFragmentVuzeRemoteProfile() : new DialogFragmentGenericRemoteProfile(); Bundle args = new Bundle(); Map<?, ?> profileAsMap = remoteProfile.getAsMap(false); String profileAsJSON = JSONUtils.encodeToJSON(profileAsMap); args.putSerializable("remote.json", profileAsJSON); dlg.setArguments(args); AndroidUtils.showDialog(dlg, getSupportFragmentManager(), "GenericRemoteProfile"); }
From source file:org.getlantern.firetweet.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 www .jav a2s. 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; } case MENU_OPEN_WITH_ACCOUNT: { final Intent intent = new Intent(INTENT_ACTION_SELECT_ACCOUNT); intent.setClass(getActivity(), AccountSelectorActivity.class); intent.putExtra(EXTRA_SINGLE_SELECTION, true); startActivityForResult(intent, REQUEST_SELECT_ACCOUNT); break; } default: { if (item.getIntent() != null) { try { startActivity(item.getIntent()); } catch (final ActivityNotFoundException e) { Log.w(LOGTAG, e); return false; } } break; } } return true; }
From source file:org.liberty.android.fantastischmemo.ui.MiscTabFragment.java
@Override public void onClick(View v) { if (v == optionButton) { startActivity(new Intent(mActivity, OptionScreen.class)); }/*from w w w.j a v a 2 s . co m*/ /* Toggle visibility for import and export buttons */ if (v == importButton) { if (importItems.getVisibility() == View.GONE) { importItems.setVisibility(View.VISIBLE); } else { importItems.setVisibility(View.GONE); } } if (v == exportButton) { if (exportItems.getVisibility() == View.GONE) { exportItems.setVisibility(View.VISIBLE); } else { exportItems.setVisibility(View.GONE); } } if (v == importMnemosyneButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, MnemosyneXMLImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".xml"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportMnemosyne"); } if (v == importSupermemoButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, SupermemoXMLImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".xml"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportSuperMemo2008"); } if (v == importCSVButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, CSVImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".csv"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportCSV"); } if (v == importZipButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, ZipImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".zip"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportZip"); } if (v == importTabButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, TabTxtImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".txt"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportTabTxt"); } if (v == importQAButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, QATxtImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".txt"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportCSV"); } if (v == importSupermemo2008Button) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, Supermemo2008XMLImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".xml"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportSuperMemo2008"); } if (v == importMnemosyne2CardsButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, Mnemosyne2CardsImporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".cards"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ImportMnemosyne2Cards"); } if (v == exportMnemosyneButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, MnemosyneXMLExporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".db"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ExportMnemosyne"); } if (v == exportCSVButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, CSVExporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".db"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ExportCSV"); } if (v == exportTabButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, TabTxtExporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".db"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ExportTabTxt"); } if (v == exportQAButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, QATxtExporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".db"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ExportQA"); } if (v == exportZipButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, ZipExporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".db"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ExportZip"); } if (v == exportMnemosyne2CardsButton) { DialogFragment df = new ConverterFragment(); Bundle b = new Bundle(); b.putSerializable(ConverterFragment.EXTRA_CONVERTER_CLASS, Mnemosyne2CardsExporter.class); b.putString(FileBrowserFragment.EXTRA_FILE_EXTENSIONS, ".db"); df.setArguments(b); df.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "ExportMnemosyne2Cards"); } if (v == defaultSettingsButton) { Intent intent = new Intent(mActivity, SettingsScreen.class); String emptyDbPath = mActivity.getApplicationContext().getFilesDir().getAbsolutePath() + "/" + AMEnv.EMPTY_DB_NAME; intent.putExtra(SettingsScreen.EXTRA_DBPATH, emptyDbPath); startActivity(intent); } if (v == mergeButton) { Intent myIntent = new Intent(mActivity, DatabaseMerger.class); startActivity(myIntent); } if (v == resetButton) { new AlertDialog.Builder(mActivity).setTitle(R.string.clear_all_pref) .setMessage(R.string.reset_all_pref_warning) .setPositiveButton(R.string.ok_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.clear(); editor.commit(); mActivity.finish(); } }).setNegativeButton(R.string.cancel_text, null).show(); } if (v == donateButton) { View alertView = View.inflate(mActivity, R.layout.link_alert, null); TextView textView = (TextView) alertView.findViewById(R.id.link_alert_message); textView.setText(Html.fromHtml(getString(R.string.donate_summary))); textView.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(mActivity).setView(alertView).setTitle(R.string.donate_text) .setPositiveButton(getString(R.string.buy_pro_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Intent myIntent = new Intent(); myIntent.setAction(Intent.ACTION_VIEW); myIntent.addCategory(Intent.CATEGORY_BROWSABLE); myIntent.setData(Uri.parse(getString(R.string.anymemo_pro_link))); startActivity(myIntent); } }).setNegativeButton(getString(R.string.cancel_text), null).show(); } if (v == helpButton) { Intent myIntent = new Intent(); myIntent.setAction(Intent.ACTION_VIEW); myIntent.addCategory(Intent.CATEGORY_BROWSABLE); myIntent.setData(Uri.parse(WEBSITE_VERSION)); startActivity(myIntent); } if (v == aboutButton) { // Get the version defined in the AndroidManifest. String versionName = ""; try { versionName = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e) { versionName = "1.0"; } View alertView = View.inflate(mActivity, R.layout.link_alert, null); TextView textView = (TextView) alertView.findViewById(R.id.link_alert_message); textView.setText(Html.fromHtml(getString(R.string.about_text))); textView.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(mActivity).setView(alertView) .setTitle(getString(R.string.app_full_name) + " " + versionName) .setPositiveButton(getString(R.string.ok_text), null) .setNegativeButton(getString(R.string.about_version), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Intent myIntent = new Intent(); myIntent.setAction(Intent.ACTION_VIEW); myIntent.addCategory(Intent.CATEGORY_BROWSABLE); myIntent.setData(Uri.parse(WEBSITE_VERSION)); startActivity(myIntent); } }).show(); } }
From source file:com.bonsai.wallet32.SweepKeyActivity.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); df.show(getSupportFragmentManager(), "wait"); return df;//from w ww . j a v a 2 s. co m }
From source file:com.bonsai.wallet32.PasscodeActivity.java
protected DialogFragment showErrorDialog(String title, String msg) { DialogFragment df = new MyDialogFragment(); Bundle args = new Bundle(); args.putString("title", title); args.putString("msg", msg); args.putBoolean("hasOK", true); df.setArguments(args); df.show(getSupportFragmentManager(), "error"); return df;/*from www .j ava2 s .co m*/ }
From source file:com.bonsai.wallet32.PasscodeActivity.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); df.setCancelable(false);/*from w w w .j av a 2 s . c o m*/ df.show(getSupportFragmentManager(), "note"); return df; }
From source file:org.gots.ui.TabSeedActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection Intent i;/*from www . j a v a 2s. c om*/ switch (item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.help: Intent browserIntent = new Intent(this, WebHelpActivity.class); browserIntent.putExtra(WebHelpActivity.URL, getClass().getSimpleName()); startActivity(browserIntent); return true; case R.id.sow: Intent intent = new Intent(this, MyMainGarden.class); intent.putExtra(MyMainGarden.SELECT_ALLOTMENT, true); intent.putExtra(MyMainGarden.VENDOR_SEED_ID, mSeed.getSeedId()); startActivity(intent); return true; case R.id.planning: FragmentManager fm = getSupportFragmentManager(); DialogFragment scheduleDialog = new ScheduleActionFragment(); Bundle data = new Bundle(); data.putInt(GOTS_GROWINGSEED_ID, mSeed.getGrowingSeedId()); scheduleDialog.setArguments(data); scheduleDialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomDialog); scheduleDialog.show(fm, "fragment_planning"); return true; case R.id.download: new AsyncTask<Void, Integer, File>() { boolean licenceAvailable = false; IabHelper buyHelper; private ProgressDialog dialog; protected void onPreExecute() { licenceAvailable = gotsPurchase.getFeatureExportPDF() ? true : gotsPurchase.isPremium(); dialog = ProgressDialog.show(TabSeedActivity.this, "", getResources().getString(R.string.gots_loading), true); dialog.setCanceledOnTouchOutside(true); }; @Override protected File doInBackground(Void... params) { if (licenceAvailable) try { GotsActionSeedProvider provider = GotsActionSeedManager.getInstance() .initIfNew(getApplicationContext()); return provider.downloadHistory(mSeed); } catch (GotsServerRestrictedException e) { Log.w(TAG, e.getMessage()); licenceAvailable = false; return null; } return null; } @Override protected void onPostExecute(File result) { try { dialog.dismiss(); dialog = null; } catch (Exception e) { // nothing } if (!gotsPrefs.isConnectedToServer()) { AlertDialog.Builder builder = new AlertDialog.Builder(TabSeedActivity.this); builder.setMessage(getResources().getString(R.string.login_connect_restricted)) .setCancelable(false) .setPositiveButton(getResources().getString(R.string.login_connect), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { LoginDialogFragment dialogFragment = new LoginDialogFragment(); dialogFragment.show(getSupportFragmentManager(), ""); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); } if (!licenceAvailable) { FragmentManager fm = getSupportFragmentManager(); GotsBillingDialog editNameDialog = new GotsBillingDialog( GotsPurchaseItem.SKU_FEATURE_PDFHISTORY); editNameDialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomDialog); editNameDialog.show(fm, "fragment_edit_name"); } if (result != null) { Intent pdfIntent = new Intent(Intent.ACTION_VIEW); pdfIntent.setDataAndType(Uri.fromFile(result), "application/pdf"); startActivity(pdfIntent); } } }.execute(); return true; case R.id.photo: photoAction = new PhotoAction(getApplicationContext()); Date now = new Date(); cameraPicture = new File(photoAction.getImageFile(now).getAbsolutePath()); Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(cameraPicture)); // takePictureIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivityForResult(takePictureIntent, PICK_IMAGE); return true; case R.id.delete: final DeleteAction deleteAction = new DeleteAction(this); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(this.getResources().getString(R.string.action_delete_seed)).setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { new AsyncTask<SeedActionInterface, Integer, Void>() { @Override protected Void doInBackground(SeedActionInterface... params) { SeedActionInterface actionItem = params[0]; actionItem.execute(mSeed); return null; } @Override protected void onPostExecute(Void result) { Toast.makeText(getApplicationContext(), "action done", Toast.LENGTH_SHORT) .show(); TabSeedActivity.this.finish(); super.onPostExecute(result); } }.execute(deleteAction); sendBroadcast(new Intent(BroadCastMessages.GROWINGSEED_DISPLAYLIST)); dialog.dismiss(); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); return true; case R.id.workflow: new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { NuxeoWorkflowProvider nuxeoWorkflowProvider = new NuxeoWorkflowProvider( getApplicationContext()); // BaseSeedInterface baseSeedInterface = (BaseSeedInterface) arg0.getItemAtPosition(arg2); nuxeoWorkflowProvider.startWorkflowValidation(mSeed); return null; } }.execute(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:felixwiemuth.lincal.ui.CalendarViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.calendar_view, container, false); TextView titleView = (TextView) rootView.findViewById(R.id.cal_title); TextView authorView = (TextView) rootView.findViewById(R.id.cal_author); notificationsEnabled = (CheckBox) rootView.findViewById(R.id.notifications_enabled); textViewEarliestNotificationTime = (TextView) rootView .findViewById(R.id.setting_earliest_notification_time); earliestNotificationTimeEnabled = (CheckBox) rootView .findViewById(R.id.setting_earliest_notification_time_enabled); entryDisplayModeDate = (Spinner) rootView.findViewById(R.id.setting_entry_display_mode_date); entryDisplayModeDescription = (Spinner) rootView.findViewById(R.id.setting_entry_display_mode_description); buttonRemoveCalendar = (Button) rootView.findViewById(R.id.button_remove_cal); if (calendar == null) { titleView.setText(R.string.cal_title_error_loading); notificationsEnabled.setEnabled(false); earliestNotificationTimeEnabled.setEnabled(false); entryDisplayModeDate.setEnabled(false); entryDisplayModeDescription.setEnabled(false); } else {/*from w w w . j av a 2 s .c o m*/ titleView.setText(calendar.getTitle()); authorView.setText(calendar.getAuthor()); entryList = (RecyclerView) rootView.findViewById(R.id.entry_list_recycler_view); SimpleItemRecyclerViewAdapter adapter = new SimpleItemRecyclerViewAdapter(); entryList.setAdapter(adapter); ((TextView) rootView.findViewById(R.id.cal_descr)).setText(calendar.getDescription()); ((TextView) rootView.findViewById(R.id.cal_version)).setText(calendar.getVersion()); ((TextView) rootView.findViewById(R.id.cal_date)).setText(calendar.getDateStr()); if (calendar.hasForceEntryDisplayModeDate()) { entryDisplayModeDate.setEnabled(false); } if (calendar.hasForceEntryDisplayModeDescription()) { entryDisplayModeDescription.setEnabled(false); } } ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(getContext(), R.array.setting_entry_display_mode_options, android.R.layout.simple_spinner_item); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); entryDisplayModeDate.setAdapter(spinnerAdapter); entryDisplayModeDescription.setAdapter(spinnerAdapter); loadSettings(); // loading settings before adding listeners prevents them from firing due to initialization (e.g. Spinner) if (calendar != null) { // Set listeners final View.OnClickListener saveSettingsListener = new View.OnClickListener() { @Override public void onClick(View v) { saveSettings(); NotificationService.runWithCalendar(getContext(), Calendars.getInstance(getContext()).getConfigByPos(calendarPos).getId()); //TODO reconsider when to call } }; notificationsEnabled.setOnClickListener(saveSettingsListener); textViewEarliestNotificationTime.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadSettings(); // update earliestNotificationTime DialogFragment dialogFragment = new TimePickerFragment(); Bundle arguments = new Bundle(); arguments.putInt("hour", earliestNotificationTime.getHour()); arguments.putInt("minute", earliestNotificationTime.getMinute()); arguments.putInt("calendarPos", calendarPos); dialogFragment.setArguments(arguments); dialogFragment.show(getFragmentManager(), "timePicker"); } }); earliestNotificationTimeEnabled.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { saveSettingsListener.onClick(v); // have to update the displayed notification times (only show when enabled) entryList.getAdapter().notifyDataSetChanged(); } }); //TODO implement // onScreenOnEnabled = (CheckBox) rootView.findViewById(R.id.setting_show_notification_on_screen_on); // onScreenOnEnabled.setOnClickListener(saveSettingsListener); entryDisplayModeDate.setOnItemSelectedListener(new AdapterViewOnItemSelectedListener( entryDisplayModeDate.getSelectedItemPosition(), saveSettingsListener)); entryDisplayModeDescription.setOnItemSelectedListener(new AdapterViewOnItemSelectedListener( entryDisplayModeDescription.getSelectedItemPosition(), saveSettingsListener)); } buttonRemoveCalendar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.dialog_remove_cal_title).setMessage(R.string.dialog_remove_cal_msg) .setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // First remove this fragment, so that it cannot be used anymore getActivity().getSupportFragmentManager().beginTransaction() .remove(CalendarViewFragment.this).commit(); Calendars calendars = Calendars.getInstance(getContext()); calendars.removeCalendarByPos(getContext(), calendarPos); // Notify calendar list that the calendar with the given position was removed and return to calendar list in case of CalendarViewActivity Activity hostActivity = getActivity(); if (hostActivity instanceof CalendarListActivity) { ((CalendarListActivity) hostActivity).notifyCalendarRemoved(calendarPos); } else if (hostActivity instanceof CalendarViewActivity) { Intent resultData = new Intent(); resultData.putExtra(CalendarListActivity.EXTRA_RESULT_CAL_REMOVED, calendarPos); hostActivity.setResult(Activity.RESULT_OK, resultData); hostActivity.finish(); } else { throw new RuntimeException( "CalendarViewFragment may only be contained in either CalendarListActivity or CalendarViewActivity."); } } }); builder.show(); } }); return rootView; }