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

The following examples show how to use android.os.Parcel#readValue() . 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: FormatTest.java    From openapi-generator with Apache License 2.0 6 votes vote down vote up
FormatTest(Parcel in) {
  integer = (Integer)in.readValue(null);
  int32 = (Integer)in.readValue(null);
  int64 = (Long)in.readValue(null);
  number = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader());
  _float = (Float)in.readValue(null);
  _double = (Double)in.readValue(null);
  string = (String)in.readValue(null);
  _byte = (byte[])in.readValue(null);
  binary = (File)in.readValue(File.class.getClassLoader());
  date = (LocalDate)in.readValue(LocalDate.class.getClassLoader());
  dateTime = (OffsetDateTime)in.readValue(OffsetDateTime.class.getClassLoader());
  uuid = (UUID)in.readValue(UUID.class.getClassLoader());
  password = (String)in.readValue(null);
  bigDecimal = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader());
}
 
Example 2
Source File: Result.java    From AndroidUnplash with MIT License 6 votes vote down vote up
@SuppressWarnings({
    "unchecked"
})
public Result createFromParcel(Parcel in) {
    Result instance = new Result();
    instance.id = ((String) in.readValue((String.class.getClassLoader())));
    instance.createdAt = ((String) in.readValue((String.class.getClassLoader())));
    instance.updatedAt = ((String) in.readValue((String.class.getClassLoader())));
    instance.width = ((Integer) in.readValue((Integer.class.getClassLoader())));
    instance.height = ((Integer) in.readValue((Integer.class.getClassLoader())));
    instance.color = ((String) in.readValue((String.class.getClassLoader())));
    instance.likes = ((Integer) in.readValue((Integer.class.getClassLoader())));
    instance.likedByUser = ((Boolean) in.readValue((Boolean.class.getClassLoader())));
    instance.user = ((User) in.readValue((User.class.getClassLoader())));
    in.readList(instance.currentUserCollections, (java.lang.Object.class.getClassLoader()));
    instance.urls = ((Urls) in.readValue((Urls.class.getClassLoader())));
    in.readList(instance.categories, (Category.class.getClassLoader()));
    instance.links = ((Links) in.readValue((Links.class.getClassLoader())));
    return instance;
}
 
Example 3
Source File: CoolDetailsResponse.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings({
        "unchecked"
})
public CoolDetailsResponse createFromParcel(Parcel in) {
    CoolDetailsResponse instance = new CoolDetailsResponse();
    instance.hash = ((String) in.readValue((String.class.getClassLoader())));
    instance.addr = ((String) in.readValue((String.class.getClassLoader())));
    instance.bund = ((String) in.readValue((String.class.getClassLoader())));
    return instance;
}
 
Example 4
Source File: NestedModelFilter.java    From fingen with Apache License 2.0 5 votes vote down vote up
protected NestedModelFilter(Parcel in) {
    this.mIdList = (HashSet<Long>) in.readSerializable();
    this.mEnabled = (Boolean) in.readValue(Boolean.class.getClassLoader());
    this.mModelType = in.readInt();
    this.mInverted = in.readByte() != 0;
    this.mIncludeChildren = in.readByte() != 0;
    this.mId = in.readLong();
}
 
Example 5
Source File: WrappedPlace.java    From okuki with Apache License 2.0 5 votes vote down vote up
private WrappedPlace(Parcel parcel) {
    placeClass = (Class<T>) parcel.readSerializable();
    dataClass = (Class) parcel.readSerializable();
    if (Void.class.equals(dataClass)) {
        data = parcel.readValue(String.class.getClassLoader());
    } else if (Parcelable.class.isAssignableFrom(dataClass)) {
        data = parcel.readParcelable(dataClass.getClassLoader());
    } else if (Serializable.class.isAssignableFrom(dataClass)) {
        data = parcel.readSerializable();
    } else {
        throw new RuntimeException(String.format("Error restoring place %s", placeClass));
    }
}
 
Example 6
Source File: TypeHolderExample.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
TypeHolderExample(Parcel in) {
  stringItem = (String)in.readValue(null);
  numberItem = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader());
  floatItem = (Float)in.readValue(null);
  integerItem = (Integer)in.readValue(null);
  boolItem = (Boolean)in.readValue(null);
  arrayItem = (List<Integer>)in.readValue(null);
}
 
Example 7
Source File: Data.java    From hawkular-android-client with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({
    "unchecked"
})
public Data createFromParcel(Parcel in) {
    Data instance = new Data();
    instance.timestamp = ((Long) in.readValue((Integer.class.getClassLoader())));
    instance.value = ((String) in.readValue((String.class.getClassLoader())));
    instance.tags = ((Tags) in.readValue((Tags.class.getClassLoader())));
    return instance;
}
 
Example 8
Source File: Dialog.java    From timecat with Apache License 2.0 5 votes vote down vote up
protected Builder(Parcel in) {
    mStyleId = in.readInt();
    mContentViewId = in.readInt();
    mTitle = (CharSequence) in.readValue(null);
    mPositive = (CharSequence) in.readValue(null);
    mNegative = (CharSequence) in.readValue(null);
    mNeutral = (CharSequence) in.readValue(null);

    onReadFromParcel(in);
}
 
Example 9
Source File: Department.java    From fingen with Apache License 2.0 5 votes vote down vote up
protected Department(Parcel in) {
    super(in);
    this.mName = in.readString();
    this.mIsActive = (Boolean) in.readValue(Boolean.class.getClassLoader());
    this.mParentID = in.readLong();
    this.mOrderNum = in.readInt();
    this.mExpanded = in.readByte() != 0;
}
 
Example 10
Source File: PlaylistBase.java    From spotify-web-api-android with MIT License 5 votes vote down vote up
protected PlaylistBase(Parcel in) {
    this.collaborative = (Boolean) in.readValue(Boolean.class.getClassLoader());
    this.external_urls = in.readHashMap(Map.class.getClassLoader());
    this.href = (String) in.readValue(String.class.getClassLoader());
    this.id = (String) in.readValue(String.class.getClassLoader());
    this.images = in.createTypedArrayList(Image.CREATOR);
    this.name = (String) in.readValue(String.class.getClassLoader());
    this.owner = in.readParcelable(UserPublic.class.getClassLoader());
    this.is_public = (Boolean) in.readValue(Boolean.class.getClassLoader());
    this.snapshot_id = (String) in.readValue(String.class.getClassLoader());
    this.type = (String) in.readValue(String.class.getClassLoader());
    this.uri = (String) in.readValue(String.class.getClassLoader());
}
 
Example 11
Source File: LockPatternView.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor called from {@link #CREATOR}
 */
@SuppressLint("ParcelClassLoader")
private SavedState(Parcel in) {
    super(in);
    mSerializedPattern = in.readString();
    mDisplayMode = in.readInt();
    mInputEnabled = (Boolean) in.readValue(null);
    mInStealthMode = (Boolean) in.readValue(null);
    mTactileFeedbackEnabled = (Boolean) in.readValue(null);
}
 
Example 12
Source File: Attachment.java    From droidddle with Apache License 2.0 5 votes vote down vote up
private Attachment(Parcel in) {
    this.id = (Long) in.readValue(Long.class.getClassLoader());
    this.url = in.readString();
    this.thumbnailUrl = in.readString();
    this.size = (Long) in.readValue(Long.class.getClassLoader());
    this.contentType = in.readString();
    this.viewsCount = (Integer) in.readValue(Integer.class.getClassLoader());
    long tmpCreatedAt = in.readLong();
    this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
}
 
Example 13
Source File: Artist.java    From spotify-web-api-android with MIT License 5 votes vote down vote up
protected Artist(Parcel in) {
    super(in);
    this.followers = in.readParcelable(Followers.class.getClassLoader());
    this.genres = in.createStringArrayList();
    this.images = in.createTypedArrayList(Image.CREATOR);
    this.popularity = (Integer) in.readValue(Integer.class.getClassLoader());
}
 
Example 14
Source File: LockPatternView.java    From trust with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor called from {@link #CREATOR}
 */
private SavedState(Parcel in) {
    super(in);
    mSerializedPattern = in.readString();
    mDisplayMode = in.readInt();
    mInputEnabled = (Boolean) in.readValue(null);
    mInStealthMode = (Boolean) in.readValue(null);
    mTactileFeedbackEnabled = (Boolean) in.readValue(null);
}
 
Example 15
Source File: MovieInterest.java    From Movie-Check with Apache License 2.0 4 votes vote down vote up
protected MovieInterest(Parcel in) {
    this.id = (Long) in.readValue(Long.class.getClassLoader());
    this.movie = in.readParcelable(Movie.class.getClassLoader());
    this.user = in.readParcelable(User.class.getClassLoader());
}
 
Example 16
Source File: ArrayOfArrayOfNumberOnly.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
ArrayOfArrayOfNumberOnly(Parcel in) {
  arrayArrayNumber = (List<List<BigDecimal>>)in.readValue(List.class.getClassLoader());
}
 
Example 17
Source File: CatAllOf.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
CatAllOf(Parcel in) {
  declawed = (Boolean)in.readValue(null);
}
 
Example 18
Source File: EnumArrays.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
EnumArrays(Parcel in) {
  justSymbol = (JustSymbolEnum)in.readValue(null);
  arrayEnum = (List<ArrayEnumEnum>)in.readValue(null);
}
 
Example 19
Source File: FaceAnalysis.java    From Emotion-Analysis-API with Apache License 2.0 4 votes vote down vote up
public FaceAnalysis(Parcel in) {
    faceRectangle = (FaceRectangle) in.readValue(FaceRectangle.class.getClassLoader());
    scores = (Scores) in.readValue(Scores.class.getClassLoader());
}
 
Example 20
Source File: GcmIntentParser.java    From JobSchedulerCompat with MIT License 4 votes vote down vote up
/**
 * Iterates over the map looking for the {@link #BUNDLE_KEY_CALLBACK} key to try and read the {@link IBinder}
 * straight from the parcelled data. This is entirely dependent on the implementation of Parcel, but these specific
 * parts of {@link Parcel} / {@link Bundle} haven't changed since 2008 and newer versions of Android will ship
 * with newer versions of Google Play services which embed the IBinder directly into the {@link Bundle}
 * (no need to deal with the {@link android.os.Parcelable} issues).
 */
GcmIntentParser(Bundle data) throws RuntimeException {
    if (data == null) {
        throw new IllegalArgumentException();
    }

    jobId = Integer.valueOf(data.getString(BUNDLE_KEY_TAG));

    extras = data.getBundle(BUNDLE_KEY_EXTRAS);

    triggeredContentUris = data.getParcelableArrayList(BUNDLE_KEY_TRIGGERED_URIS);

    if (triggeredContentUris != null) {
        triggeredContentAuthorities = new ArrayList<>();
        for (Uri triggeredContentUri : triggeredContentUris) {
            triggeredContentAuthorities.add(triggeredContentUri.getAuthority());
        }
    }

    Parcel parcel = toParcel(data);
    try {
        int numEntries = checkNonEmptyBundleHeader(parcel);
        for (int i = 0; i < numEntries; i++) {
            String key = null;
            if (shouldReadKeysAsStrings()) {
                key = parcel.readString();
            } else {
                Object entryKeyObj = parcel.readValue(getClass().getClassLoader());
                if (entryKeyObj instanceof String) {
                    key = (String) entryKeyObj;
                }
            }

            if (key == null) {
                continue;
            }

            if (BUNDLE_KEY_CALLBACK.equals(key)
                    && parcel.readInt() == VAL_PARCELABLE
                    && PENDING_CALLBACK_CLASS.equals(parcel.readString())) {
                callback = parcel.readStrongBinder();
                break;
            }
        }
    } finally {
        parcel.recycle();
    }

    if (extras == null || callback == null) {
        throw new IllegalArgumentException();
    }
}