// Builds the options bottom sheet
val moreOptions = OptionsSheet().build(requireContext()) {
displayMode(DisplayMode.LIST)
title("More")
closeButtonDrawable(R.drawable.ic_down_arrow)
with(
Option(R.drawable.ic_share, "Share"),
Option(R.drawable.ic_add_circle, "Add to list")
)
onPositive { index: Int, option: Option ->
binding.root.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
if (index == 0) {
val sendIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND
val text = binding.quote.text.toString() + "\n\n~Gautama Buddha"
putExtra(Intent.EXTRA_TEXT, text)
type = "text/plain"
}
val shareIntent = Intent.createChooser(sendIntent, null)
startActivity(shareIntent)
} else {
dismiss()
//This is the indented action. We haven't coded the rest yet
}
}
}