abstract class StorageStrategy<K>


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
<K>

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<K!>)

Creates a Bundle from supplied Selection.

abstract Selection<K!>?

Create a Selection from supplied Bundle.

java-static StorageStrategy<Long!>
java-static StorageStrategy<K!>
java-static StorageStrategy<String!>

Public constructors

StorageStrategy

Added in 1.0.0
StorageStrategy(type: Class<K!>)

Creates a new instance.

Parameters
type: Class<K!>

the key type class that is being used.

Public functions

asBundle

Added in 1.0.0
abstract fun asBundle(selection: Selection<K!>): Bundle

Creates a Bundle from supplied Selection.

Parameters
selection: Selection<K!>

The selection to asBundle.

asSelection

Added in 1.0.0
abstract fun asSelection(state: Bundle): Selection<K!>?

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 <K : Parcelable?> createParcelableStorage(type: Class<K!>): StorageStrategy<K!>
Returns
StorageStrategy<K!>

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.