Java Code Examples for android.os.Parcel

The following examples show how to use android.os.Parcel. These examples are extracted from open source projects. 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 Project: Dashchan   Author: Mishiranu   File: PostsPage.java    License: 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 #2
Source Project: TelePlus-Android   Author: TelePlusDev   File: ICustomTabsService.java    License: 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 #3
Source Project: braintree_android   Author: braintree   File: PayPalLineItemUnitTest.java    License: 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 Project: braintree_android   Author: braintree   File: PayPalAccountNonceUnitTest.java    License: 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 Project: Mobilyzer   Author: mobilyzer   File: DeviceProperty.java    License: 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 #6
Source Project: android-chromium   Author: eduplus   File: Linker.java    License: 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 #7
Source Project: deltachat-android   Author: deltachat   File: EditorModel.java    License: 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 #8
Source Project: iBeebo   Author: andforce   File: FavListBean.java    License: 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 #9
Source Project: android-kernel-tweaker   Author: cesco89   File: CommandResult.java    License: 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 #10
Source Project: 4pdaClient-plus   Author: slartus   File: DevCatalog.java    License: 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 #11
Source Project: KlyphMessenger   Author: jonathangerbaud   File: Attachment.java    License: 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 Project: android_9.0.0_r45   Author: lulululbj   File: Voice.java    License: 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 #13
Source Project: PhoneProfilesPlus   Author: henrichg   File: NFCTagPreferenceX.java    License: 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 #14
Source Project: UPMiss   Author: qiujuer   File: MissServiceBean.java    License: 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 #15
Source Project: ClockPlus   Author: philliphsu   File: ParcelableUtil.java    License: 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 #16
Source Project: AgentWebX5   Author: Justson   File: DefaultMsgConfig.java    License: 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 #17
Source Project: Botifier   Author: grimpy   File: Botification.java    License: 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 #18
Source Project: mapbox-events-android   Author: mapbox   File: AppUserTurnstile.java    License: 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 #19
Source Project: MaterialCalendar   Author: Haoxiqiang   File: Weather.java    License: 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 #20
Source Project: MTweaks-KernelAdiutorMOD   Author: morogoku   File: Items.java    License: 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 #21
Source Project: Aria   Author: AriaLyy   File: AbsNormalEntity.java    License: 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 #22
Source Project: android_9.0.0_r45   Author: lulululbj   File: MessagePdu.java    License: 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 #23
Source Project: quickmark   Author: linmp4   File: LockPatternView.java    License: 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 #24
Source Project: Kore   Author: xbmc   File: MediaFileListFragment.java    License: 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 #25
Source Project: spark-sdk-android   Author: particle-iot   File: Parcelables.java    License: 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 #26
Source Project: FileDownloader   Author: lingochamp   File: MessageSnapshot.java    License: 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 #27
Source Project: ETHWallet   Author: snailflying   File: Transaction.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public Transaction createFromParcel(Parcel in) {
    return new Transaction(in);
}
 
Example #28
Source Project: alpha-wallet-android   Author: AlphaWallet   File: ERC721Token.java    License: MIT License 4 votes vote down vote up
@Override
public ERC721Token createFromParcel(Parcel in) {
    return new ERC721Token(in);
}
 
Example #29
Source Project: fingen   Author: YoshiOne   File: SmsMarker.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public SmsMarker createFromParcel(Parcel source) {
    return new SmsMarker(source);
}
 
Example #30
Source Project: InlineActivityResult   Author: florent37   File: RequestActivityForResult.java    License: MIT License 4 votes vote down vote up
public RequestActivityForResult createFromParcel(Parcel in) {
    return new RequestActivityForResult(in);
}