android.os.Parcel Java Examples

The following examples show how to use android.os.Parcel. 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: Linker.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void writeToParcel(Parcel out, int flags) {
    if (mRelroFd >= 0) {
        out.writeLong(mLoadAddress);
        out.writeLong(mLoadSize);
        out.writeLong(mRelroStart);
        out.writeLong(mRelroSize);
        try {
            ParcelFileDescriptor fd = ParcelFileDescriptor.fromFd(mRelroFd);
            fd.writeToParcel(out, 0);
            fd.close();
        } catch (java.io.IOException e) {
            Log.e(TAG, "Cant' write LibInfo file descriptor to parcel", e);
        }
    }
}
 
Example #2
Source File: DeviceProperty.java    From Mobilyzer with Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(deviceId);
  dest.writeString(appVersion);
  dest.writeLong(timestamp);
  dest.writeString(osVersion);
  dest.writeString(ipConnectivity);
  dest.writeString(dnResolvability);
  dest.writeParcelable(location, flags);
  dest.writeString(locationType);
  dest.writeString(networkType);
  dest.writeString(carrier);
  dest.writeString(countryCode);
  dest.writeInt(batteryLevel);
  dest.writeByte((byte) (isBatteryCharging ? 1 : 0));
  dest.writeString(cellInfo);
  dest.writeString(cellRssi);
  dest.writeInt(rssi);
  dest.writeString(ssid);
  dest.writeString(bssid);
  dest.writeString(wifiIpAddress);
  dest.writeString(mobilyzerVersion);
  dest.writeStringList(hostApps);
  dest.writeString(requestApp);
}
 
Example #3
Source File: PayPalLineItemUnitTest.java    From braintree_android with MIT License 6 votes vote down vote up
@Test
public void parcelsCorrectly() {
    PayPalLineItem item = new PayPalLineItem(PayPalLineItem.KIND_DEBIT, "An Item", "1", "2");
    item.setDescription("A new item");
    item.setProductCode("abc-123");
    item.setUnitTaxAmount("1.50");
    item.setUrl("http://example.com");

    Parcel parcel = Parcel.obtain();
    item.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    PayPalLineItem result = PayPalLineItem.CREATOR.createFromParcel(parcel);

    assertEquals("debit", result.getKind());
    assertEquals("An Item", result.getName());
    assertEquals("1", result.getQuantity());
    assertEquals("2", result.getUnitAmount());
    assertEquals("A new item", result.getDescription());
    assertEquals("abc-123", result.getProductCode());
    assertEquals("1.50", result.getUnitTaxAmount());
    assertEquals("http://example.com", result.getUrl());
}
 
Example #4
Source File: PayPalAccountNonceUnitTest.java    From braintree_android with MIT License 6 votes vote down vote up
@Test
public void parcelsCorrectly_ifCreditFinancingNotPresent() throws JSONException {
    JSONObject response = new JSONObject(stringFromFixture("payment_methods/paypal_account_response.json"));
    response.getJSONArray("paypalAccounts").getJSONObject(0).getJSONObject("details").remove("creditFinancingOffered");
    PayPalAccountNonce payPalAccountNonce = PayPalAccountNonce.fromJson(response.toString());
    assertNull(payPalAccountNonce.getCreditFinancing());

    Parcel parcel = Parcel.obtain();
    payPalAccountNonce.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);

    PayPalAccountNonce parceled = PayPalAccountNonce.CREATOR.createFromParcel(parcel);

    assertNull(parceled.getCreditFinancing());

    assertEquals("with email [email protected]", parceled.getDescription());
    assertEquals("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", parceled.getNonce());
    assertEquals("[email protected]", parceled.getEmail());
    assertEquals("PayPal", parceled.getTypeLabel());
    assertEquals("123 Fake St.", parceled.getBillingAddress().getStreetAddress());
    assertEquals("Apt. 3", parceled.getBillingAddress().getExtendedAddress());
    assertEquals("Oakland", parceled.getBillingAddress().getLocality());
    assertEquals("CA", parceled.getBillingAddress().getRegion());
    assertEquals("94602", parceled.getBillingAddress().getPostalCode());
    assertEquals("US", parceled.getBillingAddress().getCountryCodeAlpha2());
}
 
Example #5
Source File: PostsPage.java    From Dashchan with Apache License 2.0 6 votes vote down vote up
@Override
public void readFromParcel(Parcel source) {
	@SuppressWarnings("unchecked")
	ArrayList<ReadPostsTask.UserPostPending> userPostPendings = source
			.readArrayList(PostsExtra.class.getClassLoader());
	if (userPostPendings.size() > 0) {
		this.userPostPendings.addAll(userPostPendings);
	}
	String[] data = source.createStringArray();
	if (data != null) {
		Collections.addAll(expandedPosts, data);
	}
	isAddedToHistory = source.readInt() != 0;
	forceRefresh = source.readInt() != 0;
	newPostNumber = source.readString();
}
 
Example #6
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public boolean newSession(ICustomTabsCallback callback) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();

    boolean _result;
    try {
        _data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
        _data.writeStrongBinder(callback != null?callback.asBinder():null);
        this.mRemote.transact(3, _data, _reply, 0);
        _reply.readException();
        _result = 0 != _reply.readInt();
    } finally {
        _reply.recycle();
        _data.recycle();
    }

    return _result;
}
 
Example #7
Source File: Voice.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private Voice(Parcel in) {
    this.mName = in.readString();
    this.mLocale = (Locale)in.readSerializable();
    this.mQuality = in.readInt();
    this.mLatency = in.readInt();
    this.mRequiresNetworkConnection = (in.readByte() == 1);
    this.mFeatures = new HashSet<String>();
    Collections.addAll(this.mFeatures, in.readStringArray());
}
 
Example #8
Source File: Weather.java    From MaterialCalendar with Apache License 2.0 5 votes vote down vote up
private void readFromParcel(Parcel source) throws JSONException {
    date = source.readString();
    currentCity = source.readString();
    pm25 = source.readString();
    index = new JSONArray(source.readString());
    weather_data = new JSONObject(source.readString());
}
 
Example #9
Source File: EditorModel.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeByte((byte) (circleEditing ? 1 : 0));
  dest.writeInt(size.x);
  dest.writeInt(size.y);
  dest.writeParcelable(editorElementHierarchy.getRoot(), flags);
  dest.writeParcelable(undoRedoStacks, flags);
  dest.writeParcelable(cropUndoRedoStacks, flags);
}
 
Example #10
Source File: Parcelables.java    From spark-sdk-android with Apache License 2.0 5 votes vote down vote up
public static void writeStringMap(Parcel parcel, Map<String, String> stringMap) {
    Bundle b = new Bundle();
    for (Map.Entry<String, String> entry : stringMap.entrySet()) {
        b.putString(entry.getKey(), entry.getValue());
    }
    parcel.writeBundle(b);
}
 
Example #11
Source File: Attachment.java    From KlyphMessenger with MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags)
{
	dest.writeString(caption);
	dest.writeString(description);
	dest.writeParcelable(fb_checkin, PARCELABLE_WRITE_RETURN_VALUE);
	dest.writeString(fb_object_id);
	dest.writeString(fb_object_type);
	dest.writeString(href);
	dest.writeString(icon);
	dest.writeTypedList(media);
	dest.writeString(name);
	dest.writeString(properties);
}
 
Example #12
Source File: CommandResult.java    From android-kernel-tweaker with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("CastToConcreteClass")
public CommandResult(Parcel inParcel) {
    this(inParcel.readLong(),
            inParcel.readInt(),
            inParcel.readString(),
            inParcel.readString(),
            inParcel.readLong());
}
 
Example #13
Source File: MessageSnapshot.java    From FileDownloader with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeByte((byte) (isLargeFile ? 1 : 0));
    dest.writeByte(getStatus());
    // normal
    dest.writeInt(this.id);
}
 
Example #14
Source File: AppUserTurnstile.java    From mapbox-events-android with MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(event);
  dest.writeString(created);
  dest.writeString(userId);
  dest.writeByte((byte) (enabledTelemetry ? 0x01 : 0x00));
  dest.writeString(device);
  dest.writeString(sdkIdentifier);
  dest.writeString(sdkVersion);
  dest.writeString(model);
  dest.writeString(operatingSystem);
  dest.writeString(skuId);
}
 
Example #15
Source File: FavListBean.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {

    dest.writeInt(total_number);
    dest.writeString(previous_cursor);
    dest.writeString(next_cursor);

    dest.writeTypedList(favorites);
    dest.writeTypedList(actualStore);
}
 
Example #16
Source File: DevCatalog.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel parcel, int i) {
    parcel.writeString(mId);
    parcel.writeString(mTitle);
    parcel.writeString(description);
    parcel.writeString(mImageUrl);
    parcel.writeInt(type);
    if (parent == null) {
        parcel.writeByte((byte) 0);
    } else {
        parcel.writeByte((byte) 1);
        ((DevCatalog) parent).writeToParcel(parcel, i);
    }
}
 
Example #17
Source File: DefaultMsgConfig.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(leaveApp);
    dest.writeString(confirm);
    dest.writeString(cancel);
    dest.writeString(title);
}
 
Example #18
Source File: MediaFileListFragment.java    From Kore with Apache License 2.0 5 votes vote down vote up
private FileLocation(Parcel in) {
    this.title = in.readString();
    this.file = in.readString();
    this.isDirectory = (in.readInt() != 0);
    this.hasParent = (in.readInt() != 0);
    this.isRoot = (in.readInt() != 0);

    this.details = in.readString();
    this.sizeDuration = in.readString();
    this.artUrl = in.readString();
}
 
Example #19
Source File: NFCTagPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags)
{
    super.writeToParcel(dest, flags);

    dest.writeString(value);
    dest.writeString(defaultValue);
}
 
Example #20
Source File: LockPatternView.java    From quickmark with MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
	super.writeToParcel(dest, flags);
	dest.writeString(mSerializedPattern);
	dest.writeInt(mDisplayMode);
	dest.writeValue(mInputEnabled);
	dest.writeValue(mInStealthMode);
	dest.writeValue(mTactileFeedbackEnabled);
}
 
Example #21
Source File: MissServiceBean.java    From UPMiss with GNU General Public License v3.0 5 votes vote down vote up
protected MissServiceBean(Parcel in) {
    timeLine = in.createTypedArrayList(RecordViewModel.CREATOR);
    contacts = in.createTypedArrayList(ContactViewModel.CREATOR);

    newest = new FixedList<NewestModel>(5);
    List<NewestModel> models = in.createTypedArrayList(NewestModel.CREATOR);
    newest.addAll(models);

    birthdayCount = in.readLong();
    memorialCount = in.readLong();
    futureCount = in.readLong();
}
 
Example #22
Source File: Items.java    From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mId);
    dest.writeInt(mUniqueId);
    dest.writeInt(mName);
    dest.writeInt(mDescription);
    dest.writeString(mNameText);
    dest.writeString(mDescriptionText);
    dest.writeString(mDefault);
    dest.writeByte((byte) (mRequired ? 1 : 0));
    dest.writeByte((byte) (mScript ? 1 : 0));
    dest.writeInt(mUnit == null ? -1 : mUnit.getId());
}
 
Example #23
Source File: ParcelableUtil.java    From ClockPlus with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] marshall(Parcelable parcelable) {
    Parcel parcel = Parcel.obtain();
    parcelable.writeToParcel(parcel, 0);
    byte[] bytes = parcel.marshall();
    parcel.recycle();
    return bytes;
}
 
Example #24
Source File: MessagePdu.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public MessagePdu createFromParcel(Parcel source) {
    int size = source.readInt();
    List<byte[]> pduList;
    if (size == NULL_LENGTH) {
        pduList = null;
    } else {
        pduList = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            pduList.add(source.createByteArray());
        }
    }
    return new MessagePdu(pduList);
}
 
Example #25
Source File: Botification.java    From Botifier with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Botification createFromParcel(Parcel in) {
	int id = in.readInt();
	String pkg = in.readString();
	String tag = in.readString();
	String description = in.readString();
	String text = in.readString();
    return new Botification(id, pkg, tag, description, text);
}
 
Example #26
Source File: AbsNormalEntity.java    From Aria with Apache License 2.0 5 votes vote down vote up
@Override public void writeToParcel(Parcel dest, int flags) {
  super.writeToParcel(dest, flags);
  dest.writeString(this.url);
  dest.writeString(this.fileName);
  dest.writeByte(this.isGroupChild ? (byte) 1 : (byte) 0);
  dest.writeByte(this.isRedirect ? (byte) 1 : (byte) 0);
  dest.writeString(this.redirectUrl);
}
 
Example #27
Source File: LightXylSetupServer.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private LightXylSetupServer(final Parcel source) {
    super(source);
}
 
Example #28
Source File: SavedState.java    From HorizontalWheelView with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel out, int flags) {
    super.writeToParcel(out, flags);
    out.writeValue(angle);
}
 
Example #29
Source File: ArrayOfArrayOfNumberOnly.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
public ArrayOfArrayOfNumberOnly createFromParcel(Parcel in) {
  return new ArrayOfArrayOfNumberOnly(in);
}
 
Example #30
Source File: AnimatedRoundCornerProgressBar.java    From RoundCornerProgressBar with Apache License 2.0 4 votes vote down vote up
@Override
public SavedState createFromParcel(Parcel in, ClassLoader loader) {
    return new SavedState(in, loader);
}