Example usage for android.app DialogFragment setShowsDialog

List of usage examples for android.app DialogFragment setShowsDialog

Introduction

In this page you can find the example usage for android.app DialogFragment setShowsDialog.

Prototype

public void setShowsDialog(boolean showsDialog) 

Source Link

Document

Controls whether this fragment should be shown in a dialog.

Usage

From source file:com.notriddle.budget.EnvelopesActivity.java

private void configureFragment(Fragment frag) {
    ActionBar ab = getActionBar();//from  w w  w  . java 2  s . c o  m
    if (frag instanceof TitleFragment) {
        TitleFragment tFrag = (TitleFragment) frag;
        setTitle(tFrag.getTitle());
        ab.setTitle(getTitle());
        boolean isTopLevel = false;
        for (int i = 0; i != mNavAdapter.getCount(); ++i) {
            if (mNavAdapter.getItem(i) == frag.getClass()) {
                mNavDrawer.setItemChecked(i, true);
                isTopLevel = true;
                break;
            } else {
                mNavDrawer.setItemChecked(i, false);
            }
        }
        mNavToggle.setDrawerIndicatorEnabled(isTopLevel);
    } else {
        throw new Error("Top-level fragment must be a TitleFragment");
    }
    if (frag instanceof DialogFragment) {
        DialogFragment dFrag = (DialogFragment) frag;
        dFrag.setShowsDialog(false);
    }
    if (frag instanceof ColorFragment) {
        ColorFragment cFrag = (ColorFragment) frag;
        onColorChange(cFrag.getColor());
    } else {
        onColorChange(0);
    }
    if (frag instanceof CustomActionBarFragment) {
        CustomActionBarFragment cFrag = (CustomActionBarFragment) frag;
        mCustomActionBarView = cFrag.onCreateActionBarView(getLayoutInflater());
        ab.setCustomView(mCustomActionBarView);
        ab.setDisplayShowTitleEnabled(false);
        ab.setDisplayShowCustomEnabled(true);
    } else {
        mCustomActionBarView = null;
        ab.setDisplayShowTitleEnabled(true);
        ab.setDisplayShowCustomEnabled(false);
        ab.setCustomView(null);
    }
}