1
- # multi selector bottom sheet library
1
+ # Bottom Sheet Custom Views
2
2
3
3
How to implement?
4
4
```
@@ -15,20 +15,65 @@ dependencies {
15
15
implementation 'com.github.maxx2478:multi_selector_dialog_library:1.1'
16
16
}
17
17
```
18
- How to show Bottom Sheet Dialog?
18
+
19
+ ** 1) Show a Filter Bottom Sheet (inspired by flipkart)**
20
+
21
+ ![ image] ( https://user-images.githubusercontent.com/64951609/197324236-6f8a8646-2d4a-4fb7-b966-8d9579d33d56.png )
22
+
23
+ ```
24
+ var list2 = arrayListOf<Category?>()
25
+ list2.add(
26
+ Category(
27
+ catID = "1.1",
28
+ catName = "Fruits Fruits Fruits FruitsFruits FruitsFruits",
29
+ isCatHovered = false,
30
+ isCatSelected = false,
31
+ filters = arrayListOf<SelectionModel>(
32
+ SelectionModel(data = SearchModel("1", "Apples"), isSelected = false, catID = "1.1"),
33
+ SelectionModel(data = SearchModel("2", "Grapes"), isSelected = false, catID = "1.1"),
34
+ SelectionModel(data = SearchModel("3", "Grapes 2"), isSelected = false, catID = "1.1"),
35
+ SelectionModel(data = SearchModel("4", "Grapes 3"), isSelected = false, catID = "1.1")
36
+ ),
37
+ isSingleSelection = false //choose mode : true-> single selection, false -> many
38
+ )
39
+ )
40
+ // add more items in the list
41
+ FilterBottomSheetDialog.show("Filters", this, list){ it->
42
+ //List of all items (including selected and not selected)
43
+ list2 = ArrayList(it) //update your list
44
+ filterUIItems(list2)
45
+ }.show()
46
+ ```
47
+
48
+ ** 2) Show a Multi Selector Bottom Sheet Dialog**
19
49
```
20
50
val list = arrayListOf<SelectionModel>()
21
51
list.add(SelectionModel(data = SearchModel("1", "Apples"), isSelected = false))
22
52
list.add(SelectionModel(data = SearchModel("2", "Grapes"), isSelected = false))
23
53
//add as much as you want
24
54
25
- SelectorDialog.showSelectorDialog ("Choose your favourite fruits", this, list) { selectedItems->
55
+ MultiSelectorDialog.show ("Choose your favourite fruits", this, list) { selectedItems->
26
56
//Selected Items List
27
57
Toast.makeText(this, selectedItems.toString(), Toast.LENGTH_SHORT).show()
28
58
29
59
}.show()
30
60
31
61
```
32
62
![ image] ( https://user-images.githubusercontent.com/64951609/196044350-3bdd920b-29c5-40f5-ad8a-1bd7e9e9f999.png )
33
- ![ image] ( https://user-images.githubusercontent.com/64951609/196044374-2cafa511-0cd5-4bad-a40a-64ab1df16b6a.png )
34
63
64
+
65
+ ** 3) Show a Single Selection Bottom Sheet**
66
+ ```
67
+ val list = arrayListOf<SelectionModel>()
68
+ list.add(SelectionModel(data = SearchModel("1", "Apples"), isSelected = false))
69
+ list.add(SelectionModel(data = SearchModel("2", "Grapes"), isSelected = false))
70
+ //add as much as you want
71
+
72
+ SelectorDialog.show("Choose your favourite fruits", this, list) { selectedItem->
73
+ //Selected Item
74
+ Toast.makeText(this, selectedItem.toString(), Toast.LENGTH_SHORT).show()
75
+
76
+ }.show()
77
+
78
+ ```
79
+
0 commit comments