android.os.Parcel#readTypedArray ( )源码实例Demo

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

源代码1 项目: android_9.0.0_r45   文件: PackageInfoLite.java
private PackageInfoLite(Parcel source) {
    packageName = source.readString();
    splitNames = source.createStringArray();
    versionCode = source.readInt();
    versionCodeMajor = source.readInt();
    baseRevisionCode = source.readInt();
    splitRevisionCodes = source.createIntArray();
    recommendedInstallLocation = source.readInt();
    installLocation = source.readInt();
    multiArch = (source.readInt() != 0);

    final int verifiersLength = source.readInt();
    if (verifiersLength == 0) {
        verifiers = new VerifierInfo[0];
    } else {
        verifiers = new VerifierInfo[verifiersLength];
        source.readTypedArray(verifiers, VerifierInfo.CREATOR);
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: ZenModeConfig.java
public ZenModeConfig(Parcel source) {
    allowCalls = source.readInt() == 1;
    allowRepeatCallers = source.readInt() == 1;
    allowMessages = source.readInt() == 1;
    allowReminders = source.readInt() == 1;
    allowEvents = source.readInt() == 1;
    allowCallsFrom = source.readInt();
    allowMessagesFrom = source.readInt();
    user = source.readInt();
    manualRule = source.readParcelable(null);
    final int len = source.readInt();
    if (len > 0) {
        final String[] ids = new String[len];
        final ZenRule[] rules = new ZenRule[len];
        source.readStringArray(ids);
        source.readTypedArray(rules, ZenRule.CREATOR);
        for (int i = 0; i < len; i++) {
            automaticRules.put(ids[i], rules[i]);
        }
    }
    allowAlarms = source.readInt() == 1;
    allowMedia = source.readInt() == 1;
    allowSystem = source.readInt() == 1;
    suppressedVisualEffects = source.readInt();
    areChannelsBypassingDnd = source.readInt() == 1;
}
 
private ExtendableSavedState(@NonNull Parcel in, ClassLoader loader) {
  super(in, loader);

  int size = in.readInt();

  String[] keys = new String[size];
  in.readStringArray(keys);

  Bundle[] states = new Bundle[size];
  in.readTypedArray(states, Bundle.CREATOR);

  extendableStates = new SimpleArrayMap<>(size);
  for (int i = 0; i < size; i++) {
    extendableStates.put(keys[i], states[i]);
  }
}
 
public SentenceSuggestionsInfo(Parcel source) {
    final int infoSize = source.readInt();
    mSuggestionsInfos = new SuggestionsInfo[infoSize];
    source.readTypedArray(mSuggestionsInfos, SuggestionsInfo.CREATOR);
    mOffsets = new int[mSuggestionsInfos.length];
    source.readIntArray(mOffsets);
    mLengths = new int[mSuggestionsInfos.length];
    source.readIntArray(mLengths);
}
 
源代码5 项目: android_9.0.0_r45   文件: NdefMessage.java
@Override
public NdefMessage createFromParcel(Parcel in) {
    int recordsLength = in.readInt();
    NdefRecord[] records = new NdefRecord[recordsLength];
    in.readTypedArray(records, NdefRecord.CREATOR);
    return new NdefMessage(records);
}
 
源代码6 项目: android_9.0.0_r45   文件: BeamShareData.java
@Override
public BeamShareData createFromParcel(Parcel source) {
    Uri[] uris = null;
    NdefMessage msg = source.readParcelable(NdefMessage.class.getClassLoader());
    int numUris = source.readInt();
    if (numUris > 0) {
        uris = new Uri[numUris];
        source.readTypedArray(uris, Uri.CREATOR);
    }
    UserHandle userHandle = source.readParcelable(UserHandle.class.getClassLoader());
    int flags = source.readInt();

    return new BeamShareData(msg, uris, userHandle, flags);
}
 
源代码7 项目: android_9.0.0_r45   文件: ActivityChangedEvent.java
@Override
public ActivityChangedEvent createFromParcel(Parcel source) {
    int activityRecognitionEventsLength = source.readInt();
    ActivityRecognitionEvent[] activityRecognitionEvents =
            new ActivityRecognitionEvent[activityRecognitionEventsLength];
    source.readTypedArray(activityRecognitionEvents, ActivityRecognitionEvent.CREATOR);

    return new ActivityChangedEvent(activityRecognitionEvents);
}
 
源代码8 项目: decoro   文件: SlotsList.java
protected SlotsList(Parcel in) {
    this.size = in.readInt();
    if (size > 0) {
        Slot[] slots = new Slot[this.size];
        in.readTypedArray(slots, Slot.CREATOR);
        linkSlots(slots, this);
    }
}
 
源代码9 项目: material   文件: ContactEditText.java
/**
 * Constructor called from {@link #CREATOR}
 */
private SavedState(Parcel in) {
    super(in);
    int length = in.readInt();
    if(length > 0){
        recipients = new Recipient[length];
        in.readTypedArray(recipients, Recipient.CREATOR);
    }
}
 
源代码10 项目: external-nfc-api   文件: BeamShareData.java
@Override
public BeamShareData createFromParcel(Parcel source) {
    Uri[] uris = null;
    NdefMessage msg = source.readParcelable(NdefMessage.class.getClassLoader());
    int numUris = source.readInt();
    if (numUris > 0) {
        uris = new Uri[numUris];
        source.readTypedArray(uris, Uri.CREATOR);
    }
    UserHandle userHandle = source.readParcelable(UserHandle.class.getClassLoader());
    int flags = source.readInt();

    return new BeamShareData(msg, uris, userHandle, flags);
}
 
源代码11 项目: MensaGuthaben   文件: DesfireApplication.java
public DesfireApplication createFromParcel(Parcel source) {
    int id = source.readInt();

    DesfireFile[] files = new DesfireFile[source.readInt()];
    source.readTypedArray(files, DesfireFile.CREATOR);

    return new DesfireApplication(id, files);
}
 
源代码12 项目: requery   文件: EntityParceler.java
public T readFromParcel(Parcel in) {
    T entity = type.getFactory().get();
    EntityProxy<T> proxy = type.getProxyProvider().apply(entity);
    for (Attribute<T, ?> attribute : type.getAttributes()) {
        if (attribute.isAssociation()) {
            continue;
        }
        Class<?> typeClass = attribute.getClassType();
        Object value = null;
        if (typeClass.isEnum()) {
            String name = (String) in.readValue(getClass().getClassLoader());
            if (name == null) {
                value = null;
            } else {
                @SuppressWarnings("unchecked")
                Class<? extends Enum> enumClass = (Class<? extends Enum>) typeClass;
                value = Enum.valueOf(enumClass, name);
            }
        } else if (typeClass.isArray()) {
            int length = in.readInt();
            if (length >= 0) {
                try {
                    Parcelable.Creator creator = (Parcelable.Creator<?>)
                            typeClass.getField("CREATOR").get(null);
                    Object[] array = creator.newArray(length);
                    in.readTypedArray(array, creator);
                    value = array;
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        } else {
            value = in.readValue(getClass().getClassLoader());
        }
        PropertyState state = PropertyState.LOADED;
        if (!type.isStateless()) {
            state = PropertyState.valueOf(in.readString());
        }
        proxy.setObject(attribute, value, state);
    }
    return entity;
}
 
 方法所在类
 同类方法