Example usage for android.support.v4.app DialogFragment show

List of usage examples for android.support.v4.app DialogFragment show

Introduction

In this page you can find the example usage for android.support.v4.app DialogFragment show.

Prototype

public int show(FragmentTransaction transaction, String tag) 

Source Link

Document

Display the dialog, adding the fragment using an existing transaction and then committing the transaction.

Usage

From source file:com.simplaapliko.apprater.sample.MainActivityFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_main, container, false);

    Button showDialog = (Button) view.findViewById(R.id.show_dialog);
    showDialog.setOnClickListener(new View.OnClickListener() {
        @Override//w w w.  ja  v  a2s .c  om
        public void onClick(View v) {

            DialogFragment dialog = new RateAppDialog.Builder().build();

            ((RateAppDialog) dialog).setOnPositiveButtonListener(MainActivityFragment.this);
            ((RateAppDialog) dialog).setOnNegativeButtonListener(MainActivityFragment.this);
            ((RateAppDialog) dialog).setOnNeutralButtonListener(MainActivityFragment.this);

            dialog.show(getFragmentManager(), RateAppDialog.class.getSimpleName());
        }
    });

    return view;
}

From source file:info.wncwaterfalls.app.MainActivity.java

@Override
protected void onResume() {
    super.onResume();
    if (googlePlayServicesAvailable()) {
        // Determine if the expansion files have been downloaded
        // Do this in the else of the above check because it's irrelevant if
        // Play Services aren't available.
        SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
        boolean userPrefPauseDownload = settings.getBoolean(USER_PREF_PAUSE_DOWNLOAD, false);
        if (!ExpansionDownloaderService.expansionFilesDownloaded(this)) {
            // Warn user about offline maps.
            if (!userPrefPauseDownload) {
                DialogFragment expansionDownloaderDialogFragment = new ExpansionDownloaderDialogFragment();
                expansionDownloaderDialogFragment.show(getSupportFragmentManager(),
                        "expansionDownloaderDialogFragment");
            } else {
                // TODO: We should probably not show this repeatedly.
                Toast.makeText(getApplicationContext(),
                        "Offline maps not available. Open App Info to download.", Toast.LENGTH_LONG).show();
            }/* www  .  j a v a  2  s.c  o  m*/
        }
    } else {
        // Disable Search by Location button
        Button searchLocationButton = (Button) findViewById(R.id.main_btn_search_location);
        if (searchLocationButton != null) {
            searchLocationButton.setClickable(false);
            searchLocationButton.setEnabled(false);
        }
    }
}

From source file:com.bonsai.btcreceive.BaseWalletActivity.java

protected DialogFragment showModalDialog(String msg) {
    DialogFragment df = new MyDialogFragment();
    Bundle args = new Bundle();
    args.putString("msg", msg);
    args.putBoolean("hasOK", false);
    df.setArguments(args);//www. j a  va2 s .  com
    df.show(getSupportFragmentManager(), "note");
    return df;
}

From source file:com.amansoni.tripbook.activity.AddItemActivity.java

public void showTimePickerDialog(View v) {
    DialogFragment newFragment = new TimePickerFragment();
    newFragment.show(getSupportFragmentManager(), "timePicker");
}

From source file:com.battlelancer.seriesguide.backend.CloudSetupFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_cloud_setup, container, false);

    mTextViewDescription = (TextView) v.findViewById(R.id.textViewCloudDescription);
    mTextViewWarning = ButterKnife.findById(v, R.id.textViewCloudWarnings);
    mProgressBar = (ProgressBar) v.findViewById(R.id.progressBarCloud);
    mButtonAction = (Button) v.findViewById(R.id.buttonCloudAction);
    mButtonRemoveAccount = ButterKnife.findById(v, R.id.buttonCloudRemoveAccount);
    mButtonRemoveAccount.setOnClickListener(new View.OnClickListener() {
        @Override/*from  www  . j a  va2  s  .  c o  m*/
        public void onClick(View v) {
            DialogFragment f = new RemoveCloudAccountDialogFragment();
            f.show(getFragmentManager(), "remove-cloud-account");
        }
    });

    return v;
}

From source file:com.amansoni.tripbook.activity.AddItemActivity.java

public void showDatePickerDialog(View v) {
    mCurrentDate = (TextView) v;/*from   w w  w.j  a v a2  s. c  om*/
    DialogFragment newFragment = new DatePickerFragment();
    newFragment.show(getSupportFragmentManager(), "datePicker");
}

From source file:com.androidformenhancer.sample.demos.SampleFragment.java

public void showDialogFragment(final DialogFragment dialogFragment) {
    FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
    Fragment prev = getActivity().getSupportFragmentManager().findFragmentByTag(DIALOG_TAG);
    if (prev != null) {
        ft.remove(prev);//  w ww . j  a v a2 s  .co m
    }
    if (dialogFragment != null) {
        dialogFragment.show(ft, DIALOG_TAG);
    }
}

From source file:com.intervigil.micdroid.MainActivity.java

@Override
public void onRecorderStopped() {
    DialogFragment nameEntryFragment = new NameEntryDialogFragment();
    nameEntryFragment.show(getSupportFragmentManager(), "nameEntry");
}

From source file:com.example.scheme.MyPalettesActivity.java

public void showRenameDialog() {
    DialogFragment dialog = new RenameDialogFragment();
    dialog.show(getSupportFragmentManager(), "RenameDialogFragment");
}

From source file:com.king.base.BaseFragment.java

public void showDialogFragment(DialogFragment dialogFragment, String tag) {
    dialogFragment.show(getFragmentManager(), tag);
}