Add extension repo mentions to more places
This commit is contained in:
parent
c3fabce45a
commit
8625e75a2b
@ -10,11 +10,13 @@ import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Close
|
||||
import androidx.compose.material.icons.outlined.ErrorOutline
|
||||
import androidx.compose.material.icons.outlined.GetApp
|
||||
import androidx.compose.material.icons.outlined.Public
|
||||
import androidx.compose.material.icons.outlined.Refresh
|
||||
@ -38,6 +40,7 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
@ -91,6 +94,10 @@ fun ExtensionScreen(
|
||||
state.isEmpty -> {
|
||||
val msg = if (!searchQuery.isNullOrEmpty()) {
|
||||
MR.strings.no_results_found
|
||||
// SY -->
|
||||
} else if (!state.hasExtensionRepos) {
|
||||
SYMR.strings.no_repos_found
|
||||
// SY <--
|
||||
} else {
|
||||
MR.strings.empty_screen
|
||||
}
|
||||
@ -150,6 +157,31 @@ private fun ExtensionContent(
|
||||
}
|
||||
}
|
||||
|
||||
// SY -->
|
||||
if (!state.hasExtensionRepos) {
|
||||
item(key = "extension-repos-warning") {
|
||||
Column(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = MaterialTheme.padding.medium),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.ErrorOutline,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.error,
|
||||
)
|
||||
Text(
|
||||
text = stringResource(SYMR.strings.no_repos_found),
|
||||
textAlign = TextAlign.Center,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
|
||||
state.items.forEach { (header, items) ->
|
||||
item(
|
||||
contentType = "header",
|
||||
|
@ -13,13 +13,11 @@ import androidx.compose.material.icons.automirrored.outlined.HelpOutline
|
||||
import androidx.compose.material.icons.automirrored.outlined.Label
|
||||
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
|
||||
import androidx.compose.material.icons.outlined.CloudOff
|
||||
import androidx.compose.material.icons.outlined.Extension
|
||||
import androidx.compose.material.icons.outlined.GetApp
|
||||
import androidx.compose.material.icons.outlined.HelpOutline
|
||||
import androidx.compose.material.icons.outlined.History
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
import androidx.compose.material.icons.outlined.Label
|
||||
import androidx.compose.material.icons.outlined.NewReleases
|
||||
import androidx.compose.material.icons.outlined.PlaylistAdd
|
||||
import androidx.compose.material.icons.outlined.QueryStats
|
||||
import androidx.compose.material.icons.outlined.Settings
|
||||
import androidx.compose.material.icons.outlined.Storage
|
||||
@ -60,9 +58,12 @@ fun MoreScreen(
|
||||
onClickDataAndStorage: () -> Unit,
|
||||
onClickSettings: () -> Unit,
|
||||
onClickAbout: () -> Unit,
|
||||
// SY -->
|
||||
onClickBatchAdd: () -> Unit,
|
||||
onClickUpdates: () -> Unit,
|
||||
onClickHistory: () -> Unit,
|
||||
onClickRepos: () -> Unit,
|
||||
// SY <--
|
||||
) {
|
||||
val uriHandler = LocalUriHandler.current
|
||||
|
||||
@ -163,6 +164,15 @@ fun MoreScreen(
|
||||
onPreferenceClick = onClickDownloadQueue,
|
||||
)
|
||||
}
|
||||
// SY -->
|
||||
item {
|
||||
TextPreferenceWidget(
|
||||
title = stringResource(MR.strings.label_extension_repos),
|
||||
icon = Icons.Outlined.Extension,
|
||||
onPreferenceClick = onClickRepos
|
||||
)
|
||||
}
|
||||
// SY <--
|
||||
item {
|
||||
TextPreferenceWidget(
|
||||
title = stringResource(MR.strings.categories),
|
||||
|
@ -129,6 +129,15 @@ class ExtensionsScreenModel(
|
||||
basePreferences.extensionInstaller().changes()
|
||||
.onEach { mutableState.update { state -> state.copy(installer = it) } }
|
||||
.launchIn(screenModelScope)
|
||||
|
||||
// SY -->
|
||||
preferences.extensionRepos()
|
||||
.changes()
|
||||
.onEach { repos ->
|
||||
mutableState.update { it.copy(hasExtensionRepos = repos.isNotEmpty()) }
|
||||
}
|
||||
.launchIn(screenModelScope)
|
||||
// SY <--
|
||||
}
|
||||
|
||||
fun search(query: String?) {
|
||||
@ -206,6 +215,9 @@ class ExtensionsScreenModel(
|
||||
val updates: Int = 0,
|
||||
val installer: BasePreferences.ExtensionInstaller? = null,
|
||||
val searchQuery: String? = null,
|
||||
// SY -->
|
||||
val hasExtensionRepos: Boolean = false,
|
||||
// SY <--
|
||||
) {
|
||||
val isEmpty = items.isEmpty()
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import eu.kanade.core.preference.asState
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.presentation.more.MoreScreen
|
||||
import eu.kanade.presentation.more.settings.screen.browse.ExtensionReposScreen
|
||||
import eu.kanade.presentation.util.Tab
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
@ -87,6 +88,7 @@ object MoreTab : Tab {
|
||||
onClickBatchAdd = { navigator.push(BatchAddScreen()) },
|
||||
onClickUpdates = { navigator.push(UpdatesTab) },
|
||||
onClickHistory = { navigator.push(HistoryTab) },
|
||||
onClickRepos = { navigator.push(ExtensionReposScreen()) }
|
||||
// SY <--
|
||||
)
|
||||
}
|
||||
|
@ -391,6 +391,7 @@
|
||||
<!-- Extension section -->
|
||||
<string name="ext_redundant">Redundant</string>
|
||||
<string name="redundant_extension_message">This extension is redundant and will not be used inside this version of Tachiyomi.</string>
|
||||
<string name="no_repos_found">No extension repositories found, please add some under More -> Extension repos!</string>
|
||||
|
||||
<!-- Migration -->
|
||||
<string name="select_sources">Select sources</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user