Merge branch 'feature/feed-screen' into develop
This commit is contained in:
commit
e028fc3fb9
8 changed files with 33 additions and 15 deletions
|
|
@ -195,7 +195,12 @@ fun FeedAddSearchDialog(
|
|||
val context = LocalContext.current
|
||||
val savedSearchStrings = remember {
|
||||
savedSearches.map {
|
||||
it?.name ?: context.stringResource(MR.strings.latest)
|
||||
// KMK -->
|
||||
it?.name ?: if (source.supportsLatest)
|
||||
context.stringResource(MR.strings.latest)
|
||||
else
|
||||
context.stringResource(MR.strings.popular)
|
||||
// KMK <--
|
||||
}.toImmutableList()
|
||||
}
|
||||
RadioSelector(
|
||||
|
|
@ -208,7 +213,7 @@ fun FeedAddSearchDialog(
|
|||
},
|
||||
onDismissRequest = onDismiss,
|
||||
confirmButton = {
|
||||
TextButton(onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) }) {
|
||||
TextButton(onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) }, /* KMK --> */ enabled = selected != null /* KMK <-- */) {
|
||||
Text(text = stringResource(MR.strings.action_ok))
|
||||
}
|
||||
},
|
||||
|
|
@ -218,9 +223,9 @@ fun FeedAddSearchDialog(
|
|||
@Composable
|
||||
fun <T> RadioSelector(
|
||||
options: ImmutableList<T>,
|
||||
optionStrings: ImmutableList<String> = remember { options.map { it.toString() }.toImmutableList() },
|
||||
selected: Int?,
|
||||
onSelectOption: (Int) -> Unit,
|
||||
optionStrings: ImmutableList<String> = remember { options.map { it.toString() }.toImmutableList() },
|
||||
onSelectOption: (Int) -> Unit /* KMK --> */ = {} /* KMK <-- */,
|
||||
) {
|
||||
Column(Modifier.verticalScroll(rememberScrollState())) {
|
||||
optionStrings.forEachIndexed { index, option ->
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ fun SourcesScreen(
|
|||
|
||||
FastScrollLazyColumn(
|
||||
state = lazyListState,
|
||||
// KMK <--
|
||||
// KMK <--
|
||||
contentPadding = contentPadding + topSmallPaddingValues,
|
||||
) {
|
||||
items(
|
||||
|
|
|
|||
|
|
@ -30,15 +30,13 @@ import tachiyomi.presentation.core.i18n.stringResource
|
|||
|
||||
@Composable
|
||||
fun GlobalSearchResultItem(
|
||||
// SY -->
|
||||
modifier: Modifier = Modifier,
|
||||
// SY <--
|
||||
title: String,
|
||||
// SY -->
|
||||
subtitle: String?,
|
||||
// SY <--
|
||||
onClick: () -> Unit,
|
||||
// SY -->
|
||||
modifier: Modifier = Modifier,
|
||||
onLongClick: (() -> Unit)? = null,
|
||||
// SY <--
|
||||
content: @Composable () -> Unit,
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ open class FeedScreenModel(
|
|||
dialog = Dialog.AddFeedSearch(
|
||||
source,
|
||||
(
|
||||
(if (source.supportsLatest) persistentListOf(null) else persistentListOf()) +
|
||||
// KMK -->
|
||||
persistentListOf(null) +
|
||||
// KMK <-->
|
||||
getSourceSavedSearches(source.id)
|
||||
).toImmutableList(),
|
||||
),
|
||||
|
|
@ -150,7 +152,7 @@ open class FeedScreenModel(
|
|||
}
|
||||
|
||||
private suspend fun hasTooManyFeeds(): Boolean {
|
||||
return countFeedSavedSearchGlobal.await() > 10
|
||||
return countFeedSavedSearchGlobal.await() > MAX_FEED_ITEMS
|
||||
}
|
||||
|
||||
fun getEnabledSources(): ImmutableList<CatalogueSource> {
|
||||
|
|
@ -231,7 +233,12 @@ open class FeedScreenModel(
|
|||
if (itemUI.source != null) {
|
||||
withContext(coroutineDispatcher) {
|
||||
if (itemUI.savedSearch == null) {
|
||||
itemUI.source.getLatestUpdates(1)
|
||||
// KMK -->
|
||||
if (itemUI.source.supportsLatest)
|
||||
itemUI.source.getLatestUpdates(1)
|
||||
else
|
||||
itemUI.source.getPopularManga(1)
|
||||
// KMK <--
|
||||
} else {
|
||||
itemUI.source.getSearchManga(
|
||||
1,
|
||||
|
|
@ -323,3 +330,5 @@ data class FeedScreenState(
|
|||
val isLoadingItems
|
||||
get() = items?.fastAny { it.results == null } != false
|
||||
}
|
||||
|
||||
const val MAX_FEED_ITEMS = 20
|
||||
|
|
|
|||
|
|
@ -78,7 +78,12 @@ fun Screen.feedTab(): TabContent {
|
|||
navigator.push(
|
||||
BrowseSourceScreen(
|
||||
source.id,
|
||||
GetRemoteManga.QUERY_LATEST,
|
||||
// KMK -->
|
||||
listingQuery = if (!source.supportsLatest)
|
||||
GetRemoteManga.QUERY_POPULAR
|
||||
else
|
||||
GetRemoteManga.QUERY_LATEST,
|
||||
// KMK <--
|
||||
),
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import eu.kanade.presentation.browse.SourceFeedUI
|
|||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
||||
import eu.kanade.tachiyomi.ui.browse.feed.MAX_FEED_ITEMS
|
||||
import exh.source.getMainSource
|
||||
import exh.source.mangaDexSourceIds
|
||||
import exh.util.nullIfBlank
|
||||
|
|
@ -107,7 +108,7 @@ open class SourceFeedScreenModel(
|
|||
}
|
||||
|
||||
private suspend fun hasTooManyFeeds(): Boolean {
|
||||
return countFeedSavedSearchBySourceId.await(source.id) > 10
|
||||
return countFeedSavedSearchBySourceId.await(source.id) > MAX_FEED_ITEMS
|
||||
}
|
||||
|
||||
fun createFeed(savedSearchId: Long) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ data class FeedSavedSearch(
|
|||
// Source for the saved search
|
||||
val source: Long,
|
||||
|
||||
// If -1 then get latest, if set get the saved search
|
||||
// If null then get latest/popular, if set get the saved search
|
||||
val savedSearch: Long?,
|
||||
|
||||
// If the feed is a global or source specific feed
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@
|
|||
<!-- Feed Tab -->
|
||||
<string name="feed">Feed</string>
|
||||
<string name="feed_delete">Delete feed item?</string>
|
||||
<string name="too_many_in_feed">Too many sources in your feed, cannot add more then 10</string>
|
||||
<string name="too_many_in_feed">Too many sources in your feed, cannot add more than limited</string>
|
||||
<string name="feed_tab_empty">You don\'t have any sources in your feed, navigate to the top right to add one</string>
|
||||
<string name="feed_add">Add %1$s to feed?</string>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue