Easy to build bottomsheet menu with flexible handlers.
You can add the following line to your application build.gradle file dependencies to include the library:
implementation 'com.mantissa.bottomdialoglist:BottomDialogList:1.0.2'
or you can use Maven:
<dependency>
<groupId>com.mantissa.bottomdialoglist</groupId>
<artifactId>BottomDialogList</artifactId>
<version>1.0.2</version>
<type>pom</type>
</dependency>
-
Add the following few lines to your application's build.gradle file in order to enable databinding which is used inside this library:
android { dataBinding { enabled = true } }
-
Simply initalize the icons, titles & the onClick handlers list and use the builder with the corresponding options:
BottomDialogList.Builder() .setItemsIcons(icons) .setItemsTitles(titles) .setItemsClickListeners(events) .setBackgroundColor(COLOR) .setTextFontColor(COLOR) .setIconsColorTint(COLOR) .setDismissOnItemClicked(true) .setDialogMessage("Select One Option") .show(getSupportFragmentManager())
You can initialize and add elements to the events list as below:
ArrayList<View.OnClickListener> events = new ArrayList<>();
events.add(v -> {
Toast.makeText(this, "Hello World 1", Toast.LENGTH_LONG).show();
});
val events: ArrayList<View.OnClickListener> = ArrayList()
events.add(View.OnClickListener { v ->
Toast.makeText(this, "Hello World 1", Toast.LENGTH_LONG).show()
})
You can to the app sample in the project for more info.