Java Code Examples for android.os.Parcel

The following are top voted examples for showing how to use android.os.Parcel. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: kognitivo   File: LoginClient.java   View source code 7 votes vote down vote up
public LoginClient(Parcel source) {
    Object [] o = source.readParcelableArray(LoginMethodHandler.class.getClassLoader());
    handlersToTry = new LoginMethodHandler[o.length];
    for (int i = 0; i < o.length; ++i) {
        handlersToTry[i] = (LoginMethodHandler) o[i];
        handlersToTry[i].setLoginClient(this);
    }
    currentHandler = source.readInt();
    pendingRequest = source.readParcelable(Request.class.getClassLoader());
    loggingExtras = Utility.readStringMapFromParcel(source);
}
 
Example 2
Project: mvvm-template   File: ReactionsModel.java   View source code 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(this.id);
    dest.writeString(this.url);
    dest.writeInt(this.total_count);
    dest.writeInt(this.plusOne);
    dest.writeInt(this.minusOne);
    dest.writeInt(this.laugh);
    dest.writeInt(this.hooray);
    dest.writeInt(this.confused);
    dest.writeInt(this.heart);
    dest.writeString(this.content);
    dest.writeParcelable(this.user, flags);
    dest.writeByte(this.viewerHasReacted ? (byte) 1 : (byte) 0);
    dest.writeByte(this.isCallingApi ? (byte) 1 : (byte) 0);
}
 
Example 3
Project: AURdroid   File: AurInfoResult.java   View source code 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeValue(this.iD);
    dest.writeString(this.name);
    dest.writeValue(this.packageBaseID);
    dest.writeString(this.packageBase);
    dest.writeString(this.version);
    dest.writeString(this.description);
    dest.writeString(this.uRL);
    dest.writeValue(this.numVotes);
    dest.writeValue(this.popularity);
    dest.writeString(this.outOfDate);
    dest.writeString(this.maintainer);
    dest.writeValue(this.firstSubmitted);
    dest.writeValue(this.lastModified);
    dest.writeString(this.uRLPath);
    dest.writeStringList(this.depends);
    dest.writeStringList(this.makeDepends);
    dest.writeStringList(this.optDepends);
    dest.writeStringList(this.conflicts);
    dest.writeStringList(this.provides);
    dest.writeStringList(this.license);
    dest.writeStringList(this.keywords);
}
 
Example 4
Project: polling-station-app   File: TestVoter.java   View source code 6 votes vote down vote up
@Test
public void testVoterParcelMale() {
    Voter voter = new Voter(firstName, lastName, Gender.MALE);


    Parcel parcel = Parcel.obtain();
    voter.writeToParcel(parcel, 0);

    // After you're done with writing, you need to reset the parcel for reading:
    parcel.setDataPosition(0);

    // Reconstruct object from parcel and asserts:
    Voter createdFromParcel = Voter.CREATOR.createFromParcel(parcel);

    assertEquals(voter.getFirstName(), createdFromParcel.getFirstName());
    assertEquals(voter.getLastName(), createdFromParcel.getLastName());
    assertEquals(voter.getGender(), createdFromParcel.getGender());
}
 
Example 5
Project: Phoenix-for-VK   File: ParcelUtils.java   View source code 6 votes vote down vote up
public static Map<Integer, String> readIntStringMap(Parcel in){
    boolean isNull = in.readByte() == (byte) 1;
    if(isNull){
        return null;
    }

    int size = in.readInt();
    Map<Integer, String> map = new HashMap<>(size);
    for(int i = 0; i < size; i++){
        Integer key = readObjectInteger(in);
        String value = in.readString();
        map.put(key, value);
    }

    return map;
}
 
Example 6
Project: dagger-test-example   File: List.java   View source code 6 votes vote down vote up
@SuppressWarnings({
    "unchecked"
})
public List createFromParcel(Parcel in) {
    List instance = new List();
    instance.dt = ((int) in.readValue((int.class.getClassLoader())));
    instance.temp = ((Temp) in.readValue((Temp.class.getClassLoader())));
    instance.pressure = ((double) in.readValue((double.class.getClassLoader())));
    instance.humidity = ((int) in.readValue((int.class.getClassLoader())));
    in.readList(instance.weather, (Weather.class.getClassLoader()));
    instance.speed = ((double) in.readValue((double.class.getClassLoader())));
    instance.deg = ((int) in.readValue((int.class.getClassLoader())));
    instance.clouds = ((int) in.readValue((int.class.getClassLoader())));
    instance.rain = ((double) in.readValue((double.class.getClassLoader())));
    return instance;
}
 
Example 7
Project: Matisse   File: Item.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(id);
    dest.writeString(mimeType);
    dest.writeParcelable(uri, 0);
    dest.writeLong(size);
    dest.writeLong(duration);
}
 
Example 8
Project: Camera-Roll-Android-App   File: AlbumItem.java   View source code 5 votes vote down vote up
@Override
public AlbumItem createFromParcel(Parcel parcel) {
    switch (parcel.readInt()) {
        case VIDEO:
            return new Video(parcel);
        case GIF:
            return new Gif(parcel);
        case RAW:
            return new RAWImage(parcel);
        default:
            return new Photo(parcel);
    }
}
 
Example 9
Project: DroidIPC   File: ServiceManagerImpl.java   View source code 5 votes vote down vote up
/**
 * 检查所有的服务是否已经就位(已经添加到{@link ServiceManagerThread})
 * @return
 */
private boolean isReadyRemote(){
	Parcel data = Parcel.obtain();
	Parcel reply = Parcel.obtain();
	try {
		mRemoteServiceManager.transact(ServiceContext.READY_REMOTE, data, reply, 0);
		int result = reply.readInt();
		
		if(result == ServiceContext.SUCCESS) {
			
			log("remote service manager ready");
			
			return true;
		}
		
		log("remote service manager not ready");
		
		return false;
	} catch (RemoteException e) {
		e.printStackTrace();
		log("getService exception");
		return false;
	} finally {
		data.recycle();
		reply.recycle();
	}
}
 
Example 10
Project: HeroVideo-master   File: UserLiveRoomStatusInfo.java   View source code 5 votes vote down vote up
protected DataBean(Parcel in)
{

    this.roomStatus = in.readInt();
    this.liveStatus = in.readInt();
    this.url = in.readString();
    this.title = in.readString();
    this.cover = in.readString();
    this.online = in.readInt();
    this.roomid = in.readInt();
}
 
Example 11
Project: Hubs   File: PropertyVO.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.key);
    dest.writeString(this.value);
    dest.writeString(this.oldValue);
    dest.writeInt(this.selectionStart);
    dest.writeInt(this.selectionEnd);
    dest.writeByte(this.isFoucused ? (byte) 1 : (byte) 0);
}
 
Example 12
Project: android_ui   File: CalendarView.java   View source code 5 votes vote down vote up
/**
 * Called from {@link #CREATOR} to create an instance of SavedState form the given parcel
 * <var>source</var>.
 *
 * @param source Parcel with data for the new instance.
 */
protected SavedState(@NonNull Parcel source) {
	super(source);
	this.dateVisible = source.readLong();
	this.dateSelected = (Long) source.readValue(Long.class.getClassLoader());
	this.selectedDayMonthPosition = source.readInt();
	this.locale = (Locale) source.readSerializable();
	this.adapterState = source.readParcelable(UiConfig.class.getClassLoader());
}
 
Example 13
Project: AndroidMuseumBleManager   File: ScanResultCompat.java   View source code 5 votes vote down vote up
private void readFromParcel(Parcel in) {
    if (in.readInt() == 1) {
        mDevice = BluetoothLeDevice.CREATOR.createFromParcel(in);
    }
    if (in.readInt() == 1) {
        mScanRecord = ScanRecordCompat.parseFromBytes(in.createByteArray());
    }
    mRssi = in.readInt();
    mTimestampNanos = in.readLong();
}
 
Example 14
Project: IFTTTSDK-Android   File: Applet.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel parcel, int i) {
    parcel.writeString(id);
    parcel.writeString(name);
    parcel.writeString(description);
    parcel.writeString(status.name());
    parcel.writeLong(publishedAt != null ? publishedAt.getTime() : -1L);
    parcel.writeInt(enabledCount);
    parcel.writeLong(lastRunAt != null ? lastRunAt.getTime() : -1L);
    parcel.writeString(url);
    parcel.writeString(embeddedUrl);
    parcel.writeTypedList(services);
}
 
Example 15
Project: exciting-app   File: ProgressWheel.java   View source code 5 votes vote down vote up
private WheelSavedState(Parcel in) {
    super(in);
    this.mProgress = in.readFloat();
    this.mTargetProgress = in.readFloat();
    this.isSpinning = in.readByte() != 0;
    this.spinSpeed = in.readFloat();
    this.barWidth = in.readInt();
    this.barColor = in.readInt();
    this.rimWidth = in.readInt();
    this.rimColor = in.readInt();
    this.circleRadius = in.readInt();
    this.linearProgress = in.readByte() != 0;
    this.fillRadius = in.readByte() != 0;
}
 
Example 16
Project: CustomAndroidOneSheeld   File: LockPatternViewEx.java   View source code 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 17
Project: TPlayer   File: VirtualLocationService.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.mode);
    dest.writeParcelable(this.cell, flags);
    dest.writeTypedList(this.allCell);
    dest.writeTypedList(this.neighboringCell);
    dest.writeParcelable(this.location, flags);
}
 
Example 18
Project: newIPlay   File: Zhuanlan.java   View source code 5 votes vote down vote up
protected InfoBean(Parcel in) {
    this.followUserCount = in.readString();
    this.topicDescription = in.readString();
    this.listImg = in.readString();
    this.topicId = in.readString();
    this.topicName = in.readString();
}
 
Example 19
Project: IslamicLibraryAndroid   File: BookCategory.java   View source code 5 votes vote down vote up
public BookCategory(Parcel in) {
    this.id = in.readInt();
    this.order = in.readInt();
    this.name = in.readString();
    this.numberOfBooks = in.readInt();
    this.hasDownloadedBooks = in.readByte() != 0;
}
 
Example 20
Project: UpdogFarmer   File: Game.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel parcel, int i) {
    parcel.writeInt(appId);
    parcel.writeString(name);
    parcel.writeString(iconUrl);
    parcel.writeFloat(hoursPlayed);
    parcel.writeInt(dropsRemaining);
}
 
Example 21
Project: Book-Shelf   File: Cart.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeValue(this.id);
    dest.writeString(this.cdate);
    dest.writeValue(this.amount);
    dest.writeValue(this.userId);
    dest.writeValue(this.itemId);
}
 
Example 22
Project: NotifyTools   File: Tangshi.java   View source code 5 votes vote down vote up
@Override public void writeToParcel(Parcel dest, int flags) {
  dest.writeValue(this.id);
  dest.writeString(this.author);
  dest.writeString(this.title);
  dest.writeString(this.strains);
  dest.writeString(this.paragraphs);
  dest.writeString(this.pyquany);
  dest.writeString(this.pyjian);
  dest.writeString(this.authorjt);
  dest.writeString(this.pyquan);
}
 
Example 23
Project: GitHub   File: BoxingCropOption.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeParcelable(this.mDestination, flags);
    dest.writeFloat(this.mAspectRatioX);
    dest.writeFloat(this.mAspectRatioY);
    dest.writeInt(this.mMaxWidth);
    dest.writeInt(this.mMaxHeight);
}
 
Example 24
Project: choreographer-example   File: TransitioningChoreographer.java   View source code 5 votes vote down vote up
private State(Parcel in) {
    int[] ordinals = new int[2];
    in.readIntArray(ordinals);
    in.readLongArray(startTimes);
    this.transitionStartTime = in.readLong();

    int i = 0;
    for (int ordinal : ordinals) {
        taggingStates[i++] = FunkyView.State.values()[ordinal];
    }
}
 
Example 25
Project: nongbeer-mvp-android-demo   File: BeerProductItem.java   View source code 5 votes vote down vote up
protected BeerProductItem( Parcel in ){
    super( in );
    this.id = in.readString();
    this.alcohol = in.readString();
    this.image = in.readString();
    this.name = in.readString();
    this.price = in.readInt();
    this.volume = in.readString();
    this.amount = in.readInt();
    this.isAdded = in.readByte() != 0;
}
 
Example 26
Project: MovieApp   File: ProductionCompany.java   View source code 5 votes vote down vote up
@SuppressWarnings({
    "unchecked"
})
public ProductionCompany createFromParcel(Parcel in) {
    ProductionCompany instance = new ProductionCompany();
    instance.name = ((String) in.readValue((String.class.getClassLoader())));
    instance.id = ((Integer) in.readValue((Integer.class.getClassLoader())));
    return instance;
}
 
Example 27
Project: garras   File: Collection.java   View source code 5 votes vote down vote up
protected Urls(Parcel in) {
    raw = in.readString();
    full = in.readString();
    regular = in.readString();
    small = in.readString();
    thumb = in.readString();
}
 
Example 28
Project: AgentWeb   File: DefaultMsgConfig.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mTaskHasBeenExist);
    dest.writeString(mTips);
    dest.writeString(mHoneycomblow);
    dest.writeString(mDownLoad);
    dest.writeString(mCancel);
    dest.writeString(mDownLoadFail);
    dest.writeString(mLoading);
    dest.writeString(mTrickter);
    dest.writeString(mFileDownLoad);
    dest.writeString(mClickOpen);
}
 
Example 29
Project: letv   File: RemoteDeviceManager.java   View source code 5 votes vote down vote up
public void registerDeviceCallback(String deviceId, DeviceCallback callback, int events) throws RemoteException {
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(Stub.DESCRIPTOR);
        _data.writeString(deviceId);
        _data.writeStrongBinder(callback != null ? callback.asBinder() : null);
        _data.writeInt(events);
        this.mRemote.transact(5, _data, _reply, 0);
        ExceptionUtils.readExceptionFromParcel(_reply);
    } finally {
        _reply.recycle();
        _data.recycle();
    }
}
 
Example 30
Project: mvvm-template   File: SourceModel.java   View source code 5 votes vote down vote up
@Override public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.type);
    dest.writeParcelable(this.issue, flags);
    dest.writeParcelable(this.pullRequest, flags);
    dest.writeParcelable(this.commit, flags);
    dest.writeParcelable(this.repository, flags);
}
 
Example 31
Project: garras   File: Collection.java   View source code 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(id);
    dest.writeString(title);
    dest.writeString(description);
    dest.writeString(published_at);
    dest.writeByte((byte) (curated ? 1 : 0));
    dest.writeInt(total_photos);
    dest.writeByte((byte) (privateX ? 1 : 0));
    dest.writeString(share_key);
    dest.writeParcelable(cover_photo, flags);
    dest.writeParcelable(user, flags);
    dest.writeParcelable(links, flags);
    dest.writeTypedList(tags);
}
 
Example 32
Project: Pickr   File: PointOfInterest.java   View source code 4 votes vote down vote up
public PointOfInterest createFromParcel(Parcel source) {
    return new PointOfInterest(source);
}
 
Example 33
Project: state-bundle   File: TestKey.java   View source code 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(name);
}
 
Example 34
Project: GsonParser   File: SpecialResponse.java   View source code 4 votes vote down vote up
protected SpecialResponse(Parcel in) {
    res = in.readParcelable(Res.class.getClassLoader());
    data = in.readString();
}
 
Example 35
Project: OpenHub   File: TrendingLanguage.java   View source code 4 votes vote down vote up
protected TrendingLanguage(Parcel in) {
    this.name = in.readString();
    this.slug = in.readString();
    this.order = in.readInt();
    this.selected = in.readByte() != 0;
}
 
Example 36
Project: BLPlayer   File: VideoItem.java   View source code 4 votes vote down vote up
@Override
public StatBean createFromParcel(Parcel source) {
    return new StatBean(source);
}
 
Example 37
Project: Trackr   File: CustomLocation.java   View source code 4 votes vote down vote up
@Override
public CustomLocation createFromParcel(Parcel source) {
    return new CustomLocation(source);
}
 
Example 38
Project: GitHub   File: SmallMessageSnapshot.java   View source code 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeInt(this.retryingTimes);
}
 
Example 39
Project: Hands-On-Android-UI-Development   File: Attachment.java   View source code 4 votes vote down vote up
protected Attachment(final Parcel in) {
    file = new File(in.readString());
    type = Type.values()[in.readInt()];
}
 
Example 40
Project: Hexis   File: QuadrantItem.java   View source code 4 votes vote down vote up
public QuadrantItem createFromParcel(Parcel in) {
  return new QuadrantItem(in);
}