use of android.os.Parcelable in project PagerSlidingTabStrip by astuetz.
the class PagerSlidingTabStrip method onSaveInstanceState.
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState savedState = new SavedState(superState);
savedState.currentPosition = currentPosition;
return savedState;
}
use of android.os.Parcelable in project HTextView by hanks-zyh.
the class HTextView method onSaveInstanceState.
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState state = new SavedState(superState);
state.animateType = animateType;
return state;
}
use of android.os.Parcelable in project android-advancedrecyclerview by h6ah4i.
the class AlreadyExpandedGroupsExpandableExampleFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(getContext());
final Parcelable eimSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);
// Expand all group items by default. This method must be called before creating a wrapper adapter.
//
// FYI: AbstractExpandableItemAdapter.getInitialGroupExpandedState() can also be used if you
// need fine control of initial group items' state.
mRecyclerViewExpandableItemManager.setDefaultGroupsExpandedState(true);
//adapter
final AlreadyExpandedGroupsExpandableExampleAdapter myItemAdapter = new AlreadyExpandedGroupsExpandableExampleAdapter(mRecyclerViewExpandableItemManager, getDataProvider());
mAdapter = myItemAdapter;
// wrap for expanding
mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(myItemAdapter);
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Need to disable them when using animation indicator.
animator.setSupportsChangeAnimations(false);
mRecyclerView.setLayoutManager(mLayoutManager);
// requires *wrapped* adapter
mRecyclerView.setAdapter(mWrappedAdapter);
mRecyclerView.setItemAnimator(animator);
mRecyclerView.setHasFixedSize(false);
//noinspection StatementWithEmptyBody
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) ContextCompat.getDrawable(getContext(), R.drawable.material_shadow_z1)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(ContextCompat.getDrawable(getContext(), R.drawable.list_divider_h), true));
mRecyclerViewExpandableItemManager.attachRecyclerView(mRecyclerView);
}
use of android.os.Parcelable in project facebook-android-sdk by facebook.
the class ShareOpenGraphValueContainer method getObjectArrayList.
/**
* Gets an array of object values out of the object.
* @param key The key for the value.
* @return The object values.
*/
@Nullable
public ArrayList<ShareOpenGraphObject> getObjectArrayList(final String key) {
final ArrayList<Parcelable> items = this.bundle.getParcelableArrayList(key);
if (items == null) {
return null;
}
final ArrayList<ShareOpenGraphObject> list = new ArrayList<ShareOpenGraphObject>();
for (Parcelable item : items) {
if (item instanceof ShareOpenGraphObject) {
list.add((ShareOpenGraphObject) item);
}
}
return list;
}
use of android.os.Parcelable in project facebook-android-sdk by facebook.
the class ProfilePictureView method onSaveInstanceState.
/**
* Some of the current state is returned as a Bundle to allow quick restoration
* of the ProfilePictureView object in scenarios like orientation changes.
* @return a Parcelable containing the current state
*/
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle instanceState = new Bundle();
instanceState.putParcelable(SUPER_STATE_KEY, superState);
instanceState.putString(PROFILE_ID_KEY, profileId);
instanceState.putInt(PRESET_SIZE_KEY, presetSizeType);
instanceState.putBoolean(IS_CROPPED_KEY, isCropped);
instanceState.putParcelable(BITMAP_KEY, imageContents);
instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth);
instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight);
instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null);
return instanceState;
}
Aggregations