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

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

Introduction

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

Prototype

public void setArguments(Bundle args) 

Source Link

Document

Supply the construction arguments for this fragment.

Usage

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  w  w . j  a  v a 2s . 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.ultrafunk.network_info.config.ConfigActivity.java

private void initMobileSettingsScreenView() {
    LinearLayout mobileSettingsScreenLinearLayout = (LinearLayout) findViewById(
            R.id.mobileSettingsScreenLinearLayout);
    onDialogSelectionChanged(widgetConfig.getMobileDataSettingsScreen());

    mobileSettingsScreenLinearLayout.setOnClickListener(new View.OnClickListener() {
        @Override/*from   ww w  .ja va 2 s .  c  o m*/
        public void onClick(View view) {
            DialogFragment dialogFragment = new SettingsScreenDialogFragment();

            Bundle bundle = new Bundle();
            bundle.putInt(Constants.PREF_MOBILE_DATA_SETTINGS_SCREEN,
                    widgetConfig.getMobileDataSettingsScreen());
            dialogFragment.setArguments(bundle);
            dialogFragment.show(getSupportFragmentManager(), "SettingsScreenDialogFragment");
        }
    });
}

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);
        fragment.show(getSupportFragmentManager(), DIALOG_TAG_EDIT_BELL);
        return true;
    case R.id.prepTimeBellsEditor_contextMenu_delete:
        mPtbm.deleteBell(info.position);
        refreshBellsList();/*from   w w w . ja va  2  s  .  co m*/
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.activities.SensorSettingsActivity.java

private void openSelectDeviceDialog() {
    BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (mBluetoothAdapter != null) {
        BluetoothDevice[] mAllBondedDevices = (BluetoothDevice[]) mBluetoothAdapter.getBondedDevices()
                .toArray(new BluetoothDevice[0]);

        int mDeviceIndex = 0;
        if (mAllBondedDevices.length > 0) {
            int deviceCount = mAllBondedDevices.length;
            String[] deviceNames = new String[deviceCount];
            for (int i = 0; i < deviceCount; i++) {
                BluetoothDevice device = mAllBondedDevices[i];
                deviceNames[i] = device.getName() + "\n|" + device.getAddress();
                if (deviceMacAdd.equals(device.getAddress())) {
                    mDeviceIndex = i;//from  w  w  w  .  ja  va 2  s.c  o  m
                }
            }
            DialogFragment deviceDialog = new SelectDeviceDialogFragment();
            Bundle args = new Bundle();
            args.putStringArray("names", deviceNames);
            args.putInt("position", mDeviceIndex);
            args.putBoolean("device", true);
            deviceDialog.setArguments(args);
            getFragmentManager().beginTransaction();
            deviceDialog.show(getSupportFragmentManager().beginTransaction(), "deviceDialog");
        }
    }
}

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

private void showStateProgressDialog(String details) {
    DialogFragment df = new StateProgressDialogFragment();
    Bundle args = new Bundle();
    args.putString("details", details);
    df.setArguments(args);
    df.setCancelable(false);//from   w  ww  .  j  av  a  2 s.c  o m
    df.show(getSupportFragmentManager(), "state_progress_dialog");
    mStateProgressDialog = df;
}

From source file:org.videolan.vlc.gui.dialogs.AdvOptionsDialog.java

private void showTimePicker(int action) {
    DialogFragment newFragment = new TimePickerDialogFragment();
    Bundle args = new Bundle();
    args.putInt("action", action);
    newFragment.setArguments(args);
    newFragment.show(getActivity().getSupportFragmentManager(), "timePicker");
    mHandler.sendEmptyMessage(RESET_RETRY);
    mHandler.sendMessageDelayed(mHandler.obtainMessage(DIALOG_LISTENER, newFragment), 100);
    dismiss();/*w w  w. ja v  a 2 s . c o  m*/
}

From source file:mobi.daytoday.DayToDay.BetweenDatesFragment.java

private void showDatePickerDialogWith(String date) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();

    Fragment prev = getFragmentManager().findFragmentByTag(DatePickerDialogFragment.DATE_PICKER_ID);
    if (prev != null) {
        ft.remove(prev);/*  ww w  . j a v  a 2  s  . c om*/
        firstActive = secondActive = false;
    }
    ft.addToBackStack(null);

    DialogFragment frag = new DatePickerDialogFragment();
    ((DatePickerDialogFragment) frag).setCallbackFragment((Fragment) BetweenDatesFragment.this);
    Bundle args = new Bundle();
    args.putString(DateWrap.CUR_DATE, date);
    frag.setArguments(args);
    frag.show(ft, DatePickerDialogFragment.DATE_PICKER_ID);
}

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

private void showSyncProgressDialog() {
    String details;/*ww  w  . j  ava2  s .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(getSupportFragmentManager(), "sync_progress_dialog");
    mSyncProgressDialog = df;
}

From source file:com.quarterfull.newsAndroid.ssl.MemorizingTrustManager.java

void interact(final X509Certificate[] chain, CertificateException cause) throws CertificateException {
    /* prepare the MTMDecision blocker object */
    MTMDecision choice = new MTMDecision();
    final int myId = createDecisionId(choice);
    final String certMessage = certChainMessage(chain, cause);

    BroadcastReceiver decisionReceiver = new BroadcastReceiver() {
        public void onReceive(Context ctx, Intent i) {
            interactResult(i);//from   w ww.  j av a  2  s  .co m
        }
    };
    mContext.registerReceiver(decisionReceiver,
            new IntentFilter(DECISION_INTENT + "/" + mContext.getPackageName()));
    masterHandler.post(new Runnable() {
        public void run() {
            Intent ni = new Intent(mContext, MemorizingDialogFragment.class);
            ni.setData(Uri.parse(MemorizingTrustManager.class.getName() + "/" + myId));

            Bundle bundle = new Bundle();
            bundle.putString(DECISION_INTENT_APP, mContext.getPackageName());
            bundle.putInt(DECISION_INTENT_ID, myId);
            bundle.putString(DECISION_INTENT_CERT, certMessage);

            DialogFragment dialog = new MemorizingDialogFragment();
            dialog.setArguments(bundle);
            try {
                dialog.show(((FragmentActivity) getUI()).getSupportFragmentManager(), "NoticeDialogFragment");
            } catch (Exception ex) {
                Log.e(TAG, "startActivity: " + ex);
                startActivityNotification(ni, certMessage);
            }
        }
    });

    Log.d(TAG, "openDecisions: " + openDecisions);
    Log.d(TAG, "waiting on " + myId);
    try {
        synchronized (choice) {
            choice.wait();
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    mContext.unregisterReceiver(decisionReceiver);
    Log.d(TAG, "finished wait on " + myId + ": " + choice.state);
    switch (choice.state) {
    case MTMDecision.DECISION_ALWAYS:
        storeCert(chain);
    case MTMDecision.DECISION_ONCE:
        break;
    default:
        throw (cause);
    }
}

From source file:com.android2ee.tileprovider.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    switch (id) {
    case R.id.action_info:
        DialogFragment dialog = new MyDialogFragment();
        Bundle args = new Bundle();
        args.putString(MyDialogFragment.KEY_TEXT,
                GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this));
        dialog.setArguments(args);
        dialog.show(getSupportFragmentManager(), MyDialogFragment.TAG);
        return true;
    case R.id.action_custom:
        typeNormal = false;//w  ww .  j  a v a 2  s .c om
        updateMenu();
        updateMap();
        return true;
    case R.id.action_normal:
        typeNormal = true;
        updateMenu();
        updateMap();
        return true;
    }
    return super.onOptionsItemSelected(item);
}