Click on Source name in MangaScreen will open Source's Browsing instead of Global searching
This commit is contained in:
parent
c0a3c7465c
commit
329417c431
4 changed files with 53 additions and 4 deletions
|
|
@ -175,6 +175,7 @@ fun MangaScreen(
|
|||
getMangaState: @Composable ((Manga) -> State<Manga>),
|
||||
onRelatedMangaClick: (Manga) -> Unit,
|
||||
onRelatedMangaLongClick: (Manga) -> Unit,
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
|
@ -233,6 +234,7 @@ fun MangaScreen(
|
|||
getMangaState = getMangaState,
|
||||
onRelatedMangaClick = onRelatedMangaClick,
|
||||
onRelatedMangaLongClick = onRelatedMangaLongClick,
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
} else {
|
||||
|
|
@ -284,6 +286,7 @@ fun MangaScreen(
|
|||
getMangaState = getMangaState,
|
||||
onRelatedMangaClick = onRelatedMangaClick,
|
||||
onRelatedMangaLongClick = onRelatedMangaLongClick,
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
|
|
@ -352,6 +355,7 @@ private fun MangaScreenSmallImpl(
|
|||
getMangaState: @Composable ((Manga) -> State<Manga>),
|
||||
onRelatedMangaClick: (Manga) -> Unit,
|
||||
onRelatedMangaLongClick: (Manga) -> Unit,
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
val chapterListState = rememberLazyListState()
|
||||
|
|
@ -500,6 +504,9 @@ private fun MangaScreenSmallImpl(
|
|||
status = state.manga.status,
|
||||
onCoverClick = onCoverClicked,
|
||||
doSearch = onSearch,
|
||||
// KMK -->
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -707,6 +714,7 @@ fun MangaScreenLargeImpl(
|
|||
getMangaState: @Composable ((Manga) -> State<Manga>),
|
||||
onRelatedMangaClick: (Manga) -> Unit,
|
||||
onRelatedMangaLongClick: (Manga) -> Unit,
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
val layoutDirection = LocalLayoutDirection.current
|
||||
|
|
@ -847,6 +855,9 @@ fun MangaScreenLargeImpl(
|
|||
status = state.manga.status,
|
||||
onCoverClick = onCoverClicked,
|
||||
doSearch = onSearch,
|
||||
// KMK -->
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
MangaActionRow(
|
||||
favorite = state.manga.favorite,
|
||||
|
|
|
|||
|
|
@ -107,6 +107,9 @@ fun MangaInfoBox(
|
|||
onCoverClick: () -> Unit,
|
||||
doSearch: (query: String, global: Boolean) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
// KMK -->
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
Box(modifier = modifier) {
|
||||
// Backdrop
|
||||
|
|
@ -144,6 +147,9 @@ fun MangaInfoBox(
|
|||
status = status,
|
||||
sourceName = sourceName,
|
||||
isStubSource = isStubSource,
|
||||
// KMK -->
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
} else {
|
||||
MangaAndSourceTitlesLarge(
|
||||
|
|
@ -157,6 +163,9 @@ fun MangaInfoBox(
|
|||
status = status,
|
||||
sourceName = sourceName,
|
||||
isStubSource = isStubSource,
|
||||
// KMK -->
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -383,6 +392,9 @@ private fun MangaAndSourceTitlesLarge(
|
|||
status: Long,
|
||||
sourceName: String,
|
||||
isStubSource: Boolean,
|
||||
// KMK -->
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
|
@ -406,6 +418,9 @@ private fun MangaAndSourceTitlesLarge(
|
|||
sourceName = sourceName,
|
||||
isStubSource = isStubSource,
|
||||
textAlign = TextAlign.Center,
|
||||
// KMK -->
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -422,6 +437,9 @@ private fun MangaAndSourceTitlesSmall(
|
|||
status: Long,
|
||||
sourceName: String,
|
||||
isStubSource: Boolean,
|
||||
// KMK -->
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
|
|
@ -449,6 +467,9 @@ private fun MangaAndSourceTitlesSmall(
|
|||
status = status,
|
||||
sourceName = sourceName,
|
||||
isStubSource = isStubSource,
|
||||
// KMK -->
|
||||
onSourceClick = onSourceClick,
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -464,6 +485,9 @@ private fun ColumnScope.MangaContentInfo(
|
|||
sourceName: String,
|
||||
isStubSource: Boolean,
|
||||
textAlign: TextAlign? = LocalTextStyle.current.textAlign,
|
||||
// KMK -->
|
||||
onSourceClick: () -> Unit,
|
||||
// KMK <--
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
Text(
|
||||
|
|
@ -588,10 +612,9 @@ private fun ColumnScope.MangaContentInfo(
|
|||
Text(
|
||||
text = sourceName,
|
||||
modifier = Modifier.clickableNoIndication {
|
||||
doSearch(
|
||||
sourceName,
|
||||
false,
|
||||
)
|
||||
// KMK -->
|
||||
onSourceClick()
|
||||
// KMK <--
|
||||
},
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ import exh.source.getMainSource
|
|||
import exh.source.isMdBasedSource
|
||||
import exh.ui.ifSourcesLoaded
|
||||
import exh.ui.metadata.MetadataViewScreen
|
||||
import exh.ui.smartsearch.SmartSearchScreen
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
|
|
@ -87,6 +88,8 @@ import tachiyomi.core.common.util.system.logcat
|
|||
import tachiyomi.domain.UnsortedPreferences
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.source.interactor.GetRemoteManga
|
||||
import tachiyomi.domain.source.model.StubSource
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.i18n.sy.SYMR
|
||||
|
|
@ -241,6 +244,16 @@ class MangaScreen(
|
|||
getMangaState = { screenModel.getManga(initialManga = it) },
|
||||
onRelatedMangaClick = { navigator.push(MangaScreen(it.id, true)) },
|
||||
onRelatedMangaLongClick = { bulkFavoriteScreenModel.addRemoveManga(it, haptic) },
|
||||
onSourceClick = {
|
||||
if (successState.source !is StubSource) {
|
||||
val screen = when {
|
||||
smartSearchConfig != null -> SmartSearchScreen(successState.source.id, smartSearchConfig)
|
||||
screenModel.useNewSourceNavigation -> SourceFeedScreen(successState.source.id)
|
||||
else -> BrowseSourceScreen(successState.source.id, GetRemoteManga.QUERY_POPULAR)
|
||||
}
|
||||
navigator.push(screen)
|
||||
}
|
||||
},
|
||||
// KMK <--
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,8 @@ class MangaScreenModel(
|
|||
|
||||
val loggedInTrackers by lazy { trackerManager.trackers.filter { it.isLoggedIn } }
|
||||
|
||||
val useNewSourceNavigation by uiPreferences.useNewSourceNavigation().asState(screenModelScope)
|
||||
|
||||
val manga: Manga?
|
||||
get() = successState?.manga
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue