khoben / sheetselection

An Android library for display list and be able to select the item as BottomSheet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sheet Selection

Jitpack SheetSelection GitHub license

Based on minibugdev/SheetSelection with some improvements:

  1. Multi-selection
  2. Retained selection callback
  3. Survive on rotation
  4. and more little changes...

Sample app (apk)

How to use

class MainActivity (or Fragment) : SheetSelectionListener {
    showSheetSelection("MY_TAG") {
        title("Sheet Selection")
        items(List(25) { 
            SheetSelectionItem("$it", "#$it") 
        })
        enableDraggableIndicator(true)
        enableMultiSelection(true)
        enableSearch(true)
        enableCloseButton(true)
        multiSelectionButtonText("Select")
        searchNotFoundText("Empty")
    }

    override fun onSheetItemsSelected(event: SheetSelectionEvent) {
        event.doIfMatches("MY_TAG") { selected ->
            Toast.makeText(
                this,
                "Selected: ${selected.joinToString { it.value }}",
                Toast.LENGTH_LONG
            ).show()
        }
    }
}

Screenshots

Installation

Add it in your root build.gradle at the end of repositories:

repositories {
    ..
    maven { url 'https://jitpack.io' }
}

Add the dependency

dependencies {
    implementation 'com.github.khoben:sheetselection:3.0.4'
}

About

An Android library for display list and be able to select the item as BottomSheet.

License:MIT License


Languages

Language:Kotlin 100.0%