use of android.app.DialogFragment in project k-9 by k9mail.
the class MessageViewFragment method removeDialog.
private void removeDialog(int dialogId) {
FragmentManager fm = getFragmentManager();
if (fm == null || isRemoving() || isDetached()) {
return;
}
// Make sure the "show dialog" transaction has been processed when we call
// findFragmentByTag() below. Otherwise the fragment won't be found and the dialog will
// never be dismissed.
fm.executePendingTransactions();
DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(getDialogTag(dialogId));
if (fragment != null) {
fragment.dismiss();
}
}
use of android.app.DialogFragment in project k-9 by k9mail.
the class MessageViewFragment method showDialog.
private void showDialog(int dialogId) {
DialogFragment fragment;
switch(dialogId) {
case R.id.dialog_confirm_delete:
{
String title = getString(R.string.dialog_confirm_delete_title);
String message = getString(R.string.dialog_confirm_delete_message);
String confirmText = getString(R.string.dialog_confirm_delete_confirm_button);
String cancelText = getString(R.string.dialog_confirm_delete_cancel_button);
fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
break;
}
case R.id.dialog_confirm_spam:
{
String title = getString(R.string.dialog_confirm_spam_title);
String message = getResources().getQuantityString(R.plurals.dialog_confirm_spam_message, 1);
String confirmText = getString(R.string.dialog_confirm_spam_confirm_button);
String cancelText = getString(R.string.dialog_confirm_spam_cancel_button);
fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
break;
}
case R.id.dialog_attachment_progress:
{
String message = getString(R.string.dialog_attachment_progress_title);
fragment = ProgressDialogFragment.newInstance(null, message);
break;
}
default:
{
throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
}
}
fragment.setTargetFragment(this, dialogId);
fragment.show(getFragmentManager(), getDialogTag(dialogId));
}
use of android.app.DialogFragment in project BeyondUPnP by kevinshine.
the class MainActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_select) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG);
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
DialogFragment newFragment = DeviceListDialogFragment.newInstance();
newFragment.show(ft, DIALOG_FRAGMENT_TAG);
}
return super.onOptionsItemSelected(item);
}
use of android.app.DialogFragment in project coursera-android by aporter.
the class TimePickerFragmentActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Capture UI elements
mTimeDisplay = (TextView) findViewById(R.id.timeDisplay);
mPickTime = (Button) findViewById(R.id.pickTime);
// Set an OnClickListener for the Change the Time Button
mPickTime.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Create a new DatePickerFragment
DialogFragment newFragment = new TimePickerFragment();
// Display DatePickerFragment
newFragment.show(getFragmentManager(), "TimePicker");
}
});
}
use of android.app.DialogFragment in project cardslib by gabrielemariotti.
the class MainNativeActivity method openDialogFragment.
private void openDialogFragment(DialogFragment dialogStandardFragment) {
if (dialogStandardFragment != null) {
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag("carddemo_dialog");
if (prev != null) {
ft.remove(prev);
}
//ft.addToBackStack(null);
dialogStandardFragment.show(ft, "carddemo_dialog");
}
}
Aggregations