Search in sources :

Example 46 with Parcelable

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;
}
Also used : Parcelable(android.os.Parcelable)

Example 47 with Parcelable

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;
}
Also used : Parcelable(android.os.Parcelable)

Example 48 with Parcelable

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);
}
Also used : RefactoredDefaultItemAnimator(com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator) ItemShadowDecorator(com.h6ah4i.android.widget.advrecyclerview.decoration.ItemShadowDecorator) Parcelable(android.os.Parcelable) GeneralItemAnimator(com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator) SimpleListDividerDecorator(com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerViewExpandableItemManager(com.h6ah4i.android.widget.advrecyclerview.expandable.RecyclerViewExpandableItemManager) NinePatchDrawable(android.graphics.drawable.NinePatchDrawable)

Example 49 with Parcelable

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;
}
Also used : ArrayList(java.util.ArrayList) Parcelable(android.os.Parcelable) Nullable(android.support.annotation.Nullable)

Example 50 with Parcelable

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;
}
Also used : Bundle(android.os.Bundle) Parcelable(android.os.Parcelable)

Aggregations

Parcelable (android.os.Parcelable)826 Bundle (android.os.Bundle)99 View (android.view.View)85 Intent (android.content.Intent)58 SparseArray (android.util.SparseArray)38 Test (org.junit.Test)31 ArrayList (java.util.ArrayList)26 MenuItem (android.view.MenuItem)23 ImageView (android.widget.ImageView)23 TextView (android.widget.TextView)17 MenuItem (com.actionbarsherlock.view.MenuItem)14 SuppressLint (android.annotation.SuppressLint)13 Dialog (android.app.Dialog)13 MediumTest (android.support.test.filters.MediumTest)13 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)12 Paint (android.graphics.Paint)12 MenuView (com.android.internal.view.menu.MenuView)12 RemoteException (android.os.RemoteException)11 Bitmap (android.graphics.Bitmap)10 ShortcutIconResource (android.content.Intent.ShortcutIconResource)9