下面列出了android.os.Parcel#readParcelable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public SrcDstPlain createFromParcel(Parcel in)
{
SrcDstPlain res = new SrcDstPlain();
try
{
LocationsManager lm = LocationsManagerBase.getLocationsManager(null, false);
int size = in.readInt();
for(int i=0;i<size;i++)
{
Uri u = in.readParcelable(getClass().getClassLoader());
Location srcLoc = lm!=null ? lm.getLocation(u) : null;
u = in.readParcelable(getClass().getClassLoader());
Location dstLoc = Uri.EMPTY.equals(u) ? null : lm != null ? lm.getLocation(u) : null;
if(srcLoc != null)
res.add(srcLoc, dstLoc);
}
}
catch(Exception e)
{
Logger.log(e);
}
return res;
}
protected Milestone(Parcel in) {
this.id = in.readLong();
this.number = in.readInt();
this.title = in.readString();
this.description = in.readString();
this.creator = in.readParcelable(User.class.getClassLoader());
this.openIssues = in.readInt();
this.closedIssues = in.readInt();
int tmpState = in.readInt();
this.state = tmpState == -1 ? null : State.values()[tmpState];
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
long tmpDueOn = in.readLong();
this.dueOn = tmpDueOn == -1 ? null : new Date(tmpDueOn);
long tmpClosedAt = in.readLong();
this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt);
}
private SendRequest(Parcel in) {
trackId = in.readLong();
sendDrive = in.readByte() == 1;
sendMaps = in.readByte() == 1;
sendFusionTables = in.readByte() == 1;
sendSpreadsheets = in.readByte() == 1;
driveSync = in.readByte() == 1;
driveSharePublic = in.readByte() == 1;
driveShareEmails = in.readString();
account = in.readParcelable(null);
driveSuccess = in.readByte() == 1;
mapsSuccess = in.readByte() == 1;
fusionTablesSuccess = in.readByte() == 1;
spreadsheetsSuccess = in.readByte() == 1;
shareUrl = in.readString();
}
GuidanceManeuverData(Parcel in) {
mIconId = in.readInt();
if (in.readByte() == 0) {
mDistance = null;
} else {
mDistance = in.readLong();
}
mInfo1 = in.readString();
mInfo2 = in.readString();
mNextRoadIcon = in.readParcelable(Bitmap.class.getClassLoader());
}
protected Builder(Parcel in) {
mStyleId = in.readInt();
mContentViewId = in.readInt();
mTitle = (CharSequence)in.readParcelable(null);
mPositive = (CharSequence)in.readParcelable(null);
mNegative = (CharSequence)in.readParcelable(null);
mNeutral = (CharSequence)in.readParcelable(null);
onReadFromParcel(in);
}
protected EssFile(Parcel in) {
mFilePath = in.readString();
mimeType = in.readString();
childFolderCount = in.readString();
childFileCount = in.readString();
isChecked = in.readByte() != 0;
isExits = in.readByte() != 0;
isDirectory = in.readByte() != 0;
isFile = in.readByte() != 0;
mFileName = in.readString();
uri = in.readParcelable(Uri.class.getClassLoader());
itemType = in.readInt();
}
Snack(Parcel p) {
mMessage = p.readString();
mActionMessage = p.readString();
mActionIcon = p.readInt();
mToken = p.readParcelable(p.getClass().getClassLoader());
mDuration = (short) p.readInt();
mBtnTextColor = p.readParcelable(p.getClass().getClassLoader());
mBackgroundColor = p.readParcelable(p.getClass().getClassLoader());
mHeight = p.readInt();
mTypeface = (Typeface) p.readValue(p.getClass().getClassLoader());
}
SavedState(Parcel in, ClassLoader loader) {
super(in);
if (loader == null) {
loader = getClass().getClassLoader();
}
position = in.readInt();
adapterState = in.readParcelable(loader);
this.loader = loader;
}
private ResourceGroup(Parcel in) {
super(in);
mChildrenLoaded = in.readByte() == 1;
mChildren = new ArrayList<>();
int count = in.readInt();
for (int i = 0; i < count; i++) {
int type = in.readInt();
switch (type) {
case Connection.NGWResourceTypeResourceGroup:
ResourceGroup resourceGroup = in.readParcelable(ResourceGroup.class.getClassLoader());
resourceGroup.setParent(this);
mChildren.add(resourceGroup);
break;
case Connection.NGWResourceTypePostgisLayer:
if (mConnection.getNgwVersionMajor() < Constants.NGW_v3)
break;
case Connection.NGWResourceTypeRasterLayer:
case Connection.NGWResourceTypeVectorLayer:
case Connection.NGWResourceTypeWMSClient:
LayerWithStyles layer = in.readParcelable(LayerWithStyles.class.getClassLoader());
layer.setParent(this);
mChildren.add(layer);
break;
case Connection.NGWResourceTypeLookupTable:
ResourceWithoutChildren resourceWoChildren = in.readParcelable(ResourceWithoutChildren.class.getClassLoader());
resourceWoChildren.setParent(this);
mChildren.add(resourceWoChildren);
case Connection.NGWResourceTypeWebMap:
WebMap webMap = in.readParcelable(WebMap.class.getClassLoader());
webMap.setParent(this);
mChildren.add(webMap);
break;
}
}
}
protected AppUpdateStatus(Parcel in) {
app = in.readParcelable(getClass().getClassLoader());
apk = in.readParcelable(getClass().getClassLoader());
intent = in.readParcelable(getClass().getClassLoader());
status = (Status) in.readSerializable();
progressCurrent = in.readLong();
progressMax = in.readLong();
errorText = in.readString();
}
protected SavedCardDrawableFragmentItem(final Parcel in) {
super(in);
paymentMethodId = in.readString();
card = in.readParcelable(CardDrawerConfiguration.class.getClassLoader());
}
private SavedState(Parcel in) {
super(in);
preferences = in.readParcelable(Preferences.class.getClassLoader());
}
protected WeiboVideoMBlog(Parcel in) {
createTime = in.readString();
text = in.readString();
mPageInfo = in.readParcelable(WeiboVideoPageInfo.class.getClassLoader());
mBlog = in.readParcelable(WeiboVideoMBlog.class.getClassLoader());
}
protected Bound(Parcel in) {
northeast = in.readParcelable(Coordination.class.getClassLoader());
southwest = in.readParcelable(Coordination.class.getClassLoader());
}
protected EDSLocationFormatterBase(Parcel in)
{
_disableDefaultSettings = in.readByte() != 0;
_password = in.readParcelable(ClassLoader.getSystemClassLoader());
}
@Override
public ConfigNetworkTransmitStatus createFromParcel(Parcel in) {
final AccessMessage message = in.readParcelable(AccessMessage.class.getClassLoader());
//noinspection ConstantConditions
return new ConfigNetworkTransmitStatus(message);
}
private AlertEvaluationCondition(Parcel parcel) {
this.threshold = parcel.readDouble();
this.type = parcel.readParcelable(AlertType.class.getClassLoader());
}
protected StopPoint(Parcel in) {
location = in.readParcelable(Coordination.class.getClassLoader());
name = in.readString();
}
protected Metadata(Parcel in) {
this.connections = in.readParcelable(Connections.class.getClassLoader());
this.interactions = in.readParcelable(Interactions.class.getClassLoader());
}
@Override
public ScanFilterCompat createFromParcel(Parcel in) {
Builder builder = new Builder();
if (in.readInt() == 1) {
builder.setDeviceName(in.readString());
}
if (in.readInt() == 1) {
builder.setDeviceAddress(in.readString());
}
if (in.readInt() == 1) {
ParcelUuid uuid = in.readParcelable(ParcelUuid.class.getClassLoader());
builder.setServiceUuid(uuid);
if (in.readInt() == 1) {
ParcelUuid uuidMask = in.readParcelable(
ParcelUuid.class.getClassLoader());
builder.setServiceUuid(uuid, uuidMask);
}
}
if (in.readInt() == 1) {
ParcelUuid servcieDataUuid =
in.readParcelable(ParcelUuid.class.getClassLoader());
if (in.readInt() == 1) {
int serviceDataLength = in.readInt();
byte[] serviceData = new byte[serviceDataLength];
in.readByteArray(serviceData);
if (in.readInt() == 0) {
builder.setServiceData(servcieDataUuid, serviceData);
}
else {
int serviceDataMaskLength = in.readInt();
byte[] serviceDataMask = new byte[serviceDataMaskLength];
in.readByteArray(serviceDataMask);
builder.setServiceData(
servcieDataUuid, serviceData, serviceDataMask);
}
}
}
int manufacturerId = in.readInt();
if (in.readInt() == 1) {
int manufacturerDataLength = in.readInt();
byte[] manufacturerData = new byte[manufacturerDataLength];
in.readByteArray(manufacturerData);
if (in.readInt() == 0) {
builder.setManufacturerData(manufacturerId, manufacturerData);
}
else {
int manufacturerDataMaskLength = in.readInt();
byte[] manufacturerDataMask = new byte[manufacturerDataMaskLength];
in.readByteArray(manufacturerDataMask);
builder.setManufacturerData(manufacturerId, manufacturerData,
manufacturerDataMask);
}
}
return builder.build();
}