repo icon for Komikku & Keiyoushi (#291)
This commit is contained in:
parent
50b837c976
commit
8a7c005d61
6 changed files with 99 additions and 62 deletions
|
|
@ -1,14 +1,16 @@
|
|||
package eu.kanade.presentation.more.settings.screen.browse.components
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.outlined.Label
|
||||
import androidx.compose.material.icons.automirrored.outlined.OpenInNew
|
||||
import androidx.compose.material.icons.outlined.ContentCopy
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
|
|
@ -23,9 +25,14 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import kotlinx.collections.immutable.ImmutableSet
|
||||
import kotlinx.collections.immutable.persistentSetOf
|
||||
|
|
@ -89,6 +96,23 @@ private fun ExtensionRepoListItem(
|
|||
ElevatedCard(
|
||||
modifier = modifier,
|
||||
) {
|
||||
// KMK -->
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(start = MaterialTheme.padding.medium),
|
||||
) {
|
||||
val resId = repoResId(repo.baseUrl)
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(id = resId),
|
||||
contentDescription = null,
|
||||
alpha = if (isDisabled) 0.4f else 1f,
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.clip(MaterialTheme.shapes.extraSmall)
|
||||
.align(Alignment.CenterVertically),
|
||||
)
|
||||
Column {
|
||||
// KMK <--
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
|
@ -99,16 +123,9 @@ private fun ExtensionRepoListItem(
|
|||
),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Outlined.Label,
|
||||
contentDescription = null,
|
||||
// KMK -->
|
||||
tint = LocalContentColor.current.let { if (isDisabled) it.copy(alpha = 0.6f) else it },
|
||||
// KMK <--
|
||||
)
|
||||
Text(
|
||||
text = repo.name,
|
||||
modifier = Modifier.padding(start = MaterialTheme.padding.medium),
|
||||
// KMK: modifier = Modifier.padding(start = MaterialTheme.padding.medium),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
// KMK -->
|
||||
color = LocalContentColor.current.let { if (isDisabled) it.copy(alpha = 0.6f) else it },
|
||||
|
|
@ -158,14 +175,23 @@ private fun ExtensionRepoListItem(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// KMK -->
|
||||
fun repoResId(baseUrl: String) = when (baseUrl) {
|
||||
"https://raw.githubusercontent.com/komikku-app/extensions/repo" -> R.mipmap.komikku
|
||||
"https://raw.githubusercontent.com/keiyoushi/extensions/repo" -> R.mipmap.keiyoushi
|
||||
else -> R.mipmap.extension
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun ExtensionReposContentPreview() {
|
||||
val repos = persistentSetOf(
|
||||
ExtensionRepo("url1", "Repo 1", "", "", "key1"),
|
||||
ExtensionRepo("url2", "Repo 2", "", "", "key2"),
|
||||
ExtensionRepo("https://raw.githubusercontent.com/komikku-app/extensions/repo", "Komikku", "", "", "key1"),
|
||||
ExtensionRepo("https://raw.githubusercontent.com/keiyoushi/extensions/repo", "Keiyoushi", "", "", "key2"),
|
||||
ExtensionRepo("https://repo", "Other", "", "", "key2"),
|
||||
)
|
||||
ExtensionReposContent(
|
||||
repos = repos,
|
||||
|
|
@ -175,7 +201,7 @@ fun ExtensionReposContentPreview() {
|
|||
onClickDelete = {},
|
||||
onClickEnable = {},
|
||||
onClickDisable = {},
|
||||
disabledRepos = setOf("url2"),
|
||||
disabledRepos = setOf("https://repo"),
|
||||
)
|
||||
}
|
||||
// KMK <--
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ fun ExtensionReposScreen(
|
|||
EmptyScreen(
|
||||
MR.strings.information_empty_repos,
|
||||
modifier = Modifier.padding(paddingValues),
|
||||
// KMK -->
|
||||
help = {
|
||||
TextButton(
|
||||
onClick = { context.openInBrowser(OFFICIAL_REPO_WEBSITE) },
|
||||
|
|
@ -86,6 +87,7 @@ fun ExtensionReposScreen(
|
|||
Text(text = stringResource(MR.strings.label_help))
|
||||
}
|
||||
},
|
||||
// KMK <--
|
||||
)
|
||||
return@Scaffold
|
||||
}
|
||||
|
|
@ -112,10 +114,11 @@ fun ExtensionReposScreen(
|
|||
private fun ExtensionReposScreenPreview() {
|
||||
val state = RepoScreenState.Success(
|
||||
repos = persistentSetOf(
|
||||
ExtensionRepo("url1", "Repo 1", "", "", "key1"),
|
||||
ExtensionRepo("url2", "Repo 2", "", "", "key2"),
|
||||
ExtensionRepo("https://raw.githubusercontent.com/komikku-app/extensions/repo", "Komikku", "", "", "key1"),
|
||||
ExtensionRepo("https://raw.githubusercontent.com/keiyoushi/extensions/repo", "Keiyoushi", "", "", "key2"),
|
||||
ExtensionRepo("https://repo", "Other", "", "", "key2"),
|
||||
),
|
||||
disabledRepos = setOf("url2"),
|
||||
disabledRepos = setOf("https://repo"),
|
||||
)
|
||||
ExtensionReposScreen(
|
||||
state = state,
|
||||
|
|
|
|||
BIN
app/src/main/res/mipmap/extension.png
Normal file
BIN
app/src/main/res/mipmap/extension.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/mipmap/keiyoushi.jpeg
Normal file
BIN
app/src/main/res/mipmap/keiyoushi.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/mipmap/komikku.png
Normal file
BIN
app/src/main/res/mipmap/komikku.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -40,13 +40,17 @@ fun EmptyScreen(
|
|||
stringRes: StringResource,
|
||||
modifier: Modifier = Modifier,
|
||||
actions: ImmutableList<EmptyScreenAction>? = null,
|
||||
// KMK -->
|
||||
help: @Composable (() -> Unit)? = null,
|
||||
// KMK <--
|
||||
) {
|
||||
EmptyScreen(
|
||||
message = stringResource(stringRes),
|
||||
modifier = modifier,
|
||||
actions = actions,
|
||||
// KMK -->
|
||||
help = help,
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +59,9 @@ fun EmptyScreen(
|
|||
message: String,
|
||||
modifier: Modifier = Modifier,
|
||||
actions: ImmutableList<EmptyScreenAction>? = null,
|
||||
// KMK -->
|
||||
help: @Composable (() -> Unit)? = null,
|
||||
// KMK <--
|
||||
) {
|
||||
val face = remember { getRandomErrorFace() }
|
||||
Column(
|
||||
|
|
@ -83,7 +89,9 @@ fun EmptyScreen(
|
|||
textAlign = TextAlign.Center,
|
||||
)
|
||||
|
||||
// KMK -->
|
||||
help?.let { help() }
|
||||
// KMK <--
|
||||
|
||||
if (!actions.isNullOrEmpty()) {
|
||||
Row(
|
||||
|
|
|
|||
Loading…
Reference in a new issue