Example usage for android.app DialogFragment setArguments

List of usage examples for android.app DialogFragment setArguments

Introduction

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

Prototype

public void setArguments(Bundle args) 

Source Link

Document

Supply the construction arguments for this fragment.

Usage

From source file:de.uulm.graphicalpasswords.openmiba.MIBACreatePasswordActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    // WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_miba_create_password);

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    rounds_to_do = Integer.parseInt(sharedPref.getString("miba_length", "1"));
    min_rounds = rounds_to_do;

    Bundle bundle = new Bundle();
    bundle.putInt("length", rounds_to_do);
    DialogFragment intro = new IntroDialogFragment();
    intro.setArguments(bundle);
    intro.show(getFragmentManager(), "intro");

    // Show the Up button in the action bar.
    setupActionBar();/*ww  w  .  j  a  v  a2s .c o  m*/

    setViews();
    seenPictureIds.add(R.drawable.ccp000);
}

From source file:me.albertonicoletti.latex.activities.EditorActivity.java

/**
 * On long clicking a document in the drawer, it shows a dialog asking what to do
 * @param view View//from w  w  w  . j  ava2  s  . c  o m
 */
@Override
public void onDocumentLongClickListener(View view) {
    TextView m = (TextView) view.findViewById(R.id.drawer_file_path);
    Bundle args = new Bundle();
    // Adds a "filename" parameter containing the filename
    args.putString("filepath", m.getText().toString());
    // Creates the dialog and adds the parameter
    DialogFragment dialog = new DocumentOptionsDialog();
    dialog.setArguments(args);
    // Opens thee dialog
    dialog.show(getFragmentManager(), "editor_drawer_longclick");
}

From source file:cz.yetanotherview.webcamviewer.app.actions.JsonFetcherDialog.java

private void showReportDialog() {
    DialogFragment reportDialog = new ReportDialog();
    Bundle bundle = new Bundle();
    bundle.putInt("newWebCams", newWebCams);
    bundle.putInt("duplicityWebCams", duplicityWebCams);
    bundle.putInt("updatedWebCams", updatedWebCams);
    reportDialog.setArguments(bundle);
    reportDialog.show(mActivity.getFragmentManager(), "ReportDialog");
}

From source file:org.alfresco.mobile.android.application.fragments.properties.DetailsFragment.java

public void openin() {
    if (isRestrictable) {
        return;//from  w w w .j av a 2s  .c om
    }

    Bundle b = new Bundle();

    // 3 cases
    SynchroManager syncManager = SynchroManager.getInstance(getActivity());
    Account acc = SessionUtils.getAccount(getActivity());

    if (syncManager.isSynced(SessionUtils.getAccount(getActivity()), node)) {
        final File syncFile = syncManager.getSyncFile(acc, node);
        if (syncFile == null || !syncFile.exists()) {
            MessengerManager.showLongToast(getActivity(), getString(R.string.sync_document_not_available));
            return;
        }
        long datetime = syncFile.lastModified();
        setDownloadDateTime(new Date(datetime));

        if (DataProtectionManager.getInstance(getActivity()).isEncryptionEnable()) {
            // IF sync file + sync activate + data protection
            ActionManager.actionView(this, syncFile, new ActionManagerListener() {
                @Override
                public void onActivityNotFoundException(ActivityNotFoundException e) {
                    OpenAsDialogFragment.newInstance(syncFile).show(getActivity().getFragmentManager(),
                            OpenAsDialogFragment.TAG);
                }
            });
        } else {
            // If sync file + sync activate
            ActionManager.openIn(this, syncFile, MimeTypeManager.getMIMEType(getActivity(), syncFile.getName()),
                    PublicIntent.REQUESTCODE_SAVE_BACK);
        }
    } else {
        // Other case
        b.putParcelable(DownloadDialogFragment.ARGUMENT_DOCUMENT, (Document) node);
        b.putInt(DownloadDialogFragment.ARGUMENT_ACTION, DownloadDialogFragment.ACTION_OPEN);
        DialogFragment frag = new DownloadDialogFragment();
        frag.setArguments(b);
        frag.show(getFragmentManager(), DownloadDialogFragment.TAG);
    }
}

From source file:org.alfresco.mobile.android.application.fragments.properties.DetailsFragment.java

public void share() {
    if (node.isFolder()) {
        return;//from w  w  w  . j  a v a2  s  .  c  om
    }

    if (node instanceof NodeSyncPlaceHolder) {
        SynchroManager syncManager = SynchroManager.getInstance(getActivity());
        Account acc = SessionUtils.getAccount(getActivity());
        final File syncFile = syncManager.getSyncFile(acc, node);
        if (syncFile == null || !syncFile.exists()) {
            MessengerManager.showLongToast(getActivity(), getString(R.string.sync_document_not_available));
            return;
        }
        long datetime = syncFile.lastModified();
        setDownloadDateTime(new Date(datetime));

        if (DataProtectionManager.getInstance(getActivity()).isEncryptionEnable()) {
            // IF sync file + sync activate + data protection
            ActionManager.actionSend(getActivity(), syncFile, new ActionManagerListener() {
                @Override
                public void onActivityNotFoundException(ActivityNotFoundException e) {
                }
            });
        } else {
            // If sync file + sync activate
            ActionManager.actionSend(getActivity(), syncFile);
        }
        return;
    }

    if (alfSession instanceof RepositorySession) {
        // Only sharing as attachment is allowed when we're not on a cloud
        // account
        Bundle b = new Bundle();
        b.putParcelable(DownloadDialogFragment.ARGUMENT_DOCUMENT, (Document) node);
        b.putInt(DownloadDialogFragment.ARGUMENT_ACTION, DownloadDialogFragment.ACTION_EMAIL);
        DialogFragment frag = new DownloadDialogFragment();
        frag.setArguments(b);
        frag.show(getFragmentManager(), DownloadDialogFragment.TAG);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.app_name);
        builder.setMessage(R.string.link_or_attach);

        builder.setPositiveButton(R.string.full_attachment, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                Bundle b = new Bundle();
                b.putParcelable(DownloadDialogFragment.ARGUMENT_DOCUMENT, (Document) node);
                b.putInt(DownloadDialogFragment.ARGUMENT_ACTION, DownloadDialogFragment.ACTION_EMAIL);
                DialogFragment frag = new DownloadDialogFragment();
                frag.setArguments(b);
                frag.show(getFragmentManager(), DownloadDialogFragment.TAG);
            }
        });
        builder.setNegativeButton(R.string.link_to_repo, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                if (parentNode != null) {
                    String path = parentNode.getPropertyValue(PropertyIds.PATH);
                    if (path.length() > 0) {
                        if (path.startsWith("/Sites/")) {
                            // Get past the '/Sites/'
                            String sub1 = path.substring(7);
                            // Find end of site name
                            int idx = sub1.indexOf('/');
                            if (idx == -1) {
                                idx = sub1.length();
                            }
                            String siteName = sub1.substring(0, idx);
                            String nodeID = NodeRefUtils.getCleanIdentifier(node.getIdentifier());
                            String fullPath = String.format(getString(R.string.cloud_share_url),
                                    ((CloudSession) alfSession).getNetwork().getIdentifier(), siteName, nodeID);
                            ActionManager.actionShareLink(DetailsFragment.this, fullPath);
                        } else {
                            Log.i(getString(R.string.app_name), "Site path not as expected: no /sites/");
                        }
                    } else {
                        Log.i(getString(R.string.app_name), "Site path not as expected: no parent path");
                    }
                } else {
                    Log.i(getString(R.string.app_name), "Site path not as expected: No parent folder");
                }

                dialog.dismiss();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    }
}

From source file:amhamogus.com.daysoff.fragments.AddEventFragment.java

@Override
public void onClick(View view) {
    Bundle args;/*  www. j  a v  a2 s  .co  m*/
    DialogFragment timePicker;

    switch (view.getId()) {
    case R.id.event_checkbox_food:
        if (((CheckBox) view).isChecked()) {
            checkedActivities[0] = "Eat a meal";
        } else {
            checkedActivities[0] = "";
        }
        break;
    case R.id.event_checkbox_movie:
        if (((CheckBox) view).isChecked()) {
            checkedActivities[1] = "Watch a movie";
        } else {
            checkedActivities[1] = "";
        }
        break;
    case R.id.event_checkbox_outdoors:
        if (((CheckBox) view).isChecked()) {
            checkedActivities[2] = "Go for a walk";
        } else {
            checkedActivities[2] = "";
        }
        break;
    case R.id.start_time_btn:
        args = new Bundle();
        args.putInt("HOUR", hour);
        args.putInt("MINUTE", minute);

        timeLabel = (TextView) view;
        timePicker = new TimePickerFragment();
        timePicker.setArguments(args);
        timePicker.setTargetFragment(this, 0);
        timePicker.show(getFragmentManager(), "timePicker");
        break;
    case R.id.end_time_btn:
        args = new Bundle();
        args.putInt("HOUR", futureHour);
        args.putInt("MINUTE", futureMinute);

        timeLabel = (TextView) view;
        timePicker = new TimePickerFragment();

        timePicker.setArguments(args);
        timePicker.setTargetFragment(this, 0);
        timePicker.show(getFragmentManager(), "timePicker");
        break;
    }
}