abstract class StorageStrategy

Strategy for storing keys in saved state. Extend this class when using custom key types that aren't supported by default. Prefer use of builtin storage strategies: createStringStorage, createLongStorage, createParcelableStorage.

See SelectionTracker.Builder for more detailed advice on which key type to use for your selection keys.

Parameters

Selection key type. Built in support is provided for String, Long, and Parcelable types. Use the respective factory method to create a StorageStrategy instance appropriate to the desired type. createStringStorage, createParcelableStorage, createLongStorage

Summary

Public constructors

Creates a new instance.

Public functions

abstract Bundle
asBundle(selection: Selection)

Creates a Bundle from supplied Selection.

abstract Selection?

Create a Selection from supplied Bundle.

java-static StorageStrategy<Long!>
java-static StorageStrategy
Parcelable?> createParcelableStorage(type: Class)
java-static StorageStrategy<String!>

Public constructors

StorageStrategy

Added in 1.0.0
StorageStrategy(type: Class)

Creates a new instance.

Parameters
type: Class

the key type class that is being used.

Public functions

asBundle

Added in 1.0.0
abstract fun asBundle(selection: Selection): Bundle

Creates a Bundle from supplied Selection.

Parameters
selection: Selection

The selection to asBundle.

asSelection

Added in 1.0.0
abstract fun asSelection(state: Bundle): Selection?

Create a Selection from supplied Bundle.

Parameters
state: Bundle

Bundle instance that may contain parceled Selection instance.

createLongStorage

Added in 1.0.0
java-static fun createLongStorage(): StorageStrategy<Long!>
Returns
StorageStrategy<Long!>

StorageStrategy suitable for use with Long keys.

createParcelableStorage

Added in 1.0.0
java-static fun Parcelable?> createParcelableStorage(type: Class): StorageStrategy
Returns
StorageStrategy

StorageStrategy suitable for use with Parcelable keys (like android.net.Uri).

createStringStorage

Added in 1.0.0
java-static fun createStringStorage(): StorageStrategy<String!>
Returns
StorageStrategy<String!>

StorageStrategy suitable for use with String keys.