SliceLiveData


@RequiresApi(value = 19)
public final class SliceLiveData


Class with factory methods for creating LiveData that observes slices.

See also
fromUri
LiveData

Summary

Nested types

Implementation of LiveDatathat provides controls over how cached vs live slices work.

Listener for errors when using fromStream.

@IntDef(value = )
@Retention(value = RetentionPolicy.SOURCE)
public annotation SliceLiveData.OnErrorListener.ErrorType

Public methods

static @NonNull SliceLiveData.CachedSliceLiveData
fromCachedSlice(
    @NonNull Context context,
    @NonNull InputStream input,
    SliceLiveData.OnErrorListener listener
)

Same as fromStream except returns as type CachedSliceLiveData.

static @NonNull LiveData<Slice>
fromIntent(@NonNull Context context, @NonNull Intent intent)

Produces a LiveData that tracks a Slice for a given Intent.

static @NonNull LiveData<Slice>
fromIntent(
    @NonNull Context context,
    @NonNull Intent intent,
    @Nullable SliceLiveData.OnErrorListener listener
)

Produces a LiveData that tracks a Slice for a given Intent.

static @NonNull LiveData<Slice>
fromStream(
    @NonNull Context context,
    @NonNull InputStream input,
    SliceLiveData.OnErrorListener listener
)

Produces a LiveData that tracks a Slice for a given InputStream.

static @NonNull LiveData<Slice>
fromUri(@NonNull Context context, @NonNull Uri uri)

Produces a LiveData that tracks a Slice for a given Uri.

static @NonNull LiveData<Slice>
fromUri(
    @NonNull Context context,
    @NonNull Uri uri,
    @Nullable SliceLiveData.OnErrorListener listener
)

Produces a LiveData that tracks a Slice for a given Uri.

Public methods

fromCachedSlice

Added in 1.1.0-alpha02
public static @NonNull SliceLiveData.CachedSliceLiveData fromCachedSlice(
    @NonNull Context context,
    @NonNull InputStream input,
    SliceLiveData.OnErrorListener listener
)

Same as fromStream except returns as type CachedSliceLiveData.

fromIntent

Added in 1.1.0-alpha02
public static @NonNull LiveData<SlicefromIntent(@NonNull Context context, @NonNull Intent intent)

Produces a LiveData that tracks a Slice for a given Intent. To use this method your app must have the permission to the slice Uri.

fromIntent

Added in 1.1.0-alpha02
public static @NonNull LiveData<SlicefromIntent(
    @NonNull Context context,
    @NonNull Intent intent,
    @Nullable SliceLiveData.OnErrorListener listener
)

Produces a LiveData that tracks a Slice for a given Intent. To use this method your app must have the permission to the slice Uri.

fromStream

Added in 1.1.0-alpha02
public static @NonNull LiveData<SlicefromStream(
    @NonNull Context context,
    @NonNull InputStream input,
    SliceLiveData.OnErrorListener listener
)

Produces a LiveData that tracks a Slice for a given InputStream. To use this method your app must have the permission to the slice Uri. This will not ask the hosting app for a slice immediately, instead it will display the slice passed in through the input. When the user interacts with the slice, then the app will be started to obtain the current slice and trigger the user action.

fromUri

Added in 1.1.0-alpha02
public static @NonNull LiveData<SlicefromUri(@NonNull Context context, @NonNull Uri uri)

Produces a LiveData that tracks a Slice for a given Uri. To use this method your app must have the permission to the slice Uri.

fromUri

Added in 1.1.0-alpha02
public static @NonNull LiveData<SlicefromUri(
    @NonNull Context context,
    @NonNull Uri uri,
    @Nullable SliceLiveData.OnErrorListener listener
)

Produces a LiveData that tracks a Slice for a given Uri. To use this method your app must have the permission to the slice Uri.