public abstract class

ViewStatePagerAdapter

extends PagerAdapter
java.lang.Object
   ↳ androidx.viewpager.widget.PagerAdapter
     ↳ com.pspdfkit.ui.ViewStatePagerAdapter
Known Direct Subclasses

Class Overview

A simple implementation of PagerAdapter that automatically saves and restores view states when returning to pages previously removed and after view pager's state restoration. Similar to FragmentStatePagerAdapter but for use with just view, rather than fragments.

Summary

[Expand]
Inherited Constants
From class androidx.viewpager.widget.PagerAdapter
Protected Constructors
ViewStatePagerAdapter(int capacity)
Public Methods
final void destroyItem(ViewGroup container, int position, Object object)
final Object instantiateItem(ViewGroup container, int position)
final boolean isViewFromObject(View view, Object object)
final void restoreState(Parcelable state, ClassLoader loader)
final ViewStatePagerAdapter.SavedState saveState()
Protected Methods
abstract View createView(ViewGroup container, int position)
Creates the page for the given position to be attached to its container.
void destroyView(ViewGroup container, int position, View view)
Removes a page for the given position.
[Expand]
Inherited Methods
From class androidx.viewpager.widget.PagerAdapter
From class java.lang.Object

Protected Constructors

protected ViewStatePagerAdapter (int capacity)

Public Methods

public final void destroyItem (ViewGroup container, int position, Object object)

public final Object instantiateItem (ViewGroup container, int position)

public final boolean isViewFromObject (View view, Object object)

public final void restoreState (Parcelable state, ClassLoader loader)

public final ViewStatePagerAdapter.SavedState saveState ()

Protected Methods

protected abstract View createView (ViewGroup container, int position)

Creates the page for the given position to be attached to its container.

Parameters
container The containing View in which the page will be shown.
position The page position to be instantiated.
Returns
  • Returns a View representing the new page, must not be null.

protected void destroyView (ViewGroup container, int position, View view)

Removes a page for the given position.

Parameters
container The containing View from which the page will be removed.
position The page position to be removed.
view The page to be removed.