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:com.he5ed.lib.cloudprovider.picker.CloudPickerActivity.java

/**
 * @hide/*from w ww  .  j  av  a 2  s . co m*/
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // save empty view state skip if not visible
    LinearLayout emptyView = (LinearLayout) findViewById(R.id.error_view);
    outState.putInt("empty_view_visibility", emptyView.getVisibility());
    if (emptyView.getVisibility() != View.VISIBLE)
        return;

    ImageView icon = (ImageView) findViewById(R.id.empty_icon_image_view);
    TextView title = (TextView) findViewById(R.id.empty_title_text_view);
    TextView detail = (TextView) findViewById(R.id.empty_detail_text_view);

    Bitmap bitmap = ((BitmapDrawable) icon.getDrawable()).getBitmap();
    outState.putParcelable("icon_drawable", bitmap);
    outState.putCharSequence("title_text", title.getText());
    outState.putCharSequence("detail_text", detail.getText());
}

From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java

/**
 * /* w  w  w. ja  v a 2 s.  c om*/
 */
private void setTextToView(AccessibilityNodeInfo node, String text) {
    Bundle arguments = new Bundle();
    arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
            AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD);
    arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
    node.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
    /*?*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Bundle args = new Bundle();
        args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
        node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args);
    } else {
        ClipData data = ClipData.newPlainText("reply", text);
        ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        clipboardManager.setPrimaryClip(data);
        node.performAction(AccessibilityNodeInfo.ACTION_FOCUS); // ?
        node.performAction(AccessibilityNodeInfo.ACTION_PASTE); // 
    }

}

From source file:com.silentcircle.silenttext.activity.AccountCreationActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment);/* www.  j av a  2  s .  c o m*/
    findViewById(R.id.error).setVisibility(View.GONE);

    handler = new Handler();
    hideError = new ViewAnimator(this, R.id.error, R.anim.slide_up);

    Fragment fragment = getFragmentManager().findFragmentById(R.id.content);

    if (fragment == null) {
        Bundle bundle = toBundle(getIntent());

        CharSequence licenseCode = bundle.getCharSequence(AccountCreationFragment.EXTRA_LICENSE_CODE);
        if (StringUtils.isEmpty(licenseCode)) {
            // check for application level license code
            LicenseCodeProvider provider = new ApplicationLicenseCodeProvider();
            licenseCode = provider.provideLicenseCode(this);

            if (StringUtils.isEmpty(licenseCode)) {
                // check for auto-generated partner license codes
                provider = new EligibleLicenseCodeProvider(DeviceUtils.getPartnerEligibility(this),
                        new DeviceIDLicenseCodeProvider());
                licenseCode = provider.provideLicenseCode(this);
            }

            bundle.putCharSequence(AccountCreationFragment.EXTRA_LICENSE_CODE, licenseCode);
        }

        fragment = AccountCreationWelcomeFragment.create(bundle);
        getFragmentManager().beginTransaction().add(R.id.content, fragment).commit();
    }

    if (fragment instanceof HasFlow) {
        ((HasFlow) fragment).setFlowListener(this);
    }

    getFragmentManager().addOnBackStackChangedListener(new OnBackStackChangedListener() {

        @Override
        public void onBackStackChanged() {
            Fragment f = getFragmentManager().findFragmentById(R.id.content);
            if (f instanceof HasFlow) {
                ((HasFlow) f).setFlowListener(AccountCreationActivity.this);
            }
        }
    });

}

From source file:info.staticfree.android.units.Units.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence(STATE_RESULT_TEXT, resultView.getText());
    outState.putBoolean(STATE_DRAWER_OPENED, isHistoryVisible());
    outState.putString(STATE_DIALOG_UNIT_CATEGORY, mDialogUnitCategoryUnit);
}

From source file:com.he5ed.lib.cloudprovider.picker.PickerFragment.java

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

    if (getView() == null)
        return;// ww  w. j  ava2s. c o m
    // save empty view state skip if not visible
    LinearLayout emptyView = (LinearLayout) getView().findViewById(android.R.id.empty);
    outState.putInt("empty_view_visibility", emptyView.getVisibility());
    if (emptyView.getVisibility() != View.VISIBLE)
        return;

    ImageView icon = (ImageView) getView().findViewById(R.id.empty_icon_image_view);
    TextView title = (TextView) getView().findViewById(R.id.empty_title_text_view);
    TextView detail = (TextView) getView().findViewById(R.id.empty_detail_text_view);

    Bitmap bitmap = ((BitmapDrawable) icon.getDrawable()).getBitmap();
    outState.putParcelable("icon_drawable", bitmap);
    outState.putCharSequence("title_text", title.getText());
    outState.putCharSequence("detail_text", detail.getText());
}

From source file:de.mrapp.android.dialog.decorator.MaterialDialogDecorator.java

@Override
public final void onSaveInstanceState(@NonNull final Bundle outState) {
    outState.putInt(TITLE_COLOR_EXTRA, getTitleColor());
    outState.putInt(MESSAGE_COLOR_EXTRA, getMessageColor());
    outState.putCharSequence(TITLE_EXTRA, getTitle());
    outState.putCharSequence(MESSAGE_EXTRA, getMessage());

    if (iconBitmap != null) {
        outState.putParcelable(ICON_BITMAP_EXTRA, iconBitmap);
    } else if (iconId != -1) {
        outState.putInt(ICON_ID_EXTRA, iconId);
    } else if (iconAttributeId != -1) {
        outState.putInt(ICON_ATTRIBUTE_ID_EXTRA, iconAttributeId);
    }//  w  ww  .  j  a  va  2  s.com

    if (backgroundBitmap != null) {
        outState.putParcelable(BACKGROUND_BITMAP_EXTRA, backgroundBitmap);
    } else if (backgroundId != -1) {
        outState.putInt(BACKGROUND_ID_EXTRA, backgroundId);
    } else if (backgroundColor != -1) {
        outState.putInt(BACKGROUND_COLOR_EXTRA, backgroundColor);
    }
}

From source file:cz.maresmar.sfm.view.MainActivity.java

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

    mDrawer.saveInstanceState(outState);

    outState.putLong(ARG_USER_ID, mSelectedUserId);
    outState.putLong(ARG_FRAGMENT_ID, mSelectedFragmentId);
    outState.putCharSequence(ARG_TITLE, getTitle());
    outState.putBoolean(ARG_REFRESHING, mIsRefreshing);
}

From source file:com.android.calculator2.Calculator.java

@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
    mEvaluator.cancelAll(true);//  w ww. j  av a 2  s . co m
    // If there's an animation in progress, cancel it first to ensure our state is up-to-date.
    if (mCurrentAnimator != null) {
        mCurrentAnimator.cancel();
    }

    super.onSaveInstanceState(outState);
    outState.putInt(KEY_DISPLAY_STATE, mCurrentState.ordinal());
    outState.putCharSequence(KEY_UNPROCESSED_CHARS, mUnprocessedChars);
    ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
    try (ObjectOutput out = new ObjectOutputStream(byteArrayStream)) {
        mEvaluator.saveInstanceState(out);
    } catch (IOException e) {
        // Impossible; No IO involved.
        throw new AssertionError("Impossible IO exception", e);
    }
    outState.putByteArray(KEY_EVAL_STATE, byteArrayStream.toByteArray());
}

From source file:com.folioreader.ui.folio.activity.FolioActivity.java

/**
 * If called, this method will occur after onStop() for applications targeting platforms
 * starting with Build.VERSION_CODES.P. For applications targeting earlier platform versions
 * this method will occur before onStop() and there are no guarantees about whether it will
 * occur before or after onPause()/*  ww  w. jav  a2  s .c o m*/
 *
 * @see Activity#onSaveInstanceState(Bundle) of Build.VERSION_CODES.P
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Log.v(LOG_TAG, "-> onSaveInstanceState");
    this.outState = outState;

    outState.putBoolean(BUNDLE_DISTRACTION_FREE_MODE, distractionFreeMode);
    outState.putBundle(SearchAdapter.DATA_BUNDLE, searchAdapterDataBundle);
    outState.putCharSequence(SearchActivity.BUNDLE_SAVE_SEARCH_QUERY, searchQuery);
}

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

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putCharSequence(STATE_TITLE, itsTitle);
    outState.putCharSequence(STATE_QUERY, itsQuery.getText());
    outState.putBoolean(STATE_EXPIRY_VISIBLE, itsExpiryPanel.getVisibility() == View.VISIBLE);
}