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

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

Introduction

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

Prototype

final public Bundle getArguments() 

Source Link

Document

Return the arguments supplied to #setArguments , if any.

Usage

From source file:nz.ac.otago.psyanlab.common.designer.subject.EditQuestionDialogueFragment.java

public static DialogFragment newDialogue(long questionId, boolean isNew) {
    DialogFragment f = newDialogue(questionId);
    Bundle args = f.getArguments();
    args.putBoolean(ARG_IS_NEW, isNew);//www . j a  v  a 2s  . c  o  m
    f.setArguments(args);
    return f;
}

From source file:com.ereinecke.eatsafe.MainActivity.java

@Override
public void onDialogPositiveClick(DialogFragment dialog) {
    // User touched the dialog's positive button
    Bundle args = dialog.getArguments();
    if (args == null) {
        // Logd(LOG_TAG,"No args found in dialog intent");
        return;//from  ww  w  . j ava  2  s.co m
    }
    String dialogType = args.getString(Constants.DIALOG_TYPE);
    Logd(LOG_TAG, "Positive click on [" + dialogType + "]");
    assert dialogType != null;
    switch (dialogType) {
    case Constants.DIALOG_DELETE:
        String barcode = args.getString(Constants.BARCODE_KEY);
        Logd(LOG_TAG, "to delete item#: " + barcode);
        deleteItem(barcode);
        break;

    case Constants.DIALOG_UPLOAD:
        launchUploadFragment(barcodeRequested);
        break;

    default:
        break;
    }
}

From source file:com.vegnab.vegnab.MainVNActivity.java

public void onUnHideVisitConfirm(DialogFragment dialog) {
    if (LDebug.ON)
        Log.d(LOG_TAG, "onUnHideVisitConfirm(DialogFragment dialog)");
    Bundle args = dialog.getArguments();
    long recIdToUnhide = args.getLong(UnHideVisitDialog.ARG_VISIT_ID_TO_UNHIDE);
    NewVisitFragment nvFrag = (NewVisitFragment) getSupportFragmentManager().findFragmentByTag(Tags.NEW_VISIT);
    nvFrag.setVisitVisibility(recIdToUnhide, true); // fn refreshes lists
}

From source file:com.vegnab.vegnab.MainVNActivity.java

public void onDeleteVegItemConfirm(DialogFragment dialog) {
    if (LDebug.ON)
        Log.d(LOG_TAG, "onDeleteVegItemConfirm(DialogFragment dialog)");
    Bundle args = dialog.getArguments();
    long recIdToDelete = args.getLong(ConfirmDelVegItemDialog.ARG_VI_REC_ID);
    DataEntryContainerFragment dataEntryFrag = (DataEntryContainerFragment) getSupportFragmentManager()
            .findFragmentByTag(Tags.DATA_SCREENS_CONTAINER);

    int index = dataEntryFrag.mDataScreenPager.getCurrentItem();
    DataEntryContainerFragment.dataPagerAdapter ad = ((DataEntryContainerFragment.dataPagerAdapter) dataEntryFrag.mDataScreenPager
            .getAdapter());/*  ww  w . ja v a2s  .  com*/
    Fragment f = ad.getFragment(index);
    // fix this up when AuxData implemented, to make sure the class of fragment
    try {
        VegSubplotFragment vf = (VegSubplotFragment) f;
        vf.deleteVegItem(recIdToDelete);
    } catch (ClassCastException e) {
        // if not the right class of fragment, fail silently
    }
}

From source file:com.vegnab.vegnab.MainVNActivity.java

@Override
public void onConfigurableEditComplete(DialogFragment dialog) {
    if (LDebug.ON)
        Log.d(LOG_TAG, "onConfigurableEditComplete(DialogFragment dialog)");
    // get parameter(s) from dialog
    Bundle args = dialog.getArguments();
    // switch out task based on where called from
    String UriTarget = args.getString(ConfigurableEditDialog.ITEM_URI_TARGET);
    // make work with Projects too
    VisitHeaderFragment visHdrFragment = (VisitHeaderFragment) getSupportFragmentManager()
            .findFragmentByTag(Tags.VISIT_HEADER);
    if (visHdrFragment != null) {
        try {//from  w w w.  j av a  2s.c o m
            if (UriTarget == "namers") {
                visHdrFragment.refreshNamerSpinner();
            }
        } catch (Exception e) {
            // screen rotates may destroy some objects & cause null pointer exceptions
            // refresh will occur when fragments rebuilt
            if (LDebug.ON)
                Log.d(LOG_TAG, "exception: " + e.getMessage());
        }
    }
    EditPlaceholderFragment editPhFragment = (EditPlaceholderFragment) getSupportFragmentManager()
            .findFragmentByTag(Tags.EDIT_PLACEHOLDER);
    if (editPhFragment != null) {
        try {
            if (UriTarget == "idnamers") {
                editPhFragment.refreshIdNamerSpinner();
            }
            if (UriTarget == "idrefs") {
                editPhFragment.refreshIdRefSpinner();
            }
            if (UriTarget == "idmethods") {
                editPhFragment.refreshIdMethodSpinner();
            }
        } catch (Exception e) {
            if (LDebug.ON)
                Log.d(LOG_TAG, "exception: " + e.getMessage());
        }
    }
}