Example usage for android.os Bundle putCharSequence

List of usage examples for android.os Bundle putCharSequence

Introduction

In this page you can find the example usage for android.os Bundle putCharSequence.

Prototype

@Override
public void putCharSequence(@Nullable String key, @Nullable CharSequence value) 

Source Link

Document

Inserts a CharSequence value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:android.support.v7.preference.PreferenceDialogFragmentCompat.java

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putCharSequence(SAVE_STATE_TITLE, mDialogTitle);
    outState.putCharSequence(SAVE_STATE_POSITIVE_TEXT, mPositiveButtonText);
    outState.putCharSequence(SAVE_STATE_NEGATIVE_TEXT, mNegativeButtonText);
    outState.putCharSequence(SAVE_STATE_MESSAGE, mDialogMessage);
    outState.putInt(SAVE_STATE_LAYOUT, mDialogLayoutRes);
    if (mDialogIcon != null) {
        outState.putParcelable(SAVE_STATE_ICON, mDialogIcon.getBitmap());
    }//from  ww  w .ja v  a2 s  .  c  o m
}

From source file:org.rm3l.ddwrt.tiles.admin.nvram.EditNVRAMKeyValueDialogFragment.java

@Override
public void onStart() {
    super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point

    final AlertDialog d = (AlertDialog) getDialog();
    if (d != null) {

        ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key)).setText(this.mKey);
        final EditText valueEditText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value);
        valueEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override//from  ww  w .j  a  va 2s.  c  o m
            public void onFocusChange(View v, boolean hasFocus) {
                ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_value_textview)).setTypeface(null,
                        hasFocus ? Typeface.BOLD_ITALIC : Typeface.NORMAL);
            }
        });
        valueEditText.setText(this.mValue, TextView.BufferType.EDITABLE);

        d.getButton(Dialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //Validate data
                final EditText editText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value);
                final Editable newValue = editText.getText();

                if (mValue != null && StringUtils.equals(newValue.toString(), mValue.toString())) {
                    //Crouton
                    Crouton.makeText(getActivity(), "No change", ALERT,
                            (ViewGroup) (d.findViewById(R.id.tile_admin_nvram_edit_notification_viewgroup)))
                            .show();
                    editText.requestFocus();
                    //Open Keyboard
                    final InputMethodManager imm = (InputMethodManager) getActivity()
                            .getSystemService(Context.INPUT_METHOD_SERVICE);
                    if (imm != null) {
                        // only will trigger it if no physical keyboard is open
                        imm.showSoftInput(editText, 0);
                    }
                    return;
                }

                final CharSequence variableKey = ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key))
                        .getText();

                final Bundle token = new Bundle();
                token.putInt(POSITION, mPosition);
                token.putCharSequence(VALUE, newValue);
                token.putCharSequence(KEY, variableKey);

                //nvram set data changed
                new UndoBarController.UndoBar(getSherlockActivity())
                        .message(String.format("Variable '%s' will be updated", variableKey))
                        .listener(nvramDataRecyclerViewAdapter).token(token).show();

                d.cancel();
            }
        });
    }
}

From source file:can.yrt.onebusaway.ReportTripProblemFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(CODE, mCodeView.getSelectedItemPosition());
    outState.putCharSequence(USER_COMMENT, mUserComment.getText());
    outState.putBoolean(USER_ON_VEHICLE, mUserOnVehicle.isChecked());
    outState.putCharSequence(USER_VEHICLE_NUM, mUserVehicle.getText());
}

From source file:android.support.v17.preference.LeanbackListPreferenceDialogFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence(SAVE_STATE_TITLE, mDialogTitle);
    outState.putCharSequence(SAVE_STATE_MESSAGE, mDialogMessage);
    outState.putBoolean(SAVE_STATE_IS_MULTI, mMulti);
    outState.putCharSequenceArray(SAVE_STATE_ENTRIES, mEntries);
    outState.putCharSequenceArray(SAVE_STATE_ENTRY_VALUES, mEntryValues);
    if (mMulti) {
        outState.putStringArray(SAVE_STATE_INITIAL_SELECTIONS,
                mInitialSelections.toArray(new String[mInitialSelections.size()]));
    } else {//from   w  w  w .  ja v a  2 s .c om
        outState.putString(SAVE_STATE_INITIAL_SELECTION, mInitialSelection);
    }
}

From source file:mobi.cangol.mobile.base.BaseContentFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence("title", title);
}

From source file:com.commonsware.android.arXiv.ArticleListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("totalCount", totalCount);
    if (error) {//w w w .  j  a  v a2 s.  c o m
        outState.putBoolean("error", error);
        outState.putCharSequence("errorMsg", errorMsg.getText());
    }
}

From source file:org.dodgybits.shuffle.android.core.activity.HelpActivity.java

private void initFragments() {
    mFragments = Lists.newArrayList();/*from w  w w.  java2 s  .c  om*/

    String[] helpTitles = getResources().getStringArray(R.array.help_screens);
    int[] helpKeys = getResources().getIntArray(R.array.help_keys);
    int length = helpTitles.length;
    if (helpKeys.length != length) {
        Log.e(TAG, "Mismatch between keys length " + helpKeys.length + " and titles " + length);
        length = Math.min(length, helpKeys.length);
    }

    for (int i = 0; i < length; i++) {
        HelpListFragment fragment = mHelpListFragmentProvider.get(this);
        Bundle args = new Bundle();
        int index = helpKeys[i];
        String idKey = "help" + index;
        int contentId = getResources().getIdentifier(idKey, "string", getPackageName());
        CharSequence content = getText(contentId);
        args.putCharSequence(HelpListFragment.CONTENT, content);
        args.putString(HelpListFragment.TITLE, helpTitles[index]);

        fragment.setArguments(args);
        mFragments.add(fragment);
    }

    // few magic numbers for good luck...
    mQueryIndex = Maps.newHashMap();
    mQueryIndex.put(ListQuery.inbox, 1);
    mQueryIndex.put(ListQuery.dueToday, 2);
    mQueryIndex.put(ListQuery.dueNextWeek, 2);
    mQueryIndex.put(ListQuery.dueNextMonth, 2);
    mQueryIndex.put(ListQuery.nextTasks, 3);
    mQueryIndex.put(ListQuery.project, 4);
    mQueryIndex.put(ListQuery.context, 5);
    mQueryIndex.put(ListQuery.custom, 6);
    mQueryIndex.put(ListQuery.tickler, 7);
}

From source file:com.hrs.filltheform.dialog.FillTheFormDialog.java

private void fillTheSelectedNodeWithData(String inputData) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        fillPreLollipop(inputData);/*from   w  w  w . j av  a 2 s .  c o  m*/
    } else {
        Bundle arguments = new Bundle();
        arguments.putCharSequence(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, inputData);
        selectedNodeInfo.performAction(AccessibilityNodeInfoCompat.ACTION_SET_TEXT, arguments);
    }
}

From source file:com.jefftharris.passwdsafe.FileListActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence(STATE_TITLE, itsTitle);
}

From source file:org.mariotaku.twidere.fragment.support.DirectMessagesConversationFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence(EXTRA_TEXT, mEditText != null ? mEditText.getText() : null);
    outState.putLong(EXTRA_ACCOUNT_ID, mAccountId);
    outState.putLong(EXTRA_RECIPIENT_ID, mRecipientId);
}