Disable scrolling when context menu is open.

This commit is contained in:
Alex Hart 2023-04-25 10:36:27 -03:00
parent a0e4b1aaf9
commit a837f86999
2 changed files with 8 additions and 3 deletions

View file

@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.calls.log
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.menu.ActionItem
import org.thoughtcrime.securesms.components.menu.SignalContextMenu
@ -18,11 +19,15 @@ class CallLogContextMenu(
private val fragment: Fragment,
private val callbacks: Callbacks
) {
fun show(anchor: View, call: CallLogRow.Call) {
fun show(recyclerView: RecyclerView, anchor: View, call: CallLogRow.Call) {
recyclerView.suppressLayout(true)
anchor.isSelected = true
SignalContextMenu.Builder(anchor, anchor.parent as ViewGroup)
.preferredVerticalPosition(SignalContextMenu.VerticalPosition.BELOW)
.onDismiss { anchor.isSelected = false }
.onDismiss {
anchor.isSelected = false
recyclerView.suppressLayout(false)
}
.show(
listOfNotNull(
getVideoCallActionItem(call),

View file

@ -292,7 +292,7 @@ class CallLogFragment : Fragment(R.layout.call_log_fragment), CallLogAdapter.Cal
}
override fun onCallLongClicked(itemView: View, callLogRow: CallLogRow.Call): Boolean {
callLogContextMenu.show(itemView, callLogRow)
callLogContextMenu.show(binding.recycler, itemView, callLogRow)
return true
}