android.os.Parcelable#Creator ( )源码实例Demo

下面列出了android.os.Parcelable#Creator ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: px-android   文件: ParcelableUtil.java
@Nullable
public static <T> T unmarshall(@NonNull final byte[] bytes, @NonNull final Parcelable.Creator<T> creator) {
    final Parcel parcel = unmarshall(bytes);
    final T result = creator.createFromParcel(parcel);
    parcel.recycle();
    return result;
}
 
源代码2 项目: LLApp   文件: CacheUtils.java
private static <T> T bytes2Parcelable(byte[] bytes, Parcelable.Creator<T> creator) {
    if (bytes == null) return null;
    Parcel parcel = Parcel.obtain();
    parcel.unmarshall(bytes, 0, bytes.length);
    parcel.setDataPosition(0);
    T result = creator.createFromParcel(parcel);
    parcel.recycle();
    return result;
}
 
源代码3 项目: adt-leanback-support   文件: ParcelableCompat.java
/**
 * Factory method for {@link Parcelable.Creator}.
 *
 * @param callbacks Creator callbacks implementation.
 * @return New creator.
 */
public static <T> Parcelable.Creator<T> newCreator(
        ParcelableCompatCreatorCallbacks<T> callbacks) {
    if (android.os.Build.VERSION.SDK_INT >= 13) {
        ParcelableCompatCreatorHoneycombMR2Stub.instantiate(callbacks);
    }
    return new CompatCreator<T>(callbacks);
}
 
源代码4 项目: mollyim-android   文件: ParcelUtil.java
public static <T> T deserialize(byte[] bytes, Parcelable.Creator<T> creator) {
  Parcel parcel = deserialize(bytes);
  return creator.createFromParcel(parcel);
}
 
源代码5 项目: ClockPlus   文件: AlarmActivity.java
@Override
protected Parcelable.Creator<Alarm> getParcelableCreator() {
    return Alarm.CREATOR;
}
 
源代码6 项目: Jager   文件: Posts.java
public static Parcelable.Creator<Posts> getCREATOR () {
	return CREATOR;
}
 
public static <T> T parcelAndCreate(Parcelable parcelable, Parcelable.Creator<T> creator) {
  Parcel parcel = Parcel.obtain();
  parcelable.writeToParcel(parcel, /* flags= */ 0);
  parcel.setDataPosition(0);
  return creator.createFromParcel(parcel);
}
 
public static <T> T unmarshall(byte[] bytes, Parcelable.Creator<T> creator) {
    Parcel parcel = unmarshall(bytes);
    T result = creator.createFromParcel(parcel);
    parcel.recycle();
    return result;
}
 
源代码9 项目: ClockPlus   文件: TimerRingtoneService.java
@Override
protected Parcelable.Creator<Timer> getParcelableCreator() {
    return Timer.CREATOR;
}
 
源代码10 项目: Jager   文件: Topics.java
public static Parcelable.Creator<Topics> getCREATOR () {
	return CREATOR;
}
 
源代码11 项目: AndroidUtilCode   文件: UtilsBridge.java
static <T> T bytes2Parcelable(final byte[] bytes,
                              final Parcelable.Creator<T> creator) {
    return ConvertUtils.bytes2Parcelable(bytes, creator);
}
 
源代码12 项目: android-sdk   文件: SQLiteStore.java
public static <T> T unmarshall(byte[] bytes, Parcelable.Creator<T> creator) {
    Parcel parcel = unmarshall(bytes);
    return creator.createFromParcel(parcel);
}
 
源代码13 项目: paperparcel   文件: ParcelableAdapter.java
public ParcelableAdapter(@Nullable Parcelable.Creator<T> creator) {
  this.creator = creator;
}
 
源代码14 项目: AndroidUtilCode   文件: CacheDiskUtils.java
/**
 * Return the parcelable in cache.
 *
 * @param key          The key of cache.
 * @param creator      The creator.
 * @param defaultValue The default value if the cache doesn't exist.
 * @param <T>          The value type.
 * @return the parcelable if cache exists or defaultValue otherwise
 */
public <T> T getParcelable(@NonNull final String key,
                           @NonNull final Parcelable.Creator<T> creator,
                           final T defaultValue) {
    byte[] bytes = realGetBytes(TYPE_PARCELABLE + key);
    if (bytes == null) return defaultValue;
    return UtilsBridge.bytes2Parcelable(bytes, creator);
}
 
源代码15 项目: postman   文件: Postman.java
/**
 * Get a {@link Creator} that can be used for the {@code CREATOR} field of a {@link
 * Parcelable}.
 *
 * @param clazz The class associated with the type the the Creator will create.
 * @param <T> The type the Creator will create.
 *
 * @return A fully implemented Creator for the specified type.
 *
 * @throws PostmanException if there is no {@link Parceler} associated with the given type.
 */
public static <T> Parcelable.Creator<T> getCreator(Class<T> clazz) throws PostmanException {
    @SuppressWarnings("unchecked")
    Parcelable.Creator<T> creator = (Parcelable.Creator<T>) creatorMap.get(clazz);
    if (creator == null) {
        creator = newCreator(clazz);
        creatorMap.put(clazz, creator);
    }
    return creator;
}
 
源代码16 项目: LLApp   文件: CacheUtils.java
/**
 * 缓存中读取Parcelable
 *
 * @param key     键
 * @param creator 建造器
 * @return 存在且没过期返回对应值,否则返回{@code null}
 */
public <T> T getParcelable(@NonNull String key, @NonNull Parcelable.Creator<T> creator) {
    return getParcelable(key, creator, null);
}
 
源代码17 项目: LLApp   文件: CacheUtils.java
/**
 * 缓存中读取Parcelable
 *
 * @param key          键
 * @param creator      建造器
 * @param defaultValue 默认值
 * @return 存在且没过期返回对应值,否则返回默认值{@code defaultValue}
 */
public <T> T getParcelable(@NonNull String key, @NonNull Parcelable.Creator<T> creator, T defaultValue) {
    byte[] bytes = getBytes(key);
    if (bytes == null) return defaultValue;
    return CacheHelper.bytes2Parcelable(bytes, creator);
}
 
源代码18 项目: AndroidUtilCode   文件: CacheDiskStaticUtils.java
/**
 * Return the parcelable in cache.
 *
 * @param key          The key of cache.
 * @param creator      The creator.
 * @param defaultValue The default value if the cache doesn't exist.
 * @param <T>          The value type.
 * @return the parcelable if cache exists or defaultValue otherwise
 */
public static <T> T getParcelable(@NonNull final String key,
                                  @NonNull final Parcelable.Creator<T> creator,
                                  final T defaultValue) {
    return getParcelable(key, creator, defaultValue, getDefaultCacheDiskUtils());
}
 
源代码19 项目: AndroidUtilCode   文件: CacheDiskStaticUtils.java
/**
 * Return the parcelable in cache.
 *
 * @param key            The key of cache.
 * @param creator        The creator.
 * @param cacheDiskUtils The instance of {@link CacheDiskUtils}.
 * @param <T>            The value type.
 * @return the parcelable if cache exists or null otherwise
 */
public static <T> T getParcelable(@NonNull final String key,
                                  @NonNull final Parcelable.Creator<T> creator,
                                  @NonNull final CacheDiskUtils cacheDiskUtils) {
    return cacheDiskUtils.getParcelable(key, creator);
}
 
源代码20 项目: android_9.0.0_r45   文件: BaseParceledListSlice.java
protected abstract Parcelable.Creator<?> readParcelableCreator(Parcel from, ClassLoader loader);