summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt21
1 files changed, 19 insertions, 2 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
index d6111e2..b7f6018 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
@@ -27,6 +27,7 @@ import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.NavigateBefore
import androidx.compose.material.icons.filled.NavigateNext
import androidx.compose.material.icons.filled.OpenInBrowser
+import androidx.compose.material.icons.filled.SkipNext
import androidx.compose.material.icons.outlined.Article
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.BottomAppBar
@@ -141,6 +142,13 @@ fun ReaderScreen(
pagerState.animateScrollToPage((pagerState.currentPage + 1).coerceAtMost(safeIds.size - 1))
}
}
+ // "I looked, but I'm not done with this one" -- advances the same as Next, just without
+ // the implicit setRead(true) that moving on normally carries.
+ fun goToNextArticleKeepUnread() {
+ scope.launch {
+ pagerState.animateScrollToPage((pagerState.currentPage + 1).coerceAtMost(safeIds.size - 1))
+ }
+ }
HorizontalPager(state = pagerState, userScrollEnabled = false, modifier = Modifier.fillMaxSize()) { page ->
ReaderContent(
@@ -151,7 +159,8 @@ fun ReaderScreen(
hasPrevious = hasPrevious,
hasNext = hasNext,
onPrevious = ::goToPreviousArticle,
- onNext = ::goToNextArticle
+ onNext = ::goToNextArticle,
+ onNextKeepUnread = ::goToNextArticleKeepUnread
)
}
}
@@ -166,7 +175,8 @@ private fun ReaderContent(
hasPrevious: Boolean,
hasNext: Boolean,
onPrevious: () -> Unit,
- onNext: () -> Unit
+ onNext: () -> Unit,
+ onNextKeepUnread: () -> Unit
) {
val context = LocalContext.current
val db = remember { AppDatabase.get(context) }
@@ -241,6 +251,8 @@ private fun ReaderContent(
snackbarHostState.showSnackbar("Reader mode enabled for $feedLabel")
} else {
isReaderMode = false
+ readerContent = null
+ db.articleDao().setExtractedContent(articleId, null)
snackbarHostState.showSnackbar("Reader mode disabled for $feedLabel")
}
}
@@ -402,6 +414,11 @@ private fun ReaderContent(
Icon(Icons.Default.NavigateBefore, contentDescription = null)
Text("Previous")
}
+ // Advances like Next, but skips the implicit "mark read" that moving on
+ // normally carries -- for "I looked, but I'm not done with this one yet."
+ IconButton(onClick = onNextKeepUnread, enabled = hasNext) {
+ Icon(Icons.Default.SkipNext, contentDescription = "Next, keep unread")
+ }
TextButton(
onClick = onNext,
enabled = hasNext,