List of usage examples for android.os Parcel readBundle
public final Bundle readBundle()
From source file:org.alfresco.mobile.android.api.session.impl.CloudSessionImpl.java
@SuppressWarnings("unchecked") public CloudSessionImpl(Parcel o) { this.baseUrl = o.readString(); this.userIdentifier = o.readString(); this.password = o.readString(); this.currentNetwork = (CloudNetwork) o.readSerializable(); this.rootNode = o.readParcelable(FolderImpl.class.getClassLoader()); this.repositoryInfo = (RepositoryInfo) o.readSerializable(); this.cmisSession = (Session) o.readSerializable(); Bundle b = o.readBundle(); this.userParameters = (Map<String, Serializable>) b.getSerializable("userParameters"); create();/*from ww w .j av a 2 s .co m*/ }
From source file:ca.farrelltonsolar.classic.PVOutputUploader.java
private Bundle deserializeBundle(byte[] data) { Bundle bundle = null;//from ww w . j av a2 s . c om final Parcel parcel = Parcel.obtain(); try { final ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); final byte[] buffer = new byte[1024]; final GZIPInputStream zis = new GZIPInputStream(new ByteArrayInputStream(data)); int len = 0; while ((len = zis.read(buffer)) != -1) { byteBuffer.write(buffer, 0, len); } zis.close(); parcel.unmarshall(byteBuffer.toByteArray(), 0, byteBuffer.size()); parcel.setDataPosition(0); bundle = parcel.readBundle(); } catch (IOException ex) { Log.w(getClass().getName(), String.format("deserializeBundle failed ex: %s", ex)); bundle = null; } finally { parcel.recycle(); } return bundle; }
From source file:com.twistedequations.rotor.MediaMetadataCompat.java
private MediaMetadataCompat(Parcel in) { mBundle = in.readBundle(); }
From source file:com.sayar.requests.RequestArguments.java
@SuppressWarnings("unchecked") private RequestArguments(final Parcel bundle) { this.method = RequestMethod.fromValue(bundle.readString()); this.url = bundle.readString(); this.userAgent = bundle.readString(); this.parseAs = bundle.readString(); final Bundle params = bundle.readBundle(); this.params = (Map<String, String>) params.getSerializable("map"); final Bundle headers = bundle.readBundle(); this.headers = (Map<String, String>) headers.getSerializable("map"); }
From source file:com.bmd.android.collection.SimpleArrayMapTest.java
public void testParcelable() { final ParcelableObjectSparseObjectEntry[] parcelableArray = AndroidCollections.iterate(mArray).only() .values("4", "1").toParcelableArray(ParcelableObjectSparseObjectEntry.class); assertThat(parcelableArray).hasSize(2); assertThat(parcelableArray[0].getKey()).isEqualTo(1); assertThat(parcelableArray[0].getValue()).isEqualTo("1"); assertThat(parcelableArray[1].getKey()).isEqualTo(4); assertThat(parcelableArray[1].getValue()).isEqualTo("4"); final ArrayList<ParcelableObjectSparseObjectEntry<Integer, String>> parcelableList = AndroidCollections .iterate(mArray).but().keys(Arrays.asList(1, 2, 3)).reverse().toParcelableList(); assertThat(parcelableList).hasSize(2); assertThat(parcelableList.get(0).getKey()).isEqualTo(4); assertThat(parcelableList.get(0).getValue()).isEqualTo("4"); assertThat(parcelableList.get(1).getKey()).isEqualTo(0); assertThat(parcelableList.get(1).getValue()).isEqualTo("0"); assertThat(parcelableList).containsExactly(SparseEntries.parcelableEntry(Integer.valueOf(4), "4"), SparseEntries.parcelableEntry(Integer.valueOf(0), "0")); final Bundle bundle = new Bundle(); bundle.putParcelableArray("array", parcelableArray); bundle.putParcelableArrayList("list", parcelableList); final Parcel parcel = Parcel.obtain(); bundle.writeToParcel(parcel, 0);//from w ww.java 2 s . c o m parcel.setDataPosition(0); final Bundle out = parcel.readBundle(); out.setClassLoader(AndroidCollections.class.getClassLoader()); assertThat(out.getParcelableArray("array")).isEqualTo(parcelableArray); assertThat(out.getParcelableArrayList("list")).isEqualTo(new ArrayList<Parcelable>(parcelableList)); final ArrayList<ParcelableObjectSparseObjectEntry<Integer, String>> filledList = new ArrayList<ParcelableObjectSparseObjectEntry<Integer, String>>( 2); AndroidCollections.iterate(mArray).but().keys(1, 2, 3).reverse().fillParcelable(filledList); assertThat(filledList).isEqualTo(parcelableList); final ParcelableObjectSparseObjectEntry[] filledArray = new ParcelableObjectSparseObjectEntry[2]; AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(Integer.valueOf(2), "2")); AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray, 1); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(Integer.valueOf(2), "2")); assertThat(filledArray[0]).isEqualTo(filledArray[1]); try { AndroidCollections.iterate(mArray).fillParcelable(filledArray); fail(); } catch (final IndexOutOfBoundsException e) { } final Parcelable[] parcelables = new Parcelable[2]; AndroidCollections.iterate(mArray).only().to(1).fillParcelable(parcelables); assertThat(parcelables).containsExactly(filledArray); }
From source file:com.bmd.android.collection.SparseArrayCompatTest.java
public void testParcelable() { final ParcelableIntSparseObjectEntry[] parcelableArray = AndroidCollections.iterate(mArray).only() .values("4", "1").toParcelableArray(ParcelableIntSparseObjectEntry.class); assertThat(parcelableArray).hasSize(2); assertThat(parcelableArray[0].getKey()).isEqualTo(1); assertThat(parcelableArray[0].getValue()).isEqualTo("1"); assertThat(parcelableArray[1].getKey()).isEqualTo(4); assertThat(parcelableArray[1].getValue()).isEqualTo("4"); final ArrayList<ParcelableIntSparseObjectEntry<String>> parcelableList = AndroidCollections.iterate(mArray) .but().keys(Arrays.asList(1, 2, 3)).reverse().toParcelableList(); assertThat(parcelableList).hasSize(2); assertThat(parcelableList.get(0).getKey()).isEqualTo(4); assertThat(parcelableList.get(0).getValue()).isEqualTo("4"); assertThat(parcelableList.get(1).getKey()).isEqualTo(0); assertThat(parcelableList.get(1).getValue()).isEqualTo("0"); assertThat(parcelableList).containsExactly(SparseEntries.parcelableEntry(4, "4"), SparseEntries.parcelableEntry(0, "0")); final Bundle bundle = new Bundle(); bundle.putParcelableArray("array", parcelableArray); bundle.putParcelableArrayList("list", parcelableList); final Parcel parcel = Parcel.obtain(); bundle.writeToParcel(parcel, 0);// www.j a va2 s . com parcel.setDataPosition(0); final Bundle out = parcel.readBundle(); out.setClassLoader(AndroidCollections.class.getClassLoader()); assertThat(out.getParcelableArray("array")).isEqualTo(parcelableArray); assertThat(out.getParcelableArrayList("list")).isEqualTo(new ArrayList<Parcelable>(parcelableList)); final ArrayList<ParcelableIntSparseObjectEntry<String>> filledList = new ArrayList<ParcelableIntSparseObjectEntry<String>>( 2); AndroidCollections.iterate(mArray).but().keys(1, 2, 3).reverse().fillParcelable(filledList); assertThat(filledList).isEqualTo(parcelableList); final ParcelableIntSparseObjectEntry[] filledArray = new ParcelableIntSparseObjectEntry[2]; AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(2, "2")); AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray, 1); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(2, "2")); assertThat(filledArray[0]).isEqualTo(filledArray[1]); try { AndroidCollections.iterate(mArray).fillParcelable(filledArray); fail(); } catch (final IndexOutOfBoundsException e) { } final Parcelable[] parcelables = new Parcelable[2]; AndroidCollections.iterate(mArray).only().to(1).fillParcelable(parcelables); assertThat(parcelables).containsExactly(filledArray); }
From source file:com.bmd.android.collection.SupportLongSparseArrayTest.java
public void testParcelable() { final ParcelableLongSparseObjectEntry[] parcelableArray = AndroidCollections.iterate(mArray).only() .values("4", "1").toParcelableArray(ParcelableLongSparseObjectEntry.class); assertThat(parcelableArray).hasSize(2); assertThat(parcelableArray[0].getKey()).isEqualTo(1); assertThat(parcelableArray[0].getValue()).isEqualTo("1"); assertThat(parcelableArray[1].getKey()).isEqualTo(4); assertThat(parcelableArray[1].getValue()).isEqualTo("4"); final ArrayList<ParcelableLongSparseObjectEntry<String>> parcelableList = AndroidCollections.iterate(mArray) .but().keys(Arrays.asList(1L, 2L, 3L)).reverse().toParcelableList(); assertThat(parcelableList).hasSize(2); assertThat(parcelableList.get(0).getKey()).isEqualTo(4); assertThat(parcelableList.get(0).getValue()).isEqualTo("4"); assertThat(parcelableList.get(1).getKey()).isEqualTo(0); assertThat(parcelableList.get(1).getValue()).isEqualTo("0"); assertThat(parcelableList).containsExactly(SparseEntries.parcelableEntry(4L, "4"), SparseEntries.parcelableEntry(0L, "0")); final Bundle bundle = new Bundle(); bundle.putParcelableArray("array", parcelableArray); bundle.putParcelableArrayList("list", parcelableList); final Parcel parcel = Parcel.obtain(); bundle.writeToParcel(parcel, 0);/*from w w w. jav a 2 s. co m*/ parcel.setDataPosition(0); final Bundle out = parcel.readBundle(); out.setClassLoader(AndroidCollections.class.getClassLoader()); assertThat(out.getParcelableArray("array")).isEqualTo(parcelableArray); assertThat(out.getParcelableArrayList("list")).isEqualTo(new ArrayList<Parcelable>(parcelableList)); final ArrayList<ParcelableLongSparseObjectEntry<String>> filledList = new ArrayList<ParcelableLongSparseObjectEntry<String>>( 2); AndroidCollections.iterate(mArray).but().keys(1, 2, 3).reverse().fillParcelable(filledList); assertThat(filledList).isEqualTo(parcelableList); final ParcelableLongSparseObjectEntry[] filledArray = new ParcelableLongSparseObjectEntry[2]; AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(2L, "2")); AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray, 1); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(2L, "2")); assertThat(filledArray[0]).isEqualTo(filledArray[1]); try { AndroidCollections.iterate(mArray).fillParcelable(filledArray); fail(); } catch (final IndexOutOfBoundsException e) { } final Parcelable[] parcelables = new Parcelable[2]; AndroidCollections.iterate(mArray).only().to(1).fillParcelable(parcelables); assertThat(parcelables).containsExactly(filledArray); }
From source file:com.bmd.android.collection.LongSparseArrayTest.java
public void testParcelable() { if (VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN) { return;//ww w . j av a2 s . co m } final ParcelableLongSparseObjectEntry[] parcelableArray = AndroidCollections.iterate(mArray).only() .values("4", "1").toParcelableArray(ParcelableLongSparseObjectEntry.class); assertThat(parcelableArray).hasSize(2); assertThat(parcelableArray[0].getKey()).isEqualTo(1); assertThat(parcelableArray[0].getValue()).isEqualTo("1"); assertThat(parcelableArray[1].getKey()).isEqualTo(4); assertThat(parcelableArray[1].getValue()).isEqualTo("4"); final ArrayList<ParcelableLongSparseObjectEntry<String>> parcelableList = AndroidCollections.iterate(mArray) .but().keys(Arrays.asList(1L, 2L, 3L)).reverse().toParcelableList(); assertThat(parcelableList).hasSize(2); assertThat(parcelableList.get(0).getKey()).isEqualTo(4); assertThat(parcelableList.get(0).getValue()).isEqualTo("4"); assertThat(parcelableList.get(1).getKey()).isEqualTo(0); assertThat(parcelableList.get(1).getValue()).isEqualTo("0"); assertThat(parcelableList).containsExactly(SparseEntries.parcelableEntry(4L, "4"), SparseEntries.parcelableEntry(0L, "0")); final Bundle bundle = new Bundle(); bundle.putParcelableArray("array", parcelableArray); bundle.putParcelableArrayList("list", parcelableList); final Parcel parcel = Parcel.obtain(); bundle.writeToParcel(parcel, 0); parcel.setDataPosition(0); final Bundle out = parcel.readBundle(); out.setClassLoader(AndroidCollections.class.getClassLoader()); assertThat(out.getParcelableArray("array")).isEqualTo(parcelableArray); assertThat(out.getParcelableArrayList("list")).isEqualTo(new ArrayList<Parcelable>(parcelableList)); final ArrayList<ParcelableLongSparseObjectEntry<String>> filledList = new ArrayList<ParcelableLongSparseObjectEntry<String>>( 2); AndroidCollections.iterate(mArray).but().keys(1, 2, 3).reverse().fillParcelable(filledList); assertThat(filledList).isEqualTo(parcelableList); final ParcelableLongSparseObjectEntry[] filledArray = new ParcelableLongSparseObjectEntry[2]; AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(2L, "2")); AndroidCollections.iterate(mArray).only().value("2").fillParcelable(filledArray, 1); assertThat(filledArray[0]).isEqualTo(SparseEntries.parcelableEntry(2L, "2")); assertThat(filledArray[0]).isEqualTo(filledArray[1]); try { AndroidCollections.iterate(mArray).fillParcelable(filledArray); fail(); } catch (final IndexOutOfBoundsException e) { } final Parcelable[] parcelables = new Parcelable[2]; AndroidCollections.iterate(mArray).only().to(1).fillParcelable(parcelables); assertThat(parcelables).containsExactly(filledArray); }
From source file:com.marianhello.bgloc.Config.java
private Config(Parcel in) { setStationaryRadius(in.readFloat()); setDistanceFilter(in.readInt());//from ww w .j a va2s. co m setDesiredAccuracy(in.readInt()); setDebugging((Boolean) in.readValue(null)); setNotificationTitle(in.readString()); setNotificationText(in.readString()); setLargeNotificationIcon(in.readString()); setSmallNotificationIcon(in.readString()); setNotificationIconColor(in.readString()); setStopOnTerminate((Boolean) in.readValue(null)); setStartOnBoot((Boolean) in.readValue(null)); setStartForeground((Boolean) in.readValue(null)); setLocationProvider(in.readInt()); setInterval(in.readInt()); setFastestInterval(in.readInt()); setActivitiesInterval(in.readInt()); setStopOnStillActivity((Boolean) in.readValue(null)); setUrl(in.readString()); setSyncUrl(in.readString()); setSyncThreshold(in.readInt()); setMaxLocations(in.readInt()); Bundle bundle = in.readBundle(); setHttpHeaders((HashMap<String, String>) bundle.getSerializable("httpHeaders")); }
From source file:android.app.FragmentState.java
public FragmentState(Parcel in) { mClassName = in.readString();//w w w . ja va2 s .c o m mIndex = in.readInt(); mFromLayout = in.readInt() != 0; mFragmentId = in.readInt(); mContainerId = in.readInt(); mTag = in.readString(); mRetainInstance = in.readInt() != 0; mDetached = in.readInt() != 0; mArguments = in.readBundle(); mSavedFragmentState = in.readBundle(); }