Java Code Examples for android.os.Parcel#writeBundle()

The following examples show how to use android.os.Parcel#writeBundle() . 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: 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 2
Source File: PreferenceActivity.java    From PreferenceFragment 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 3
Source File: UsageStats.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mPackageName);
    dest.writeLong(mBeginTimeStamp);
    dest.writeLong(mEndTimeStamp);
    dest.writeLong(mLastTimeUsed);
    dest.writeLong(mTotalTimeInForeground);
    dest.writeInt(mLaunchCount);
    dest.writeInt(mAppLaunchCount);
    dest.writeInt(mLastEvent);
    Bundle allCounts = new Bundle();
    if (mChooserCounts != null) {
        final int chooserCountSize = mChooserCounts.size();
        for (int i = 0; i < chooserCountSize; i++) {
            String action = mChooserCounts.keyAt(i);
            ArrayMap<String, Integer> counts = mChooserCounts.valueAt(i);
            Bundle currentCounts = new Bundle();
            final int annotationSize = counts.size();
            for (int j = 0; j < annotationSize; j++) {
                currentCounts.putInt(counts.keyAt(j), counts.valueAt(j));
            }
            allCounts.putBundle(action, currentCounts);
        }
    }
    dest.writeBundle(allCounts);
}
 
Example 4
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean refresh(String callingPkg, Uri url, Bundle args, ICancellationSignal signal)
        throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        data.writeBundle(args);
        data.writeStrongBinder(signal != null ? signal.asBinder() : null);

        mRemote.transact(IContentProvider.REFRESH_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        int success = reply.readInt();
        return (success == 0);
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 5
Source File: PrintJobInfo.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel parcel, int flags) {
    parcel.writeParcelable(mId, flags);
    parcel.writeString(mLabel);
    parcel.writeParcelable(mPrinterId, flags);
    parcel.writeString(mPrinterName);
    parcel.writeInt(mState);
    parcel.writeInt(mAppId);
    parcel.writeString(mTag);
    parcel.writeLong(mCreationTime);
    parcel.writeInt(mCopies);
    parcel.writeParcelableArray(mPageRanges, flags);
    parcel.writeParcelable(mAttributes, flags);
    parcel.writeParcelable(mDocumentInfo, 0);
    parcel.writeFloat(mProgress);
    parcel.writeCharSequence(mStatus);
    parcel.writeInt(mStatusRes);
    parcel.writeCharSequence(mStatusResAppPackageName);
    parcel.writeInt(mCanceling ? 1 : 0);
    parcel.writeBundle(mAdvancedOptions);
}
 
Example 6
Source File: Adjustment.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    if (mPackage != null) {
        dest.writeInt(1);
        dest.writeString(mPackage);
    } else {
        dest.writeInt(0);
    }
    if (mKey != null) {
        dest.writeInt(1);
        dest.writeString(mKey);
    } else {
        dest.writeInt(0);
    }
    if (mExplanation != null) {
        dest.writeInt(1);
        dest.writeCharSequence(mExplanation);
    } else {
        dest.writeInt(0);
    }
    dest.writeBundle(mSignals);
    dest.writeInt(mUser);
}
 
Example 7
Source File: PersistentSearchView.java    From persistentsearchview with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel parcel, int flags) {
    super.writeToParcel(parcel, flags);

    // Saving the data inside the bundle
    final Bundle bundle = new Bundle();
    bundle.putInt(KEY_QUERY_INPUT_HINT_COLOR, this.queryInputHintColor);
    bundle.putInt(KEY_QUERY_INPUT_TEXT_COLOR, this.queryInputTextColor);
    bundle.putInt(KEY_QUERY_INPUT_CURSOR_COLOR, this.queryInputCursorColor);
    bundle.putInt(KEY_INPUT_BAR_ICON_COLOR, this.inputBarIconColor);
    bundle.putInt(KEY_DIVIDER_COLOR, this.dividerColor);
    bundle.putInt(KEY_PROGRESS_BAR_COLOR, this.progressBarColor);
    bundle.putInt(KEY_SUGGESTION_ICON_COLOR, this.suggestionIconColor);
    bundle.putInt(KEY_RECENT_SEARCH_ICON_COLOR, this.recentSearchIconColor);
    bundle.putInt(KEY_SEARCH_SUGGESTION_ICON_COLOR, this.searchSuggestionIconColor);
    bundle.putInt(KEY_SUGGESTION_TEXT_COLOR, this.suggestionTextColor);
    bundle.putInt(KEY_SUGGESTION_SELECTED_TEXT_COLOR, this.suggestionSelectedTextColor);
    bundle.putInt(KEY_CARD_BACKGROUND_COLOR, this.cardBackgroundColor);
    bundle.putInt(KEY_BACKGROUND_DIM_COLOR, this.backgroundDimColor);
    bundle.putInt(KEY_CARD_CORNER_RADIUS, this.cardCornerRadius);
    bundle.putInt(KEY_CARD_ELEVATION, this.cardElevation);
    bundle.putFloat(KEY_DIM_AMOUNT, this.dimAmount);
    bundle.putString(KEY_QUERY, this.query);
    bundle.putString(KEY_INPUT_HINT, this.inputHint);
    bundle.putSerializable(KEY_STATE, this.state);
    bundle.putBoolean(KEY_IS_DISMISSIBLE_ON_TOUCH_OUTSIDE, this.isDismissibleOnTouchOutside);
    bundle.putBoolean(KEY_IS_PROGRESS_BAR_ENABLED, this.isProgressBarEnabled);
    bundle.putBoolean(KEY_IS_VOICE_INPUT_BUTTON_ENABLED, this.isVoiceInputButtonEnabled);
    bundle.putBoolean(KEY_IS_CLEAR_INPUT_BUTTON_ENABLED, this.isClearInputButtonEnabled);
    bundle.putBoolean(KEY_ARE_SUGGESTIONS_DISABLED, this.areSuggestionsDisabled);
    bundle.putBoolean(KEY_SHOULD_DIM_BEHIND, this.shouldDimBehind);

    parcel.writeBundle(bundle);
}
 
Example 8
Source File: HttpRequestParcel.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(uri);
    dest.writeString(method);
    dest.writeBundle(headers);
    dest.writeBundle(params);
    dest.writeString(entity);
    dest.writeBundle(files);

}
 
Example 9
Source File: AppVersionInfo.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(final Parcel dest, final int flags) {
    final Bundle bundle = new Bundle();
    bundle.putInt("versionCode", this.versionCode);
    bundle.putString("versionName", this.versionName);
    bundle.putString("releaseDate", this.releaseDate);
    bundle.putString("changelog", this.changelog);
    bundle.putString("downloadUrl", this.downloadUrl);
    bundle.putString("versionType", this.versionType);
    bundle.putString("packageName", this.packageName);
    bundle.putBoolean("forceUpdate", this.forceUpdate);
    dest.writeBundle(bundle);
}
 
Example 10
Source File: LogcatReaderLoader.java    From matlog with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(recordingMode ? 1 : 0);
    dest.writeInt(multiple ? 1 : 0);
    Bundle bundle = new Bundle();
    for (Entry<String, String> entry : lastLines.entrySet()) {
        bundle.putString(entry.getKey(), entry.getValue());
    }
    dest.writeBundle(bundle);
}
 
Example 11
Source File: FragmentState.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel parcel, int l)
{
    int i1 = 1;
    parcel.writeString(a);
    parcel.writeInt(b);
    int j1;
    int k1;
    if (c)
    {
        j1 = i1;
    } else
    {
        j1 = 0;
    }
    parcel.writeInt(j1);
    parcel.writeInt(d);
    parcel.writeInt(e);
    parcel.writeString(f);
    if (g)
    {
        k1 = i1;
    } else
    {
        k1 = 0;
    }
    parcel.writeInt(k1);
    if (!h)
    {
        i1 = 0;
    }
    parcel.writeInt(i1);
    parcel.writeBundle(i);
    parcel.writeBundle(j);
}
 
Example 12
Source File: MaterialMultiSelectListPreference.java    From talk-android with MIT License 4 votes vote down vote up
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeInt(isDialogShowing ? 1 : 0);
    dest.writeBundle(dialogBundle);
}
 
Example 13
Source File: DialogPreference.java    From EhViewer with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeInt(isDialogShowing ? 1 : 0);
    dest.writeBundle(dialogBundle);
}
 
Example 14
Source File: BundleParcelable.java    From android-parcelable-intellij-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeBundle(this.bundle);
}
 
Example 15
Source File: IPCDataTransfer.java    From IPCInvoker with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(@NonNull Object o, Parcel dest) {
    IPCData parcelable = (IPCData) o;
    dest.writeString(parcelable.getClass().getName());
    dest.writeBundle(parcelable.toBundle());
}
 
Example 16
Source File: ParcelUtil.java    From ParcelableGenerator with MIT License 4 votes vote down vote up
private static void writeValueInternal(Parcel dest, Object v) {
    if (v == null) {
        dest.writeInt(VAL_NULL);
    } else if (v instanceof String) {
        dest.writeInt(VAL_STRING);
        dest.writeString((String) v);
    } else if (v instanceof Integer) {
        dest.writeInt(VAL_INTEGER);
        dest.writeInt((Integer) v);
    } else if (v instanceof Map) {
        dest.writeInt(VAL_MAP);
        writeMap(dest, (Map) v);
    } else if (v instanceof Bundle) {
        // Must be before Parcelable
        dest.writeInt(VAL_BUNDLE);
        dest.writeBundle((Bundle) v);
    } else if (v instanceof Parcelable) {
        dest.writeInt(VAL_PARCELABLE);
        dest.writeParcelable((Parcelable) v, 0);
    } else if (v instanceof Short) {
        dest.writeInt(VAL_SHORT);
        dest.writeInt(((Short) v).intValue());
    } else if (v instanceof Long) {
        dest.writeInt(VAL_LONG);
        dest.writeLong((Long) v);
    } else if (v instanceof Float) {
        dest.writeInt(VAL_FLOAT);
        dest.writeFloat((Float) v);
    } else if (v instanceof Double) {
        dest.writeInt(VAL_DOUBLE);
        dest.writeDouble((Double) v);
    } else if (v instanceof Boolean) {
        dest.writeInt(VAL_BOOLEAN);
        dest.writeInt((Boolean) v ? 1 : 0);
    } else if (v instanceof CharSequence) {
        // Must be after String
        dest.writeInt(VAL_CHARSEQUENCE);
        TextUtils.writeToParcel((CharSequence) v, dest, 0);
    } else if (v instanceof List) {
        dest.writeInt(VAL_LIST);
        writeList(dest, (List) v);
    } else if (v instanceof SparseArray) {
        dest.writeInt(VAL_SPARSEARRAY);
        writeSparseArray(dest, (SparseArray<Object>) v);
    } else if (v instanceof boolean[]) {
        dest.writeInt(VAL_BOOLEANARRAY);
        dest.writeBooleanArray((boolean[]) v);
    } else if (v instanceof byte[]) {
        dest.writeInt(VAL_BYTEARRAY);
        dest.writeByteArray((byte[]) v);
    } else if (v instanceof String[]) {
        dest.writeInt(VAL_STRINGARRAY);
        dest.writeStringArray((String[]) v);
    } else if (v instanceof CharSequence[]) {
        // Must be after String[] and before Object[]
        dest.writeInt(VAL_CHARSEQUENCEARRAY);
        CharSequence[] val = (CharSequence[]) v;
        int N = val.length;
        dest.writeInt(N);
        for (int i = 0; i < N; i++) {
            TextUtils.writeToParcel((CharSequence) val[i], dest, 0);
        }
    } else if (v instanceof IBinder) {
        dest.writeInt(VAL_IBINDER);
        dest.writeStrongBinder((IBinder) v);
    } else if (v instanceof Parcelable[]) {
        dest.writeInt(VAL_PARCELABLEARRAY);
        dest.writeParcelableArray((Parcelable[]) v, 0);
    } else if (v instanceof Object[]) {
        dest.writeInt(VAL_OBJECTARRAY);
        writeArray(dest, (Object[]) v);
    } else if (v instanceof int[]) {
        dest.writeInt(VAL_INTARRAY);
        dest.writeIntArray((int[]) v);
    } else if (v instanceof long[]) {
        dest.writeInt(VAL_LONGARRAY);
        dest.writeLongArray((long[]) v);
    } else if (v instanceof Byte) {
        dest.writeInt(VAL_BYTE);
        dest.writeInt((Byte) v);
    } else if (v instanceof Serializable) {
        // Must be last
        dest.writeInt(VAL_SERIALIZABLE);
        dest.writeSerializable((Serializable) v);
    } else {
        throw new RuntimeException("Parcel: unable to marshal value " + v);
    }
}
 
Example 17
Source File: ViewPagerItem.java    From AndroidMaterialDialog with Apache License 2.0 4 votes vote down vote up
@Override
public final void writeToParcel(final Parcel dest, final int flags) {
    TextUtils.writeToParcel(getTitle(), dest, flags);
    dest.writeSerializable(getFragmentClass());
    dest.writeBundle(getArguments());
}
 
Example 18
Source File: DialogPreference.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeInt(isDialogShowing ? 1 : 0);
    dest.writeBundle(dialogBundle);
}
 
Example 19
Source File: SublimeNavigationView.java    From SublimeNavigationView with Apache License 2.0 4 votes vote down vote up
public void writeToParcel(@NonNull Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeBundle(sMenuState);
}
 
Example 20
Source File: Fragment.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeBundle(mState);
}