Java Code Examples for android.text.TextUtils#writeToParcel()

The following examples show how to use android.text.TextUtils#writeToParcel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SliceItem.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static void writeObj(Parcel dest, int flags, Object obj, String type) {
    switch (getBaseType(type)) {
        case FORMAT_SLICE:
        case FORMAT_IMAGE:
        case FORMAT_REMOTE_INPUT:
        case FORMAT_BUNDLE:
            ((Parcelable) obj).writeToParcel(dest, flags);
            break;
        case FORMAT_ACTION:
            ((Pair<PendingIntent, Slice>) obj).first.writeToParcel(dest, flags);
            ((Pair<PendingIntent, Slice>) obj).second.writeToParcel(dest, flags);
            break;
        case FORMAT_TEXT:
            TextUtils.writeToParcel((CharSequence) obj, dest, flags);
            break;
        case FORMAT_INT:
            dest.writeInt((Integer) obj);
            break;
        case FORMAT_TIMESTAMP:
            dest.writeLong((Long) obj);
            break;
    }
}
 
Example 2
Source File: TokenCompleteTextView.java    From TokenAutoComplete with Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
    super.writeToParcel(out, flags);
    TextUtils.writeToParcel(prefix, out, 0);
    out.writeInt(allowCollapse ? 1 : 0);
    out.writeInt(performBestGuess ? 1 : 0);
    out.writeInt(preventFreeFormText ? 1 : 0);
    out.writeInt(tokenClickStyle.ordinal());
    if (SERIALIZABLE_PLACEHOLDER.equals(parcelableClassName)) {
        out.writeString(SERIALIZABLE_PLACEHOLDER);
        out.writeSerializable((Serializable)baseObjects);
    } else {
        out.writeString(parcelableClassName);
        out.writeList(baseObjects);
    }
    out.writeString(tokenizer.getClass().getCanonicalName());
    out.writeParcelable(tokenizer, 0);
}
 
Example 3
Source File: DashboardTile.java    From AcDisplay with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(id);
    dest.writeInt(titleRes);
    TextUtils.writeToParcel(title, dest, flags);
    dest.writeInt(summaryRes);
    TextUtils.writeToParcel(summary, dest, flags);
    dest.writeInt(iconRes);
    dest.writeString(fragment);
    dest.writeBundle(fragmentArguments);
    if (intent != null) {
        dest.writeInt(1);
        intent.writeToParcel(dest, flags);
    } else {
        dest.writeInt(0);
    }
    dest.writeBundle(extras);
}
 
Example 4
Source File: EditorInfo.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Used to package this object into a {@link Parcel}.
 *
 * @param dest The {@link Parcel} to be written.
 * @param flags The flags used for parceling.
 */
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(inputType);
    dest.writeInt(imeOptions);
    dest.writeString(privateImeOptions);
    TextUtils.writeToParcel(actionLabel, dest, flags);
    dest.writeInt(actionId);
    dest.writeInt(initialSelStart);
    dest.writeInt(initialSelEnd);
    dest.writeInt(initialCapsMode);
    TextUtils.writeToParcel(hintText, dest, flags);
    TextUtils.writeToParcel(label, dest, flags);
    dest.writeString(packageName);
    dest.writeInt(fieldId);
    dest.writeString(fieldName);
    dest.writeBundle(extras);
    if (hintLocales != null) {
        hintLocales.writeToParcel(dest, flags);
    } else {
        LocaleList.getEmptyLocaleList().writeToParcel(dest, flags);
    }
    dest.writeStringArray(contentMimeTypes);
}
 
Example 5
Source File: Tab.java    From ChromeLikeTabSwitcher with Apache License 2.0 6 votes vote down vote up
@Override
public final void writeToParcel(final Parcel parcel, final int flags) {
    TextUtils.writeToParcel(title, parcel, flags);
    parcel.writeInt(iconId);
    parcel.writeParcelable(iconBitmap, flags);
    parcel.writeParcelable(iconTintList, flags);
    parcel.writeSerializable(iconTintMode);
    parcel.writeInt(closeable ? 1 : 0);
    parcel.writeInt(closeButtonIconId);
    parcel.writeParcelable(closeButtonIconBitmap, flags);
    parcel.writeParcelable(closeButtonIconTintList, flags);
    parcel.writeSerializable(closeButtonIconTintMode);
    parcel.writeParcelable(backgroundColor, flags);
    parcel.writeInt(contentBackgroundColor);
    parcel.writeParcelable(titleTextColor, flags);
    parcel.writeInt(progressBarShown ? 1 : 0);
    parcel.writeInt(progressBarColor);
    parcel.writeBundle(parameters);
}
 
Example 6
Source File: AccessibilityEvent.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Writes an {@link AccessibilityRecord} to a parcel.
 *
 * @param record The record to write.
 * @param parcel The parcel to which to write.
 */
private void writeAccessibilityRecordToParcel(AccessibilityRecord record, Parcel parcel,
        int flags) {
    parcel.writeInt(record.mBooleanProperties);
    parcel.writeInt(record.mCurrentItemIndex);
    parcel.writeInt(record.mItemCount);
    parcel.writeInt(record.mFromIndex);
    parcel.writeInt(record.mToIndex);
    parcel.writeInt(record.mScrollX);
    parcel.writeInt(record.mScrollY);
    parcel.writeInt(record.mScrollDeltaX);
    parcel.writeInt(record.mScrollDeltaY);
    parcel.writeInt(record.mMaxScrollX);
    parcel.writeInt(record.mMaxScrollY);
    parcel.writeInt(record.mAddedCount);
    parcel.writeInt(record.mRemovedCount);
    TextUtils.writeToParcel(record.mClassName, parcel, flags);
    TextUtils.writeToParcel(record.mContentDescription, parcel, flags);
    TextUtils.writeToParcel(record.mBeforeText, parcel, flags);
    parcel.writeParcelable(record.mParcelableData, flags);
    parcel.writeList(record.mText);
    parcel.writeInt(record.mSourceWindowId);
    parcel.writeLong(record.mSourceNodeId);
    parcel.writeInt(record.mSealed ? 1 : 0);
}
 
Example 7
Source File: PreferenceActivity.java    From ticdesign with Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(id);
    dest.writeInt(titleRes);
    TextUtils.writeToParcel(title, dest, flags);
    dest.writeInt(summaryRes);
    TextUtils.writeToParcel(summary, dest, flags);
    dest.writeInt(breadCrumbTitleRes);
    TextUtils.writeToParcel(breadCrumbTitle, dest, flags);
    dest.writeInt(breadCrumbShortTitleRes);
    TextUtils.writeToParcel(breadCrumbShortTitle, dest, flags);
    dest.writeInt(iconRes);
    dest.writeString(fragment);
    dest.writeBundle(fragmentArguments);
    if (intent != null) {
        dest.writeInt(1);
        intent.writeToParcel(dest, flags);
    } else {
        dest.writeInt(0);
    }
    dest.writeBundle(extras);
}
 
Example 8
Source File: ResolveInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel dest, int parcelableFlags) {
    if (activityInfo != null) {
        dest.writeInt(1);
        activityInfo.writeToParcel(dest, parcelableFlags);
    } else if (serviceInfo != null) {
        dest.writeInt(2);
        serviceInfo.writeToParcel(dest, parcelableFlags);
    } else if (providerInfo != null) {
        dest.writeInt(3);
        providerInfo.writeToParcel(dest, parcelableFlags);
    } else {
        dest.writeInt(0);
    }
    if (filter != null) {
        dest.writeInt(1);
        filter.writeToParcel(dest, parcelableFlags);
    } else {
        dest.writeInt(0);
    }
    dest.writeInt(priority);
    dest.writeInt(preferredOrder);
    dest.writeInt(match);
    dest.writeInt(specificIndex);
    dest.writeInt(labelRes);
    TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags);
    dest.writeInt(icon);
    dest.writeString(resolvePackageName);
    dest.writeInt(targetUserId);
    dest.writeInt(system ? 1 : 0);
    dest.writeInt(noResourceId ? 1 : 0);
    dest.writeInt(iconResourceId);
    dest.writeInt(handleAllWebDataURI ? 1 : 0);
    dest.writeInt(isInstantAppAvailable ? 1 : 0);
}
 
Example 9
Source File: ActivityManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(id);
    dest.writeInt(persistentId);
    if (baseIntent != null) {
        dest.writeInt(1);
        baseIntent.writeToParcel(dest, 0);
    } else {
        dest.writeInt(0);
    }
    ComponentName.writeToParcel(origActivity, dest);
    ComponentName.writeToParcel(realActivity, dest);
    TextUtils.writeToParcel(description, dest,
            Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
    if (taskDescription != null) {
        dest.writeInt(1);
        taskDescription.writeToParcel(dest, 0);
    } else {
        dest.writeInt(0);
    }
    dest.writeInt(stackId);
    dest.writeInt(userId);
    dest.writeLong(lastActiveTime);
    dest.writeInt(affiliatedTaskId);
    dest.writeInt(affiliatedTaskColor);
    ComponentName.writeToParcel(baseActivity, dest);
    ComponentName.writeToParcel(topActivity, dest);
    dest.writeInt(numActivities);
    if (bounds != null) {
        dest.writeInt(1);
        bounds.writeToParcel(dest, 0);
    } else {
        dest.writeInt(0);
    }
    dest.writeInt(supportsSplitScreenMultiWindow ? 1 : 0);
    dest.writeInt(resizeMode);
    configuration.writeToParcel(dest, flags);
}
 
Example 10
Source File: PermissionInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int parcelableFlags) {
    super.writeToParcel(dest, parcelableFlags);
    dest.writeInt(protectionLevel);
    dest.writeInt(flags);
    dest.writeString(group);
    dest.writeInt(descriptionRes);
    dest.writeInt(requestRes);
    TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags);
}
 
Example 11
Source File: RemoteAction.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel out, int flags) {
    mIcon.writeToParcel(out, 0);
    TextUtils.writeToParcel(mTitle, out, flags);
    TextUtils.writeToParcel(mContentDescription, out, flags);
    mActionIntent.writeToParcel(out, flags);
    out.writeBoolean(mEnabled);
    out.writeBoolean(mShouldShowIcon);
}
 
Example 12
Source File: BackStackRecord.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel dest, int flags) {
    dest.writeIntArray(mOps);
    dest.writeInt(mTransition);
    dest.writeInt(mTransitionStyle);
    dest.writeString(mName);
    dest.writeInt(mIndex);
    dest.writeInt(mBreadCrumbTitleRes);
    TextUtils.writeToParcel(mBreadCrumbTitleText, dest, 0);
    dest.writeInt(mBreadCrumbShortTitleRes);
    TextUtils.writeToParcel(mBreadCrumbShortTitleText, dest, 0);
    dest.writeStringList(mSharedElementSourceNames);
    dest.writeStringList(mSharedElementTargetNames);
    dest.writeInt(mReorderingAllowed ? 1 : 0);
}
 
Example 13
Source File: Option.java    From bottomsheets with Apache License 2.0 5 votes vote down vote up
@Override
public final void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.iconId);
    dest.writeInt(this.iconColor);
    dest.writeInt(this.titleColor);
    dest.writeInt(this.descriptionColor);
    dest.writeLong(this.id);
    TextUtils.writeToParcel(this.title, dest, flags);
    TextUtils.writeToParcel(this.description, dest, flags);

    if(this.tag instanceof Serializable) {
        dest.writeSerializable((Serializable) this.tag);
    }
}
 
Example 14
Source File: PlaybackStateCompat.java    From letv with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.mState);
    dest.writeLong(this.mPosition);
    dest.writeFloat(this.mSpeed);
    dest.writeLong(this.mUpdateTime);
    dest.writeLong(this.mBufferedPosition);
    dest.writeLong(this.mActions);
    TextUtils.writeToParcel(this.mErrorMessage, dest, flags);
    dest.writeTypedList(this.mCustomActions);
    dest.writeLong(this.mActiveItemId);
    dest.writeBundle(this.mExtras);
}
 
Example 15
Source File: BackStackRecord.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
public void writeToParcel(Parcel dest, int flags) {
    dest.writeIntArray(mOps);
    dest.writeInt(mTransition);
    dest.writeInt(mTransitionStyle);
    dest.writeString(mName);
    dest.writeInt(mIndex);
    dest.writeInt(mBreadCrumbTitleRes);
    TextUtils.writeToParcel(mBreadCrumbTitleText, dest, 0);
    dest.writeInt(mBreadCrumbShortTitleRes);
    TextUtils.writeToParcel(mBreadCrumbShortTitleText, dest, 0);
}
 
Example 16
Source File: ExtractedText.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Used to package this object into a {@link Parcel}.
 *
 * @param dest The {@link Parcel} to be written.
 * @param flags The flags used for parceling.
 */
public void writeToParcel(Parcel dest, int flags) {
    TextUtils.writeToParcel(text, dest, flags);
    dest.writeInt(startOffset);
    dest.writeInt(partialStartOffset);
    dest.writeInt(partialEndOffset);
    dest.writeInt(selectionStart);
    dest.writeInt(selectionEnd);
    dest.writeInt(this.flags);
    TextUtils.writeToParcel(hint, dest, flags);
}
 
Example 17
Source File: BackStackRecord.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel dest, int flags) {
    dest.writeIntArray(mOps);
    dest.writeInt(mTransition);
    dest.writeInt(mTransitionStyle);
    dest.writeString(mName);
    dest.writeInt(mIndex);
    dest.writeInt(mBreadCrumbTitleRes);
    TextUtils.writeToParcel(mBreadCrumbTitleText, dest, 0);
    dest.writeInt(mBreadCrumbShortTitleRes);
    TextUtils.writeToParcel(mBreadCrumbShortTitleText, dest, 0);
    dest.writeStringList(mSharedElementSourceNames);
    dest.writeStringList(mSharedElementTargetNames);
}
 
Example 18
Source File: PackageItemInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel dest, int parcelableFlags) {
    dest.writeString(name);
    dest.writeString(packageName);
    dest.writeInt(labelRes);
    TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags);
    dest.writeInt(icon);
    dest.writeInt(logo);
    dest.writeBundle(metaData);
    dest.writeInt(banner);
    dest.writeInt(showUserIcon);
}
 
Example 19
Source File: SwitchButton.java    From AssistantBySDK with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel out, int flags) {
	super.writeToParcel(out, flags);
	TextUtils.writeToParcel(onText, out, flags);
	TextUtils.writeToParcel(offText, out, flags);
}
 
Example 20
Source File: CropImageOptions.java    From Lassi-Android with MIT License 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(cropShape.ordinal());
    dest.writeFloat(snapRadius);
    dest.writeFloat(touchRadius);
    dest.writeInt(guidelines.ordinal());
    dest.writeInt(scaleType.ordinal());
    dest.writeByte((byte) (showCropOverlay ? 1 : 0));
    dest.writeByte((byte) (showProgressBar ? 1 : 0));
    dest.writeByte((byte) (autoZoomEnabled ? 1 : 0));
    dest.writeByte((byte) (multiTouchEnabled ? 1 : 0));
    dest.writeInt(maxZoom);
    dest.writeFloat(initialCropWindowPaddingRatio);
    dest.writeByte((byte) (fixAspectRatio ? 1 : 0));
    dest.writeInt(aspectRatioX);
    dest.writeInt(aspectRatioY);
    dest.writeFloat(borderLineThickness);
    dest.writeInt(borderLineColor);
    dest.writeFloat(borderCornerThickness);
    dest.writeFloat(borderCornerOffset);
    dest.writeFloat(borderCornerLength);
    dest.writeInt(borderCornerColor);
    dest.writeFloat(guidelinesThickness);
    dest.writeInt(guidelinesColor);
    dest.writeInt(backgroundColor);
    dest.writeInt(minCropWindowWidth);
    dest.writeInt(minCropWindowHeight);
    dest.writeInt(minCropResultWidth);
    dest.writeInt(minCropResultHeight);
    dest.writeInt(maxCropResultWidth);
    dest.writeInt(maxCropResultHeight);
    TextUtils.writeToParcel(activityTitle, dest, flags);
    dest.writeInt(activityMenuIconColor);
    dest.writeParcelable(outputUri, flags);
    dest.writeString(outputCompressFormat.name());
    dest.writeInt(outputCompressQuality);
    dest.writeInt(outputRequestWidth);
    dest.writeInt(outputRequestHeight);
    dest.writeInt(outputRequestSizeOptions.ordinal());
    dest.writeInt(noOutputImage ? 1 : 0);
    dest.writeParcelable(initialCropWindowRectangle, flags);
    dest.writeInt(initialRotation);
    dest.writeByte((byte) (allowRotation ? 1 : 0));
    dest.writeByte((byte) (allowFlipping ? 1 : 0));
    dest.writeByte((byte) (allowCounterRotation ? 1 : 0));
    dest.writeInt(rotationDegrees);
    dest.writeByte((byte) (flipHorizontally ? 1 : 0));
    dest.writeByte((byte) (flipVertically ? 1 : 0));
    TextUtils.writeToParcel(cropMenuCropButtonTitle, dest, flags);
    dest.writeInt(cropMenuCropButtonIcon);
}