use of android.support.v4.app.DialogFragment in project android-support-v4-googlemaps by petedoyle.
the class FragmentDialogSupport method showDialog.
void showDialog() {
mStackLevel++;
// 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);
}
ft.addToBackStack(null);
// Create and show the dialog.
DialogFragment newFragment = MyDialogFragment.newInstance(mStackLevel);
newFragment.show(ft, "dialog");
}
use of android.support.v4.app.DialogFragment in project JamsMusicPlayer by psaravan.
the class CautionEditArtistsDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
parentActivity = getActivity();
dialogFragment = this;
EDIT_TYPE = this.getArguments().getString("EDIT_TYPE");
ARTIST = this.getArguments().getString("ARTIST");
rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.fragment_caution_edit_artists, null);
cautionText = (TextView) rootView.findViewById(R.id.caution_text);
cautionText.setText(R.string.caution_artists_text);
cautionText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
cautionText.setPaintFlags(cautionText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
sharedPreferences = getActivity().getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", false).commit();
dontShowAgainText = (TextView) rootView.findViewById(R.id.dont_show_again_text);
dontShowAgainText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
dontShowAgainText.setPaintFlags(dontShowAgainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
dontShowAgainCheckbox = (CheckBox) rootView.findViewById(R.id.dont_show_again_checkbox);
dontShowAgainCheckbox.setChecked(true);
dontShowAgainCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
if (isChecked == true) {
sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", false).commit();
} else {
sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", true).commit();
}
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//Set the dialog title.
builder.setTitle(R.string.caution);
builder.setView(rootView);
builder.setNegativeButton(R.string.no, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
dialogFragment.dismiss();
}
});
builder.setPositiveButton(R.string.yes, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
dialogFragment.dismiss();
FragmentTransaction ft = getFragmentManager().beginTransaction();
Bundle bundle = new Bundle();
bundle.putString("EDIT_TYPE", EDIT_TYPE);
bundle.putString("ARTIST", ARTIST);
ID3sArtistEditorDialog dialog = new ID3sArtistEditorDialog();
dialog.setArguments(bundle);
dialog.show(ft, "id3ArtistEditorDialog");
}
});
return builder.create();
}
use of android.support.v4.app.DialogFragment in project JamsMusicPlayer by psaravan.
the class EditGooglePlayMusicTagsDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final DialogFragment dialog = this;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//Set the dialog title.
builder.setTitle(R.string.google_play_music_no_asterisk);
builder.setMessage(getResources().getString(R.string.edit_google_play_music_tags_unsupported));
builder.setNegativeButton(R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
dialog.dismiss();
}
});
return builder.create();
}
use of android.support.v4.app.DialogFragment in project httpclient by pixmob.
the class FragmentAlertDialogSupport method showDialog.
void showDialog() {
DialogFragment newFragment = MyAlertDialogFragment.newInstance(R.string.alert_dialog_two_buttons_title);
newFragment.show(getSupportFragmentManager(), "dialog");
}
use of android.support.v4.app.DialogFragment in project robolectric by robolectric.
the class ShadowDialogFragmentTest method removeUsingTransaction_shouldDismissTheDialog.
@Test
public void removeUsingTransaction_shouldDismissTheDialog() throws Exception {
dialogFragment.show(fragmentManager, null);
FragmentTransaction t = fragmentManager.beginTransaction();
t.remove(dialogFragment);
t.commit();
Dialog dialog = ShadowDialog.getLatestDialog();
assertFalse(dialog.isShowing());
assertTrue(shadowOf(dialog).hasBeenDismissed());
}
Aggregations