Move source’s package settings button to SourceFeedScreen
This commit is contained in:
parent
64d1ef89a6
commit
b6a60201b6
4 changed files with 33 additions and 8 deletions
|
|
@ -13,9 +13,11 @@ import eu.kanade.presentation.browse.components.GlobalSearchCardRow
|
|||
import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem
|
||||
import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
|
||||
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
|
||||
import eu.kanade.presentation.browse.components.SourceSettingsButton
|
||||
import eu.kanade.presentation.components.AppBarTitle
|
||||
import eu.kanade.presentation.components.SearchToolbar
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.source.model.FeedSavedSearch
|
||||
import tachiyomi.domain.source.model.SavedSearch
|
||||
|
|
@ -96,6 +98,9 @@ fun SourceFeedScreen(
|
|||
searchQuery: String?,
|
||||
onSearchQueryChange: (String?) -> Unit,
|
||||
getMangaState: @Composable (Manga) -> State<Manga>,
|
||||
// KMK -->
|
||||
id: Long,
|
||||
// KMK <--
|
||||
) {
|
||||
Scaffold(
|
||||
topBar = { scrollBehavior ->
|
||||
|
|
@ -105,6 +110,9 @@ fun SourceFeedScreen(
|
|||
onSearchQueryChange = onSearchQueryChange,
|
||||
scrollBehavior = scrollBehavior,
|
||||
onClickSearch = onClickSearch,
|
||||
// KMK -->
|
||||
id = id,
|
||||
// KMK <--
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
|
|
@ -213,6 +221,9 @@ fun SourceFeedToolbar(
|
|||
onSearchQueryChange: (String?) -> Unit,
|
||||
scrollBehavior: TopAppBarScrollBehavior,
|
||||
onClickSearch: (String) -> Unit,
|
||||
// KMK -->
|
||||
id: Long
|
||||
// KMK <--
|
||||
) {
|
||||
SearchToolbar(
|
||||
titleContent = { AppBarTitle(title) },
|
||||
|
|
@ -222,5 +233,12 @@ fun SourceFeedToolbar(
|
|||
onClickCloseSearch = { onSearchQueryChange(null) },
|
||||
scrollBehavior = scrollBehavior,
|
||||
placeholderText = stringResource(MR.strings.action_search_hint),
|
||||
// KMK -->
|
||||
actions = {
|
||||
persistentListOf(
|
||||
SourceSettingsButton(id)
|
||||
)
|
||||
}
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ import androidx.compose.ui.text.input.VisualTransformation
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.browse.components.BaseSourceItem
|
||||
import eu.kanade.presentation.browse.components.SourceSettingsButton
|
||||
import eu.kanade.tachiyomi.ui.browse.source.SourcesScreenModel
|
||||
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceScreenModel.Listing
|
||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
|
|
@ -382,9 +381,6 @@ private fun SourceItem(
|
|||
)
|
||||
}
|
||||
// SY <--
|
||||
// KMK -->
|
||||
SourceSettingsButton(source = source)
|
||||
// KMK <--
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import androidx.compose.material.icons.Icons
|
|||
import androidx.compose.material.icons.outlined.Settings
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
|
|
@ -21,11 +20,14 @@ import tachiyomi.source.local.LocalSource
|
|||
// KMK -->
|
||||
@Composable
|
||||
fun SourceSettingsButton(
|
||||
source: Source,
|
||||
id: Long,
|
||||
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier
|
||||
) {
|
||||
// Avoid E-Hentai & ExHentai which is built-in & not actually installed extensions
|
||||
if (source.id == LocalSource.ID || source.id == EH_SOURCE_ID || source.id == EXH_SOURCE_ID) return
|
||||
if (id == LocalSource.ID || id == EH_SOURCE_ID || id == EXH_SOURCE_ID) return
|
||||
|
||||
// Create a fake source
|
||||
val source = Source(id,"", "", supportsLatest = false, isStub = false)
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
IconButton(onClick = {
|
||||
if (source.installedExtension !== null)
|
||||
|
|
@ -33,9 +35,15 @@ fun SourceSettingsButton(
|
|||
}) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Settings,
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
contentDescription = stringResource(MR.strings.label_settings),
|
||||
)
|
||||
}
|
||||
}
|
||||
@Composable
|
||||
fun SourceSettingsButton(
|
||||
source: Source,
|
||||
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier
|
||||
) {
|
||||
SourceSettingsButton(id = source.id)
|
||||
}
|
||||
// KMK <--
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ class SourceFeedScreen(val sourceId: Long) : Screen() {
|
|||
searchQuery = state.searchQuery,
|
||||
onSearchQueryChange = screenModel::search,
|
||||
getMangaState = { screenModel.getManga(initialManga = it) },
|
||||
// KMK -->
|
||||
id = screenModel.source.id,
|
||||
// KMK <--
|
||||
)
|
||||
|
||||
val onDismissRequest = screenModel::dismissDialog
|
||||
|
|
|
|||
Loading…
Reference in a new issue