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.morlunk.mumbleclient.channel.actionmode.ChannelActionModeCallback.java

@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    boolean adding = false;
    switch (menuItem.getItemId()) {
    case R.id.context_channel_join:
        try {/*from   w ww  .j a v  a 2  s  .  c o m*/
            mService.joinChannel(mChannel.getId());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        break;
    case R.id.context_channel_add:
        adding = true;
    case R.id.context_channel_edit:
        ChannelEditFragment addFragment = new ChannelEditFragment();
        Bundle args = new Bundle();
        if (adding)
            args.putInt("parent", mChannel.getId());
        else
            args.putInt("channel", mChannel.getId());
        args.putBoolean("adding", adding);
        addFragment.setArguments(args);
        addFragment.show(mFragmentManager, "ChannelAdd");
        break;
    case R.id.context_channel_remove:
        AlertDialog.Builder adb = new AlertDialog.Builder(mContext);
        adb.setTitle(R.string.confirm);
        adb.setMessage(R.string.confirm_delete_channel);
        adb.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                try {
                    mService.removeChannel(mChannel.getId());
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        });
        adb.setNegativeButton(android.R.string.cancel, null);
        adb.show();
        break;
    case R.id.context_channel_view_description:
        Bundle commentArgs = new Bundle();
        commentArgs.putInt("channel", mChannel.getId());
        commentArgs.putString("comment", mChannel.getDescription());
        commentArgs.putBoolean("editing", false);
        DialogFragment commentFragment = (DialogFragment) Fragment.instantiate(mContext,
                ChannelDescriptionFragment.class.getName(), commentArgs);
        commentFragment.show(mFragmentManager, ChannelDescriptionFragment.class.getName());
        break;
    case R.id.context_channel_pin:
        try {
            long serverId = mService.getConnectedServer().getId();
            boolean pinned = mDatabase.isChannelPinned(serverId, mChannel.getId());
            if (!pinned)
                mDatabase.addPinnedChannel(serverId, mChannel.getId());
            else
                mDatabase.removePinnedChannel(serverId, mChannel.getId());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        break;
    }
    actionMode.finish();
    return true;
}

From source file:com.remdo.app.EditDeviceActivity.java

public void onClick(View v) {

    if (checkFields()) {
        switch (v.getId()) {
        case R.id.button_accept:
            View editText1 = (EditText) findViewById(R.id.edit_devicename);
            View editText2 = (EditText) findViewById(R.id.edit_host);
            View editText3 = (EditText) findViewById(R.id.edit_user);
            View editText4 = (EditText) findViewById(R.id.edit_password);
            String myEditText1 = ((TextView) editText1).getText().toString();
            String myEditText2 = ((TextView) editText2).getText().toString();
            String myEditText3 = ((TextView) editText3).getText().toString();
            String myEditText4 = ((TextView) editText4).getText().toString();

            if (currentDevice == null)
                currentDevice = new Device();

            currentDevice.name = myEditText1;
            currentDevice.url = myEditText2;
            currentDevice.usr = myEditText3;
            currentDevice.pwd = myEditText4;
            currentDevice.location = location;
            currentDevice.odType = deviceType;

            try {
                if (EditMode == false) {
                    this.dh.createDevice(currentDevice);
                } else {
                    int result = this.dh.updateDevice(currentDevice);

                }//  w  w w  .j  a v a  2s .  c o  m
            }

            catch (Exception ex) {
                String msg = ex.getMessage();
            }

            break;

        }
        if (EditMode == false) {
            DialogFragment newdialog = new AddNewDeviceFragment();
            newdialog.show(getSupportFragmentManager(), "newdevice");
        } else {
            Intent intent = new Intent(this, MainActivity.class);
            startActivity(intent);
        }

    }
}

From source file:com.king.base.BaseActivity.java

public void showDialogFragment(DialogFragment dialogFragment, String tag) {
    dialogFragment.show(getSupportFragmentManager(), tag);
}

From source file:com.gh4a.activities.IssueMilestoneEditActivity.java

@Override
public void onClick(View view) {
    if (view.getId() == R.id.due_container) {
        DialogFragment newFragment = new DatePickerFragment();
        newFragment.show(getSupportFragmentManager(), "datePicker");
    } else if (view instanceof FloatingActionButton) {
        String title = mTitleView.getText().toString();
        String desc = mDescriptionView.getText() != null ? mDescriptionView.getText().toString() : null;

        mMilestone.setTitle(title);/*  www. j  a  v a 2  s . c  o  m*/
        mMilestone.setDescription(desc);
        new SaveIssueMilestoneTask(mMilestone).schedule();
    }
}

From source file:com.plined.liftlog.MainMenuFragment.java

protected void launchDialogFragment(DialogFragment dialogToShow, String dialogTag) {
    //Get our fragment manager
    FragmentManager fm = getActivity().getSupportFragmentManager();

    //Show it./*from  w w  w.  j  a v  a  2s .co  m*/
    dialogToShow.show(fm, dialogTag);
}

From source file:com.ohso.omgubuntu.ArticleActivity.java

private void refreshArticle() {
    if (currentArticle == null || activeArticle == null) {
        DialogFragment fragment = new RareBugFragment();
        fragment.show(getSupportFragmentManager(), "article_activity_bug");
    } else {/*from   www.  j a  va2  s . co  m*/
        refresh.setActionView(R.layout.refresh_menu_item);
        currentArticle.getLatest(this, activeArticle);
    }
}

From source file:de.blau.android.prefs.PrefEditorFragment.java

@Override
public void onDisplayPreferenceDialog(Preference preference) {
    DialogFragment fragment;
    if (preference instanceof MultiSelectListPreference) {
        fragment = MultiSelectListPreferenceDialogFragment.newInstance(preference.getKey());
        fragment.setTargetFragment(this, 0);
        fragment.show(getFragmentManager(), "android.support.v7.preference.PreferenceFragment.MULTISELECTLIST");
    } else/* w w  w. jav  a 2s . co m*/
        super.onDisplayPreferenceDialog(preference);
}

From source file:com.bonsai.wallet32.RestoreWalletActivity.java

private void showErrorDialog(String msg) {
    DialogFragment df = new ErrorDialogFragment();
    Bundle args = new Bundle();
    args.putString("msg", msg);
    df.setArguments(args);//  w w  w . j ava  2 s .  c o m
    df.show(getSupportFragmentManager(), "error");
}

From source file:com.coinblesk.client.backup.BackupDialogFragment.java

private void showBackupCompletedDialog(File backupFile) {
    FragmentManager fm = getFragmentManager();
    DialogFragment newFragment = BackupCompletedDialogFragment.newInstance(backupFile.getAbsolutePath());
    newFragment.show(fm, "backup_completed_dialog");
}

From source file:com.actionbarsherlock.sample.hcgallery.MainActivity.java

void showDialog(String text) {
    // DialogFragment.show() will take care of adding the fragment
    // in a transaction.  We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

    DialogFragment newFragment = MyDialogFragment.newInstance(text);

    // Show the dialog.
    newFragment.show(ft, "dialog");
}