Example usage for android.app DialogFragment show

List of usage examples for android.app DialogFragment show

Introduction

In this page you can find the example usage for android.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.avapira.bobroreader.Bober.java

@Override
public void onOpenPost(String board, int postDisplayId) {
    DialogFragment postDialog = PostDialogFragment.newInstance(board, postDisplayId);
    postDialog.show(getFragmentManager(), null);
}

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

private void showStateProgressDialog(String details) {
    DialogFragment df = new StateProgressDialogFragment();
    Bundle args = new Bundle();
    args.putString("details", details);
    df.setArguments(args);/*from   w  ww  .  ja  va 2s  .  com*/
    df.setCancelable(false);
    df.show(getFragmentManager(), "state_progress_dialog");
    mStateProgressDialog = df;
}

From source file:com.dnielfe.manager.AppManager.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        finish();/*w ww .  ja v a  2  s.com*/
        return true;
    case R.id.shortcut:
        createshortcut();
        return true;
    case R.id.deleteapps:
        final DialogFragment dialog1 = DeleteFilesDialog
                .instantiate(new String[] { SimpleExplorer.BACKUP_LOC });
        dialog1.show(getFragmentManager(), "dialog");
        return true;
    case R.id.actionselect:
        if (multiSelectData.size() < mAppList.size())
            selectAll();
        else
            unselectAll();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.dnielfe.manager.Browser.java

private void listItemAction(File file) {
    String item_ext = FilenameUtils.getExtension(file.getName());

    if (item_ext.equalsIgnoreCase("zip") || item_ext.equalsIgnoreCase("rar")) {
        final DialogFragment dialog = UnpackDialog.instantiate(file);
        dialog.show(fm, TAG_DIALOG);
    } else {//from  w w  w .jav a2s.  c  o m
        SimpleUtils.openFile(this, file);
    }
}

From source file:com.licenta.android.licenseapp.activity.MainTabActivity.java

public void showPinDialog(boolean dismissAlarm) {
    // Create the fragment and show it as a dialog.
    DialogFragment dialog = PinDialogFragment.newInstance("",
            dismissAlarm ? getString(R.string.enter_pin_to_dismiss_alarm)
                    : getString(R.string.enter_pin_to_cancel_alert),
            dismissAlarm);/*from   ww  w .java  2s .c  om*/
    dialog.show(getFragmentManager(), "pin_dialog");
}

From source file:com.esri.cordova.geolocation.AdvancedGeolocation.java

/**
 * For working with pre-Android M security permissions
 * @param gpsEnabled If the cacheManifest and system allow gps
 * @param networkLocationEnabled If the cacheManifest and system allow network location access
 * @param cellularEnabled If the cacheManifest and system allow cellular data access
 *///from  ww w .  ja  v a2s. com
private void alertDialog(boolean gpsEnabled, boolean networkLocationEnabled, boolean cellularEnabled) {

    if (!gpsEnabled || !networkLocationEnabled) {
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.LOCATION_SERVICES_UNAVAILABLE()));

        final DialogFragment gpsFragment = new GPSAlertDialogFragment();
        gpsFragment.show(_cordovaActivity.getFragmentManager(), "GPSAlert");
    }

    if (!cellularEnabled) {
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.CELL_DATA_NOT_AVAILABLE()));

        final DialogFragment networkUnavailableFragment = new NetworkUnavailableDialogFragment();
        networkUnavailableFragment.show(_cordovaActivity.getFragmentManager(), "NetworkUnavailableAlert");
    }
}

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

private void showSyncProgressDialog() {
    String details;/*from  w w  w .j a va  2s . com*/

    switch (mWalletService.getSyncState()) {
    case CREATED:
        details = mRes.getString(R.string.sync_details_created);
        break;
    case RESTORE:
        details = mRes.getString(R.string.sync_details_restore);
        break;
    case STARTUP:
        details = mRes.getString(R.string.sync_details_startup);
        break;
    case RESCAN:
        details = mRes.getString(R.string.sync_details_rescan);
        break;
    case RERESCAN:
        details = mRes.getString(R.string.sync_details_rerescan);
        break;
    default:
        details = "???"; // Shouldn't happen
        break;
    }

    DialogFragment df = new SyncProgressDialogFragment();
    Bundle args = new Bundle();
    args.putString("details", details);
    df.setArguments(args);
    df.setCancelable(false);
    df.show(getFragmentManager(), "sync_progress_dialog");
    mSyncProgressDialog = df;
}

From source file:com.dnielfe.manager.Browser.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        if (mDrawerLayout.isDrawerOpen(mDrawer)) {
            mDrawerLayout.closeDrawer(mDrawer);
        } else {//ww  w  .  j  a  v  a2  s .  co m
            mDrawerLayout.openDrawer(mDrawer);
        }
        return true;
    case R.id.createfile:
        final DialogFragment dialog1 = new CreateFileDialog();
        dialog1.show(fm, TAG_DIALOG);
        return true;
    case R.id.createfolder:
        final DialogFragment dialog2 = new CreateFolderDialog();
        dialog2.show(fm, TAG_DIALOG);
        return true;
    case R.id.folderinfo:
        final DialogFragment dirInfo = new DirectoryInfoDialog();
        dirInfo.show(fm, TAG_DIALOG);
        return true;
    case R.id.search:
        Intent sintent = new Intent(Browser.this, SearchActivity.class);
        startActivity(sintent);
        return true;
    case R.id.paste:
        final PasteTaskExecutor ptc = new PasteTaskExecutor(this, mCurrentPath);
        ptc.start();
        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.android.medisolv.RegistrationActivity.java

public void addListenerOnButton() {

    dob = (EditText) findViewById(R.id.reg_dob);

    dob.setOnClickListener(new View.OnClickListener() {

        @Override/*w  w w .j ava 2 s. co  m*/
        public void onClick(View v) {

            // Initialize a new date picker dialog fragment
            DialogFragment dFragment = new DatePickerFragment();

            // Show the date picker dialog fragment
            dFragment.show(getFragmentManager(), "Date Picker");

        }

    });

}

From source file:org.apps8os.motivator.ui.MoodHistoryActivity.java

/**
 * Actions for the menu items.//from w w  w. ja  va2  s  .  c o m
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    MoodHistoryWeekFragment weekFragment;
    switch (item.getItemId()) {
    // Search functionality for the search button
    case R.id.mood_history_search:
        // Spawn a dialog fragment so that the user can select a day.
        DialogFragment dialog = new DatePickerFragment();
        dialog.show(getFragmentManager(), "datePicker");
        return true;
    case R.id.mood_history_attribute_drinking:
        // Setting the selected attribute in landscape view.
        mSelectedAttribute = DayInHistory.AMOUNT_OF_DRINKS;
        weekFragment = mPagerAdapterWeek.getWeekFragment(mViewPager.getCurrentItem());
        weekFragment.updateSelectedAttribute(DayInHistory.AMOUNT_OF_DRINKS, false);
        return true;
    case R.id.mood_history_attribute_moods:
        mSelectedAttribute = DayInHistory.MOODS;
        weekFragment = mPagerAdapterWeek.getWeekFragment(mViewPager.getCurrentItem());
        weekFragment.updateSelectedAttribute(DayInHistory.MOODS, false);
        return true;
    case R.id.mood_history_change_sprint:
        // Spawn a dialog where the user can select the sprint depicted in this history.
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        final Sprint[] sprints = new SprintDataHandler(this).getSprints();

        // Get the string representations of the sprints.
        String[] sprintsAsString = new String[sprints.length];
        for (int i = 0; i < sprints.length; i++) {
            sprintsAsString[i] = sprints[i].getSprintTitle() + " " + sprints[i].getStartTimeInString(this);
        }
        builder.setTitle(getString(R.string.select_sprint)).setSingleChoiceItems(sprintsAsString,
                sprints.length - 1, null);
        final AlertDialog alertDialog = builder.create();
        final Activity thisActivity = this;
        alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.ok),
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Start this activity again with the selected sprint as the passed Parcelable Sprint.
                        // This is done so that the activity can update itself to the selected sprint.
                        mCurrentSprint = sprints[alertDialog.getListView().getCheckedItemPosition()];
                        Intent intent = new Intent(thisActivity, MoodHistoryActivity.class);
                        intent.putExtra(Sprint.CURRENT_SPRINT, mCurrentSprint);
                        startActivity(intent);
                        alertDialog.dismiss();
                        thisActivity.finish();
                    }
                });
        alertDialog.show();
    default:
        return super.onOptionsItemSelected(item);
    }
}