Commit 213c89fb authored by Divyanshu Bhargava's avatar Divyanshu Bhargava

message action onclick

parent fdb5fa10
...@@ -74,7 +74,7 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>( ...@@ -74,7 +74,7 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>(
fun onActionSelected(item: MenuItem, message: Message) fun onActionSelected(item: MenuItem, message: Message)
} }
val longClickListener = { view: View -> val onClickListener = { view: View ->
if (data?.message?.isSystemMessage() == false) { if (data?.message?.isSystemMessage() == false) {
val menuItems = view.context.inflate(R.menu.message_actions).toList() val menuItems = view.context.inflate(R.menu.message_actions).toList()
menuItems.find { it.itemId == R.id.action_menu_msg_pin_unpin }?.apply { menuItems.find { it.itemId == R.id.action_menu_msg_pin_unpin }?.apply {
...@@ -85,12 +85,11 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>( ...@@ -85,12 +85,11 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>(
val adapter = ActionListAdapter(menuItems, this@BaseViewHolder) val adapter = ActionListAdapter(menuItems, this@BaseViewHolder)
BottomSheetMenu(adapter).show(view.context) BottomSheetMenu(adapter).show(view.context)
} }
true
} }
internal fun setupActionMenu(view: View) { internal fun setupActionMenu(view: View) {
if (listener.isActionsEnabled()) { if (listener.isActionsEnabled()) {
view.setOnLongClickListener(longClickListener) view.setOnClickListener(onClickListener)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment