Search in sources :

Example 26 with DialogFragment

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");
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 27 with DialogFragment

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();
}
Also used : AlertDialog(android.app.AlertDialog) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) DialogInterface(android.content.DialogInterface) Bundle(android.os.Bundle) Paint(android.graphics.Paint) FragmentTransaction(android.support.v4.app.FragmentTransaction) OnClickListener(android.content.DialogInterface.OnClickListener) CompoundButton(android.widget.CompoundButton)

Example 28 with DialogFragment

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) DialogFragment(android.support.v4.app.DialogFragment) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 29 with DialogFragment

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");
}
Also used : SherlockDialogFragment(com.actionbarsherlock.app.SherlockDialogFragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 30 with DialogFragment

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());
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Dialog(android.app.Dialog) ShadowDialog(org.robolectric.shadows.ShadowDialog) Test(org.junit.Test)

Aggregations

DialogFragment (android.support.v4.app.DialogFragment)73 Fragment (android.support.v4.app.Fragment)29 FragmentTransaction (android.support.v4.app.FragmentTransaction)21 FragmentManager (android.support.v4.app.FragmentManager)9 Bundle (android.os.Bundle)8 View (android.view.View)8 SherlockDialogFragment (com.actionbarsherlock.app.SherlockDialogFragment)8 TextView (android.widget.TextView)7 AlertDialog (android.app.AlertDialog)5 DialogInterface (android.content.DialogInterface)4 OnClickListener (android.content.DialogInterface.OnClickListener)4 Intent (android.content.Intent)4 ListFragment (android.support.v4.app.ListFragment)4 AppCompatDialogFragment (android.support.v7.app.AppCompatDialogFragment)4 OnClickListener (android.view.View.OnClickListener)4 Button (android.widget.Button)4 ItemPinnedMessageDialogFragment (com.h6ah4i.android.example.advrecyclerview.common.fragment.ItemPinnedMessageDialogFragment)4 ProgressDialogFragment (com.wada811.android.dialogfragments.material.ProgressDialogFragment)4 Dialog (android.app.Dialog)3 ProgressDialogFragment (com.wada811.android.dialogfragments.traditional.ProgressDialogFragment)3