Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import android.util.Log
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
Expand Down Expand Up @@ -232,6 +234,31 @@ class ChatFragment : EmptyStateFragment<FragmentChatBinding>(FragmentChatBinding
LinearLayoutManager(requireContext()).apply {
stackFromEnd = true
}
// Prevent nested scroll from propagating to CoordinatorLayout so the app bar (project
// name, actions toolbar) does not scroll when the user scrolls the agent chat list.
ViewCompat.setNestedScrollingEnabled(binding.chatRecyclerView, false)
// Let the list scroll instead of the bottom sheet when the user drags over the chat.
binding.chatRecyclerView.addOnItemTouchListener(
object : RecyclerView.OnItemTouchListener {
override fun onInterceptTouchEvent(
rv: RecyclerView,
e: MotionEvent,
): Boolean {
if (e.actionMasked == MotionEvent.ACTION_DOWN) {
var p = rv.parent
while (p is ViewGroup) {
p.requestDisallowInterceptTouchEvent(true)
p = p.parent
}
}
return false
}

override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {}

override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {}
},
)
}

private fun setupListeners() {
Expand Down