fix(widget): IMPL_09 - Fix scroll bug in standard widget size (3x2)

Changes:
- WidgetSizeClass.kt: Add NARROW_SCROLL and WIDE_SCROLL enum values
- NoteWidget.kt: Add SIZE_NARROW_SCROLL (110x150dp) and SIZE_WIDE_SCROLL (250x150dp) breakpoints
- NoteWidget.kt: Update sizeMode to include new breakpoints
- NoteWidgetContent.kt: Add WIDGET_HEIGHT_SCROLL_THRESHOLD (150dp)
- NoteWidgetContent.kt: Update toSizeClass() to classify 150dp+ height as SCROLL sizes
- NoteWidgetContent.kt: Combine NARROW_SCROLL + NARROW_TALL into single when branch
- NoteWidgetContent.kt: Combine WIDE_SCROLL + WIDE_TALL into single when branch
- NoteWidgetContent.kt: Remove clickable modifier from unlocked checklists to enable scrolling
- Locked checklists retain clickable for options, unlocked checklists scroll freely
This commit is contained in:
inventory69
2026-02-11 10:20:48 +01:00
parent a1a574a725
commit c72b3fe1c0
3 changed files with 72 additions and 30 deletions

View File

@@ -38,13 +38,18 @@ class NoteWidget : GlanceAppWidget() {
// Responsive Breakpoints — schmale + breite Spalten // Responsive Breakpoints — schmale + breite Spalten
val SIZE_SMALL = DpSize(110.dp, 80.dp) // Schmal+kurz: nur Titel val SIZE_SMALL = DpSize(110.dp, 80.dp) // Schmal+kurz: nur Titel
val SIZE_NARROW_MEDIUM = DpSize(110.dp, 110.dp) // Schmal+mittel: Vorschau val SIZE_NARROW_MEDIUM = DpSize(110.dp, 110.dp) // Schmal+mittel: Vorschau
val SIZE_NARROW_SCROLL = DpSize(110.dp, 150.dp) // 🆕 v1.8.1: Schmal+scroll (Standard 3x2)
val SIZE_NARROW_LARGE = DpSize(110.dp, 250.dp) // Schmal+groß: voller Inhalt val SIZE_NARROW_LARGE = DpSize(110.dp, 250.dp) // Schmal+groß: voller Inhalt
val SIZE_WIDE_MEDIUM = DpSize(250.dp, 110.dp) // Breit+mittel: Vorschau val SIZE_WIDE_MEDIUM = DpSize(250.dp, 110.dp) // Breit+mittel: Vorschau
val SIZE_WIDE_SCROLL = DpSize(250.dp, 150.dp) // 🆕 v1.8.1: Breit+scroll (Standard 3x2 breit)
val SIZE_WIDE_LARGE = DpSize(250.dp, 250.dp) // Breit+groß: voller Inhalt val SIZE_WIDE_LARGE = DpSize(250.dp, 250.dp) // Breit+groß: voller Inhalt
} }
override val sizeMode = SizeMode.Responsive( override val sizeMode = SizeMode.Responsive(
setOf(SIZE_SMALL, SIZE_NARROW_MEDIUM, SIZE_NARROW_LARGE, SIZE_WIDE_MEDIUM, SIZE_WIDE_LARGE) setOf(
SIZE_SMALL, SIZE_NARROW_MEDIUM, SIZE_NARROW_SCROLL, SIZE_NARROW_LARGE,
SIZE_WIDE_MEDIUM, SIZE_WIDE_SCROLL, SIZE_WIDE_LARGE
)
) )
override val stateDefinition = PreferencesGlanceStateDefinition override val stateDefinition = PreferencesGlanceStateDefinition

View File

@@ -52,6 +52,7 @@ import dev.dettmer.simplenotes.ui.editor.ComposeNoteEditorActivity
// ── Size Classification ── // ── Size Classification ──
private val WIDGET_HEIGHT_SMALL_THRESHOLD = 110.dp private val WIDGET_HEIGHT_SMALL_THRESHOLD = 110.dp
private val WIDGET_HEIGHT_SCROLL_THRESHOLD = 150.dp // 🆕 v1.8.1: Scrollbare Ansicht
private val WIDGET_SIZE_MEDIUM_THRESHOLD = 250.dp private val WIDGET_SIZE_MEDIUM_THRESHOLD = 250.dp
// 🆕 v1.8.0: Increased preview lengths for better text visibility // 🆕 v1.8.0: Increased preview lengths for better text visibility
@@ -60,9 +61,14 @@ private const val TEXT_PREVIEW_FULL_LENGTH = 300
private fun DpSize.toSizeClass(): WidgetSizeClass = when { private fun DpSize.toSizeClass(): WidgetSizeClass = when {
height < WIDGET_HEIGHT_SMALL_THRESHOLD -> WidgetSizeClass.SMALL height < WIDGET_HEIGHT_SMALL_THRESHOLD -> WidgetSizeClass.SMALL
width < WIDGET_SIZE_MEDIUM_THRESHOLD && height < WIDGET_SIZE_MEDIUM_THRESHOLD -> WidgetSizeClass.NARROW_MED
// 🆕 v1.8.1: Neue ScrollView-Schwelle bei 150dp Höhe
width < WIDGET_SIZE_MEDIUM_THRESHOLD && height < WIDGET_HEIGHT_SCROLL_THRESHOLD -> WidgetSizeClass.NARROW_MED
width < WIDGET_SIZE_MEDIUM_THRESHOLD && height < WIDGET_SIZE_MEDIUM_THRESHOLD -> WidgetSizeClass.NARROW_SCROLL
width < WIDGET_SIZE_MEDIUM_THRESHOLD -> WidgetSizeClass.NARROW_TALL width < WIDGET_SIZE_MEDIUM_THRESHOLD -> WidgetSizeClass.NARROW_TALL
height < WIDGET_SIZE_MEDIUM_THRESHOLD -> WidgetSizeClass.WIDE_MED
height < WIDGET_HEIGHT_SCROLL_THRESHOLD -> WidgetSizeClass.WIDE_MED
height < WIDGET_SIZE_MEDIUM_THRESHOLD -> WidgetSizeClass.WIDE_SCROLL
else -> WidgetSizeClass.WIDE_TALL else -> WidgetSizeClass.WIDE_TALL
} }
@@ -177,16 +183,30 @@ fun NoteWidgetContent(
} }
} }
WidgetSizeClass.NARROW_TALL -> Box(modifier = contentClickModifier) { // 🆕 v1.8.1 (IMPL_09): Scrollbare Größe (150dp+ Höhe)
WidgetSizeClass.NARROW_SCROLL,
WidgetSizeClass.NARROW_TALL -> {
when (note.noteType) { when (note.noteType) {
NoteType.TEXT -> TextNoteFullView(note) NoteType.TEXT -> Box(modifier = contentClickModifier) {
NoteType.CHECKLIST -> ChecklistFullView( TextNoteFullView(note)
}
NoteType.CHECKLIST -> {
// 🆕 v1.8.1: Locked: Click -> Options | Unlocked: kein Click -> Scroll frei
val checklistBoxModifier = if (isLocked) {
contentClickModifier
} else {
GlanceModifier.fillMaxSize()
}
Box(modifier = checklistBoxModifier) {
ChecklistFullView(
note = note, note = note,
isLocked = isLocked, isLocked = isLocked,
glanceId = glanceId glanceId = glanceId
) )
} }
} }
}
}
WidgetSizeClass.WIDE_MED -> Box(modifier = contentClickModifier) { WidgetSizeClass.WIDE_MED -> Box(modifier = contentClickModifier) {
when (note.noteType) { when (note.noteType) {
@@ -200,10 +220,22 @@ fun NoteWidgetContent(
} }
} }
WidgetSizeClass.WIDE_TALL -> Box(modifier = contentClickModifier) { // 🆕 v1.8.1 (IMPL_09): Scrollbare Größe (150dp+ Höhe)
WidgetSizeClass.WIDE_SCROLL,
WidgetSizeClass.WIDE_TALL -> {
when (note.noteType) { when (note.noteType) {
NoteType.TEXT -> TextNoteFullView(note) NoteType.TEXT -> Box(modifier = contentClickModifier) {
NoteType.CHECKLIST -> ChecklistFullView( TextNoteFullView(note)
}
NoteType.CHECKLIST -> {
// 🆕 v1.8.1: Locked: Click -> Options | Unlocked: kein Click -> Scroll frei
val checklistBoxModifier = if (isLocked) {
contentClickModifier
} else {
GlanceModifier.fillMaxSize()
}
Box(modifier = checklistBoxModifier) {
ChecklistFullView(
note = note, note = note,
isLocked = isLocked, isLocked = isLocked,
glanceId = glanceId glanceId = glanceId
@@ -214,6 +246,8 @@ fun NoteWidgetContent(
} }
} }
} }
}
}
/** /**
* Optionsleiste — Lock/Unlock + Refresh + Open in App * Optionsleiste — Lock/Unlock + Refresh + Open in App

View File

@@ -4,11 +4,14 @@ package dev.dettmer.simplenotes.widget
* 🆕 v1.8.0: Size classification for responsive Note Widget layouts * 🆕 v1.8.0: Size classification for responsive Note Widget layouts
* *
* Determines which layout variant to use based on widget dimensions. * Determines which layout variant to use based on widget dimensions.
* 🆕 v1.8.1: Added NARROW_SCROLL and WIDE_SCROLL for scrollable mid-size widgets
*/ */
enum class WidgetSizeClass { enum class WidgetSizeClass {
SMALL, // Nur Titel SMALL, // Nur Titel
NARROW_MED, // Schmal, Vorschau NARROW_MED, // Schmal, Vorschau (CompactView)
NARROW_SCROLL, // 🆕 v1.8.1: Schmal, scrollbare Liste (150dp+)
NARROW_TALL, // Schmal, voller Inhalt NARROW_TALL, // Schmal, voller Inhalt
WIDE_MED, // Breit, Vorschau WIDE_MED, // Breit, Vorschau (CompactView)
WIDE_SCROLL, // 🆕 v1.8.1: Breit, scrollbare Liste (150dp+)
WIDE_TALL // Breit, voller Inhalt WIDE_TALL // Breit, voller Inhalt
} }