ListBuilderKt

Added in 1.0.0-alpha08

public final class ListBuilderKt


Summary

Public methods

static final @NonNull ListBuilder
gridRow(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull GridRowBuilderDslUnit> buildGrid
)
static final @NonNull ListBuilder
header(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull HeaderBuilderDslUnit> buildHeader
)
static final @NonNull ListBuilder
inputRange(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull InputRangeBuilderDslUnit> buildInputRange
)
static final @NonNull Slice
list(
    @NonNull Context context,
    @NonNull Uri uri,
    long ttl,
    @ExtensionFunctionType @NonNull Function1<@NonNull ListBuilderDslUnit> addRows
)

Reduces verbosity required to build a Slice in Kotlin.

static final @NonNull ListBuilder
range(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull RangeBuilderDslUnit> buildRange
)
static final @NonNull ListBuilder
row(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull RowBuilderDslUnit> buildRow
)
static final @NonNull ListBuilder
seeMoreRow(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull RowBuilderDslUnit> buildRow
)
static final @NonNull SliceAction
tapSliceAction(
    @NonNull PendingIntent pendingIntent,
    @NonNull IconCompat icon,
    int imageMode,
    @NonNull CharSequence title
)

Factory method to build a tappable SliceAction.

static final @NonNull SliceAction
toggleSliceAction(
    @NonNull PendingIntent pendingIntent,
    IconCompat icon,
    @NonNull CharSequence title,
    boolean isChecked
)

Factory method to build a toggleable SliceAction.

Public methods

public static final @NonNull ListBuilder gridRow(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull GridRowBuilderDslUnit> buildGrid
)
See also
addGridRow
public static final @NonNull ListBuilder header(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull HeaderBuilderDslUnit> buildHeader
)
See also
setHeader
public static final @NonNull ListBuilder inputRange(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull InputRangeBuilderDslUnit> buildInputRange
)
See also
addInputRange
public static final @NonNull Slice list(
    @NonNull Context context,
    @NonNull Uri uri,
    long ttl,
    @ExtensionFunctionType @NonNull Function1<@NonNull ListBuilderDslUnit> addRows
)

Reduces verbosity required to build a Slice in Kotlin. Usage example:

val slice = list(context = context, uri = testUri, ttl = ListBuilder.INFINITY) {
    gridRow {
        setPrimaryAction(action)
        cell {
            addTitleText("Title 1")
            addImage(createIcon(R.drawable.ic_android_black_24dp), ListBuilder.SMALL_IMAGE)
            addText("Text 1")
        }
        cell {
            addTitleText("Title 2")
            addImage(createIcon(R.drawable.ic_android_black_24dp), ListBuilder.SMALL_IMAGE)
            addText("Text 2")
        }
    }
    row {
        setTitle("Title")
        setSubtitle("Subtitle")
        setPrimaryAction(sliceAction)
    }
}
See also
build
public static final @NonNull ListBuilder range(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull RangeBuilderDslUnit> buildRange
)
See also
addRange
public static final @NonNull ListBuilder row(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull RowBuilderDslUnit> buildRow
)
See also
addRow
public static final @NonNull ListBuilder seeMoreRow(
    @NonNull ListBuilderDsl receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull RowBuilderDslUnit> buildRow
)
See also
setSeeMoreRow

tapSliceAction

public static final @NonNull SliceAction tapSliceAction(
    @NonNull PendingIntent pendingIntent,
    @NonNull IconCompat icon,
    int imageMode,
    @NonNull CharSequence title
)

Factory method to build a tappable SliceAction.

toggleSliceAction

public static final @NonNull SliceAction toggleSliceAction(
    @NonNull PendingIntent pendingIntent,
    IconCompat icon,
    @NonNull CharSequence title,
    boolean isChecked
)

Factory method to build a toggleable SliceAction.