Browse Source

fix: replace ScrollView with NestedScrollView for proper nested scrolling

- Changed ScrollView to NestedScrollView in expanded history cards
- Removed custom touch event handling as NestedScrollView handles nested scrolling natively
- Fixed ScrollView reference in ViewHolder to use NestedScrollView
- Enables proper scrolling within expanded Pokemon data sections

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
feature/pgh-1-results-display-history
Quildra 5 months ago
parent
commit
293c0af196
  1. 14
      app/src/main/java/com/quillstudios/pokegoalshelper/ui/HistoryAdapter.kt

14
app/src/main/java/com/quillstudios/pokegoalshelper/ui/HistoryAdapter.kt

@ -179,24 +179,22 @@ class HistoryAdapter(
private fun createExpandedContent(context: Context): View
{
return ScrollView(context).apply {
return androidx.core.widget.NestedScrollView(context).apply {
// Set a reasonable fixed height for the scrollable area
layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
dpToPx(context, 300) // Fixed height to ensure scrolling works
)
// Configure scrolling behavior
isFillViewport = false // Important: false so content can exceed container height
isScrollbarFadingEnabled = false
scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
isVerticalScrollBarEnabled = true
// Configure scrolling behavior optimized for nested scrolling
isFillViewport = false
isNestedScrollingEnabled = true
val contentContainer = LinearLayout(context).apply {
orientation = LinearLayout.VERTICAL
layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT // Key: wrap content to allow scrolling
LinearLayout.LayoutParams.WRAP_CONTENT
)
setPadding(0, dpToPx(context, 8), 0, dpToPx(context, 16))
tag = "expanded_container"
@ -229,7 +227,7 @@ class HistoryAdapter(
{
private val cardContainer = itemView as LinearLayout
private val collapsedContent = itemView.findViewWithTag<LinearLayout>("collapsed_content")
private val expandedContent = itemView.findViewWithTag<ScrollView>("expanded_content")
private val expandedContent = itemView.findViewWithTag<androidx.core.widget.NestedScrollView>("expanded_content")
private val expandedContainer = expandedContent.findViewWithTag<LinearLayout>("expanded_container")
// Collapsed content views

Loading…
Cancel
Save