Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion app/src/main/java/com/readrops/app/item/ItemScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ class ItemScreen(
HorizontalPager(
state = pagerState,
beyondViewportPageCount = 2,
key = items.itemKey { it.item.id }
key = items.itemKey { it.item.id },
userScrollEnabled = state.swipeGesturePager
) { page ->
val itemWithFeed = items[page]

Expand Down
15 changes: 9 additions & 6 deletions app/src/main/java/com/readrops/app/item/ItemScreenModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,19 @@ class ItemScreenModel(
screenModelScope.launch(dispatcher) {
combine(
preferences.openLinksWith.flow,
preferences.theme.flow
) { openLinksWith, theme ->
openLinksWith to theme
}.collect { (openLinksWith, theme) ->
preferences.theme.flow,
preferences.swipeGesturePager.flow
) { openLinksWith, theme, swipeGesturePager ->
Triple(openLinksWith, theme, swipeGesturePager)
}.collect { (openLinksWith, theme, swipeGesturePager) ->
mutableState.update {
it.copy(
openInExternalBrowser = when (openLinksWith) {
"external_navigator" -> true
else -> false
},
theme = theme
theme = theme,
swipeGesturePager = swipeGesturePager
)
}
}
Expand Down Expand Up @@ -397,7 +399,8 @@ data class ItemState(
val openInExternalBrowser: Boolean = false,
val theme: String? = "",
val error: String? = null,
val stateChanges: List<StateChange> = listOf()
val stateChanges: List<StateChange> = listOf(),
val swipeGesturePager: Boolean = true
)

@Stable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ class PreferencesScreen : AndroidScreen() {

PreferenceHeader(text = stringResource(id = R.string.item_view))

SwitchPreferenceWidget(
preference = loadedState.swipeGesturePager.second,
isChecked = loadedState.swipeGesturePager.first,
title = stringResource(id = R.string.swipe_gesture_pager),
subtitle = stringResource(id = R.string.swipe_gesture_pager_subtitle)
)

ListPreferenceWidget(
preference = loadedState.openLinksWith.second,
selectedKey = loadedState.openLinksWith.first,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PreferencesScreenModel(
customShareIntentTpl.flow,
swipeToLeft.flow,
swipeToRight.flow,
swipeGesturePager.flow,
)

combine(
Expand All @@ -61,6 +62,7 @@ class PreferencesScreenModel(
customShareIntentTpl = (list[9] as String) to customShareIntentTpl,
swipeToLeft = (list[10] as String) to swipeToLeft,
swipeToRight = (list[11] as String) to swipeToRight,
swipeGesturePager = (list[12] as Boolean) to swipeGesturePager,
exampleItem = ItemWithFeed(
item = Item(
title = context.getString(R.string.example_item_title),
Expand Down Expand Up @@ -116,6 +118,7 @@ sealed class PreferencesScreenState {
val customShareIntentTpl: PreferenceState<String>,
val swipeToLeft: PreferenceState<String>,
val swipeToRight: PreferenceState<String>,
val swipeGesturePager: PreferenceState<Boolean>,
val exampleItem: ItemWithFeed,
val showDialog: Boolean = false
) : PreferencesScreenState()
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/readrops/app/util/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ class Preferences(
key = stringPreferencesKey("swipe_to_left_action"),
default = "READ"
)

val swipeGesturePager = Preference(
dataStore = dataStore,
key = booleanPreferencesKey("swipe_gesture_pager"),
default = true
)
}


Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,6 @@
<string name="no_network">No network connection available</string>
<string name="empty_file">File is empty</string>
<string name="color_contrast_too_low">Contrast with background is too low. The default color will be used instead when using this theme.</string>
<string name="swipe_gesture_pager">Swipe between articles</string>
<string name="swipe_gesture_pager_subtitle">Swipe horizontally to navigate to previous or next articles</string>
</resources>