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.ongtonnesoup.permissions.PerMissionsResultHandlerImpl.java

@Override
public void onPermissionExplain(final String[] permissions, final PerMissionsFlows flows) {
    if (disableExplanationDialogs) {
        handler.handlePermissionRequest(permissions, flows, true);
    } else {/*ww  w  .  ja  v  a  2  s . c  om*/
        String title = resources.getString(R.string.permissions_title_explanation);
        String message = getExplanationString(permissions);
        DialogFragment dialog = dialogBuilder.build(title, message, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                handler.handlePermissionRequest(permissions, flows, true);
            }
        });
        dialog.show(fragmentManager, TAG_EXPLAIN);
    }
}

From source file:de.vanita5.twittnuker.activity.support.UserListSelectorActivity.java

@Override
public void onClick(final View v) {
    switch (v.getId()) {
    case R.id.screen_name_confirm: {
        final String screen_name = parseString(mEditScreenName.getText());
        if (isEmpty(screen_name))
            return;
        searchUser(screen_name);//from  w  ww. j av a  2 s  .c o  m
        break;
    }
    case R.id.create_list: {
        final DialogFragment f = new CreateUserListDialogFragment();
        final Bundle args = new Bundle();
        args.putLong(EXTRA_ACCOUNT_ID, getAccountId());
        f.setArguments(args);
        f.show(getSupportFragmentManager(), null);
        break;
    }
    }
}

From source file:com.jaspervanriet.huntingthatproduct.Activities.MainActivity.java

private void showDatePickerDialog() {
    DialogFragment dialogFragment = new DatePickerFragment();
    dialogFragment.show(getSupportFragmentManager(), "dataPicker");
}

From source file:com.owncloud.android.files.FileOperationsHelper.java

public void sendDownloadedFile(OCFile file) {
    if (file != null) {
        String storagePath = file.getStoragePath();
        String encodedStoragePath = WebdavUtils.encodePath(storagePath);
        Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
        // set MimeType
        sendIntent.setType(file.getMimetype());
        sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + encodedStoragePath));
        sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action

        // Show dialog, without the own app
        String[] packagesToExclude = new String[] { mFileActivity.getPackageName() };
        DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude, file);
        chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);

    } else {//www .ja va 2s .c o  m
        Log_OC.wtf(TAG, "Trying to send a NULL OCFile");
    }
}

From source file:com.remotedroid.app.SelectComputerActivity.java

@Override
public void onComputerOptionClicked(int index, Computer comp) {
    if (index == 0) {
        connectForTV(comp);/* www. java  2  s . c  o m*/
    } else if (index == 1) {
        connectForChat(comp);
    } else if (index == 2) {

        DialogFragment dialog = PowerOptionsDialog.newInstance(this, comp);
        dialog.show(this.getSupportFragmentManager(), "PowerOptions");
    } else if (index == 3) {

        DialogFragment dialog = InputTextDialog.newInstance(this, "Enter Command");
        dialog.show(this.getSupportFragmentManager(), "TextInput");

    } else if (index == 4) {
        Beeper beep = new Beeper();
        beep.execute(comp.getIp().toString());
    } else if (index == 5) {
        connectForMouse(comp);
    }
}

From source file:net.czlee.debatekeeper.PrepTimeBellsEditActivity.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.prepTimeBellsEditor_contextMenu_edit:
        Bundle args = mPtbm.getBellBundle(info.position);
        args.putInt(KEY_INDEX, info.position);
        DialogFragment fragment = new DialogAddOrEditBellFragment();
        fragment.setArguments(args);/*from  ww w .  jav  a 2s .c  o m*/
        fragment.show(getSupportFragmentManager(), DIALOG_TAG_EDIT_BELL);
        return true;
    case R.id.prepTimeBellsEditor_contextMenu_delete:
        mPtbm.deleteBell(info.position);
        refreshBellsList();
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:io.vit.vitio.Fragments.TimeTable.TimeTableFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.monday_box:
        changeImageBackground(0);// w  w  w .  j a v a2 s  .  c om
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(0, true);
        }
        break;
    case R.id.tuesday_box:
        changeImageBackground(1);
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(1, true);
        }
        break;
    case R.id.wednesday_box:
        changeImageBackground(2);
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(2, true);
        }
        break;
    case R.id.thursday_box:
        changeImageBackground(3);
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(3, true);
        }
        break;
    case R.id.friday_box:
        changeImageBackground(4);
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(4, true);
        }
        break;
    case R.id.saturday_box:
        changeImageBackground(5);
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(5, true);
        }
        break;
    case R.id.calender_icon:
        DialogFragment newFragment = new DatePickerFragment(this);
        newFragment.show(getChildFragmentManager(), "datePicker");
        break;
    default:
        changeImageBackground(0);
        if (adapter != null) {
            myTimeTablePager.setCurrentItem(0, true);
        }
    }
}

From source file:com.ongtonnesoup.permissions.PerMissionsResultHandlerImpl.java

@Override
public void onPermissionDenied(final String[] permissions, final PerMissionsDeniedFlow flow) {
    if (disableDeniedDialogs) {
        if (flow != null) {
            flow.run();//w  w w .j  a  va2 s.c om
        }
    } else {
        String title = resources.getString(R.string.permission_title_denied);
        String message = getDeniedString(permissions);
        DialogFragment dialog = dialogBuilder.build(title, message, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (flow != null) {
                    flow.run();
                }
            }
        });
        dialog.show(fragmentManager, TAG_DENIED);
    }
}

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

public void showEditDialog(int color, int pos) {

    DialogFragment dialog = new EditDialogFragment();

    ((EditDialogFragment) dialog).setColorSelection(color);
    ((EditDialogFragment) dialog).setColorPos(pos);
    dialog.show(getSupportFragmentManager(), "EditDialogFragment");
}

From source file:com.sorin.cloudcog.phone.batterymeter.CurrentInfoFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_nfc:

        startActivityForResult(new Intent(android.provider.Settings.ACTION_NFC_SETTINGS), 0);

        break;/* ww w .j  ava 2 s.c  o  m*/
    case R.id.action_usb:
        startActivityForResult(new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS),
                0);

        break;
    case R.id.action_wifi:

        startActivityForResult(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS), 0);

        break;
    case R.id.action_location:

        startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);

        break;

    case R.id.action_bluetooth:
        startActivityForResult(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS), 0);

        break;
    case R.id.action_cosm_web:
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.xively.com"));
        startActivity(browserIntent);

        break;
    case R.id.menu_settings:
        mStartActivity(SettingsActivity.class);
        return true;
    case R.id.menu_close:
        DialogFragment df = new ConfirmCloseDialogFragment();
        df.show(getFragmentManager(), "TODO: What is this string for?2");
        return true;

    case R.id.menu_rate_and_review:
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.sorin.cloudcog")));
        } catch (Exception e) {
            Toast.makeText(activity.getApplicationContext(), "Sorry, can't launch Market!", Toast.LENGTH_SHORT)
                    .show();
        }
        return true;

    default:
    }

    return super.onOptionsItemSelected(item);
}