mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-18 23:49:18 +01:00
parent
3407eb84c5
commit
b1ccebf329
@ -62,7 +62,7 @@ fun SourceIcon(
|
|||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.mipmap.ic_local_source),
|
painter = painterResource(R.mipmap.ic_local_source),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = modifier.then(defaultModifier),
|
modifier = modifier.then(defaultModifier),
|
||||||
)
|
)
|
||||||
|
@ -95,7 +95,7 @@ private fun NotDownloadedIndicator(
|
|||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = R.drawable.ic_download_chapter_24dp),
|
painter = painterResource(R.drawable.ic_download_chapter_24dp),
|
||||||
contentDescription = stringResource(R.string.manga_download),
|
contentDescription = stringResource(R.string.manga_download),
|
||||||
modifier = Modifier.size(IndicatorSize),
|
modifier = Modifier.size(IndicatorSize),
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package eu.kanade.presentation.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TrackLogoIcon(
|
||||||
|
service: TrackService,
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(48.dp)
|
||||||
|
.background(color = Color(service.getLogoColor()), shape = MaterialTheme.shapes.medium)
|
||||||
|
.padding(4.dp),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(service.getLogo()),
|
||||||
|
contentDescription = stringResource(service.nameRes()),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -72,7 +72,7 @@ fun CrashScreen(
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.pref_dump_crash_logs))
|
Text(text = stringResource(R.string.pref_dump_crash_logs))
|
||||||
}
|
}
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onClick = onRestartClick,
|
onClick = onRestartClick,
|
||||||
@ -102,7 +102,7 @@ fun CrashScreen(
|
|||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.crash_screen_description, stringResource(id = R.string.app_name)),
|
text = stringResource(R.string.crash_screen_description, stringResource(R.string.app_name)),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(vertical = MaterialTheme.padding.small),
|
.padding(vertical = MaterialTheme.padding.small),
|
||||||
)
|
)
|
||||||
|
@ -208,12 +208,12 @@ private fun SetAsDefaultDialog(
|
|||||||
var optionalChecked by rememberSaveable { mutableStateOf(false) }
|
var optionalChecked by rememberSaveable { mutableStateOf(false) }
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
title = { Text(text = stringResource(id = R.string.chapter_settings)) },
|
title = { Text(text = stringResource(R.string.chapter_settings)) },
|
||||||
text = {
|
text = {
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.confirm_set_chapter_settings))
|
Text(text = stringResource(R.string.confirm_set_chapter_settings))
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -227,13 +227,13 @@ private fun SetAsDefaultDialog(
|
|||||||
checked = optionalChecked,
|
checked = optionalChecked,
|
||||||
onCheckedChange = null,
|
onCheckedChange = null,
|
||||||
)
|
)
|
||||||
Text(text = stringResource(id = R.string.also_set_chapter_settings_for_library))
|
Text(text = stringResource(R.string.also_set_chapter_settings_for_library))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dismissButton = {
|
dismissButton = {
|
||||||
TextButton(onClick = onDismissRequest) {
|
TextButton(onClick = onDismissRequest) {
|
||||||
Text(text = stringResource(id = android.R.string.cancel))
|
Text(text = stringResource(android.R.string.cancel))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
@ -242,7 +242,7 @@ private fun SetAsDefaultDialog(
|
|||||||
onConfirmed(optionalChecked)
|
onConfirmed(optionalChecked)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = android.R.string.ok))
|
Text(text = stringResource(android.R.string.ok))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -257,7 +257,7 @@ private fun MoreMenu(
|
|||||||
IconButton(onClick = { expanded = true }) {
|
IconButton(onClick = { expanded = true }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.MoreVert,
|
imageVector = Icons.Default.MoreVert,
|
||||||
contentDescription = stringResource(id = R.string.label_more),
|
contentDescription = stringResource(R.string.label_more),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
@ -292,17 +292,17 @@ private fun FilterPage(
|
|||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
FilterPageItem(
|
FilterPageItem(
|
||||||
label = stringResource(id = R.string.action_filter_downloaded),
|
label = stringResource(R.string.action_filter_downloaded),
|
||||||
state = downloadFilter,
|
state = downloadFilter,
|
||||||
onClick = onDownloadFilterChanged,
|
onClick = onDownloadFilterChanged,
|
||||||
)
|
)
|
||||||
FilterPageItem(
|
FilterPageItem(
|
||||||
label = stringResource(id = R.string.action_filter_unread),
|
label = stringResource(R.string.action_filter_unread),
|
||||||
state = unreadFilter,
|
state = unreadFilter,
|
||||||
onClick = onUnreadFilterChanged,
|
onClick = onUnreadFilterChanged,
|
||||||
)
|
)
|
||||||
FilterPageItem(
|
FilterPageItem(
|
||||||
label = stringResource(id = R.string.action_filter_bookmarked),
|
label = stringResource(R.string.action_filter_bookmarked),
|
||||||
state = bookmarkedFilter,
|
state = bookmarkedFilter,
|
||||||
onClick = onBookmarkedFilterChanged,
|
onClick = onBookmarkedFilterChanged,
|
||||||
)
|
)
|
||||||
@ -372,17 +372,17 @@ private fun SortPage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SortPageItem(
|
SortPageItem(
|
||||||
label = stringResource(id = R.string.sort_by_source),
|
label = stringResource(R.string.sort_by_source),
|
||||||
statusIcon = arrowIcon.takeIf { sortingMode == Manga.CHAPTER_SORTING_SOURCE },
|
statusIcon = arrowIcon.takeIf { sortingMode == Manga.CHAPTER_SORTING_SOURCE },
|
||||||
onClick = { onItemSelected(Manga.CHAPTER_SORTING_SOURCE) },
|
onClick = { onItemSelected(Manga.CHAPTER_SORTING_SOURCE) },
|
||||||
)
|
)
|
||||||
SortPageItem(
|
SortPageItem(
|
||||||
label = stringResource(id = R.string.sort_by_number),
|
label = stringResource(R.string.sort_by_number),
|
||||||
statusIcon = arrowIcon.takeIf { sortingMode == Manga.CHAPTER_SORTING_NUMBER },
|
statusIcon = arrowIcon.takeIf { sortingMode == Manga.CHAPTER_SORTING_NUMBER },
|
||||||
onClick = { onItemSelected(Manga.CHAPTER_SORTING_NUMBER) },
|
onClick = { onItemSelected(Manga.CHAPTER_SORTING_NUMBER) },
|
||||||
)
|
)
|
||||||
SortPageItem(
|
SortPageItem(
|
||||||
label = stringResource(id = R.string.sort_by_upload_date),
|
label = stringResource(R.string.sort_by_upload_date),
|
||||||
statusIcon = arrowIcon.takeIf { sortingMode == Manga.CHAPTER_SORTING_UPLOAD_DATE },
|
statusIcon = arrowIcon.takeIf { sortingMode == Manga.CHAPTER_SORTING_UPLOAD_DATE },
|
||||||
onClick = { onItemSelected(Manga.CHAPTER_SORTING_UPLOAD_DATE) },
|
onClick = { onItemSelected(Manga.CHAPTER_SORTING_UPLOAD_DATE) },
|
||||||
)
|
)
|
||||||
@ -432,12 +432,12 @@ private fun DisplayPage(
|
|||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
DisplayPageItem(
|
DisplayPageItem(
|
||||||
label = stringResource(id = R.string.show_title),
|
label = stringResource(R.string.show_title),
|
||||||
selected = displayMode == Manga.CHAPTER_DISPLAY_NAME,
|
selected = displayMode == Manga.CHAPTER_DISPLAY_NAME,
|
||||||
onClick = { onItemSelected(Manga.CHAPTER_DISPLAY_NAME) },
|
onClick = { onItemSelected(Manga.CHAPTER_DISPLAY_NAME) },
|
||||||
)
|
)
|
||||||
DisplayPageItem(
|
DisplayPageItem(
|
||||||
label = stringResource(id = R.string.show_chapter_number),
|
label = stringResource(R.string.show_chapter_number),
|
||||||
selected = displayMode == Manga.CHAPTER_DISPLAY_NUMBER,
|
selected = displayMode == Manga.CHAPTER_DISPLAY_NUMBER,
|
||||||
onClick = { onItemSelected(Manga.CHAPTER_DISPLAY_NUMBER) },
|
onClick = { onItemSelected(Manga.CHAPTER_DISPLAY_NUMBER) },
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.presentation.manga
|
package eu.kanade.presentation.manga
|
||||||
|
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import androidx.annotation.DrawableRes
|
|
||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
@ -15,15 +12,12 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.foundation.layout.wrapContentSize
|
import androidx.compose.foundation.layout.wrapContentSize
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Delete
|
|
||||||
import androidx.compose.material.icons.filled.MoreVert
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
import androidx.compose.material.icons.filled.OpenInBrowser
|
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
@ -39,15 +33,15 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.alpha
|
import androidx.compose.ui.draw.alpha
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.presentation.components.Divider
|
import eu.kanade.presentation.components.Divider
|
||||||
import eu.kanade.presentation.components.DropdownMenu
|
import eu.kanade.presentation.components.DropdownMenu
|
||||||
|
import eu.kanade.presentation.components.TrackLogoIcon
|
||||||
import eu.kanade.presentation.components.VerticalDivider
|
import eu.kanade.presentation.components.VerticalDivider
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
import eu.kanade.tachiyomi.ui.manga.track.TrackItem
|
import eu.kanade.tachiyomi.ui.manga.track.TrackItem
|
||||||
import java.text.DateFormat
|
import java.text.DateFormat
|
||||||
|
|
||||||
@ -82,8 +76,7 @@ fun TrackInfoDialogHome(
|
|||||||
val supportsReadingDates = item.service.supportsReadingDates
|
val supportsReadingDates = item.service.supportsReadingDates
|
||||||
TrackInfoItem(
|
TrackInfoItem(
|
||||||
title = item.track.title,
|
title = item.track.title,
|
||||||
logoRes = item.service.getLogo(),
|
service = item.service,
|
||||||
logoColor = item.service.getLogoColor(),
|
|
||||||
status = item.service.getStatus(item.track.status),
|
status = item.service.getStatus(item.track.status),
|
||||||
onStatusClick = { onStatusClick(item) },
|
onStatusClick = { onStatusClick(item) },
|
||||||
chapters = "${item.track.last_chapter_read.toInt()}".let {
|
chapters = "${item.track.last_chapter_read.toInt()}".let {
|
||||||
@ -114,8 +107,7 @@ fun TrackInfoDialogHome(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
TrackInfoItemEmpty(
|
TrackInfoItemEmpty(
|
||||||
logoRes = item.service.getLogo(),
|
service = item.service,
|
||||||
logoColor = item.service.getLogoColor(),
|
|
||||||
onNewSearch = { onNewSearch(item) },
|
onNewSearch = { onNewSearch(item) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -126,8 +118,7 @@ fun TrackInfoDialogHome(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun TrackInfoItem(
|
private fun TrackInfoItem(
|
||||||
title: String,
|
title: String,
|
||||||
@DrawableRes logoRes: Int,
|
service: TrackService,
|
||||||
@ColorInt logoColor: Int,
|
|
||||||
status: String,
|
status: String,
|
||||||
onStatusClick: () -> Unit,
|
onStatusClick: () -> Unit,
|
||||||
chapters: String,
|
chapters: String,
|
||||||
@ -146,20 +137,7 @@ private fun TrackInfoItem(
|
|||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Box(
|
TrackLogoIcon(service)
|
||||||
modifier = Modifier
|
|
||||||
.clip(RoundedCornerShape(12.dp))
|
|
||||||
.clickable(onClick = onOpenInBrowser)
|
|
||||||
.size(48.dp)
|
|
||||||
.background(color = Color(logoColor))
|
|
||||||
.padding(4.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(id = logoRes),
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(48.dp)
|
.height(48.dp)
|
||||||
@ -185,7 +163,7 @@ private fun TrackInfoItem(
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(top = 12.dp)
|
.padding(top = 12.dp)
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.clip(MaterialTheme.shapes.medium)
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(MaterialTheme.colorScheme.surface)
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
.clip(RoundedCornerShape(6.dp)),
|
.clip(RoundedCornerShape(6.dp)),
|
||||||
@ -209,7 +187,7 @@ private fun TrackInfoItem(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.alpha(if (score == null) UnsetStatusTextAlpha else 1f),
|
.alpha(if (score == null) UnsetStatusTextAlpha else 1f),
|
||||||
text = score ?: stringResource(id = R.string.score),
|
text = score ?: stringResource(R.string.score),
|
||||||
onClick = onScoreClick,
|
onClick = onScoreClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -219,18 +197,16 @@ private fun TrackInfoItem(
|
|||||||
Divider()
|
Divider()
|
||||||
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
|
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
|
||||||
TrackDetailsItem(
|
TrackDetailsItem(
|
||||||
modifier = Modifier
|
modifier = Modifier.weight(1F),
|
||||||
.weight(1F)
|
text = startDate,
|
||||||
.alpha(if (startDate == null) UnsetStatusTextAlpha else 1f),
|
placeholder = stringResource(R.string.track_started_reading_date),
|
||||||
text = startDate ?: stringResource(id = R.string.track_started_reading_date),
|
|
||||||
onClick = onStartDateClick,
|
onClick = onStartDateClick,
|
||||||
)
|
)
|
||||||
VerticalDivider()
|
VerticalDivider()
|
||||||
TrackDetailsItem(
|
TrackDetailsItem(
|
||||||
modifier = Modifier
|
modifier = Modifier.weight(1F),
|
||||||
.weight(1F)
|
text = endDate,
|
||||||
.alpha(if (endDate == null) UnsetStatusTextAlpha else 1f),
|
placeholder = stringResource(R.string.track_finished_reading_date),
|
||||||
text = endDate ?: stringResource(id = R.string.track_finished_reading_date),
|
|
||||||
onClick = onEndDateClick,
|
onClick = onEndDateClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -243,17 +219,19 @@ private fun TrackInfoItem(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun TrackDetailsItem(
|
private fun TrackDetailsItem(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
text: String,
|
text: String?,
|
||||||
|
placeholder: String = "",
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
|
.alpha(if (text == null) UnsetStatusTextAlpha else 1f)
|
||||||
.padding(12.dp),
|
.padding(12.dp),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text ?: placeholder,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
)
|
)
|
||||||
@ -262,33 +240,20 @@ private fun TrackDetailsItem(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun TrackInfoItemEmpty(
|
private fun TrackInfoItemEmpty(
|
||||||
@DrawableRes logoRes: Int,
|
service: TrackService,
|
||||||
@ColorInt logoColor: Int,
|
|
||||||
onNewSearch: () -> Unit,
|
onNewSearch: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Box(
|
TrackLogoIcon(service)
|
||||||
modifier = Modifier
|
|
||||||
.clip(RoundedCornerShape(12.dp))
|
|
||||||
.size(48.dp)
|
|
||||||
.background(color = Color(logoColor))
|
|
||||||
.padding(4.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(id = logoRes),
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = onNewSearch,
|
onClick = onNewSearch,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(start = 16.dp)
|
.padding(start = 16.dp)
|
||||||
.weight(1f),
|
.weight(1f),
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.add_tracking))
|
Text(text = stringResource(R.string.add_tracking))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,7 +268,7 @@ private fun TrackInfoItemMenu(
|
|||||||
IconButton(onClick = { expanded = true }) {
|
IconButton(onClick = { expanded = true }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.MoreVert,
|
imageVector = Icons.Default.MoreVert,
|
||||||
contentDescription = stringResource(id = R.string.label_more),
|
contentDescription = stringResource(R.string.label_more),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
@ -312,9 +277,6 @@ private fun TrackInfoItemMenu(
|
|||||||
) {
|
) {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.action_open_in_browser)) },
|
text = { Text(stringResource(R.string.action_open_in_browser)) },
|
||||||
leadingIcon = {
|
|
||||||
Icon(imageVector = Icons.Default.OpenInBrowser, contentDescription = null)
|
|
||||||
},
|
|
||||||
onClick = {
|
onClick = {
|
||||||
onOpenInBrowser()
|
onOpenInBrowser()
|
||||||
expanded = false
|
expanded = false
|
||||||
@ -322,9 +284,6 @@ private fun TrackInfoItemMenu(
|
|||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.action_remove)) },
|
text = { Text(stringResource(R.string.action_remove)) },
|
||||||
leadingIcon = {
|
|
||||||
Icon(imageVector = Icons.Default.Delete, contentDescription = null)
|
|
||||||
},
|
|
||||||
onClick = {
|
onClick = {
|
||||||
onRemoved()
|
onRemoved()
|
||||||
expanded = false
|
expanded = false
|
||||||
|
@ -50,7 +50,7 @@ fun TrackStatusSelector(
|
|||||||
) {
|
) {
|
||||||
BaseSelector(
|
BaseSelector(
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
title = stringResource(id = R.string.status),
|
title = stringResource(R.string.status),
|
||||||
content = {
|
content = {
|
||||||
val state = rememberLazyListState()
|
val state = rememberLazyListState()
|
||||||
ScrollbarLazyColumn(state = state) {
|
ScrollbarLazyColumn(state = state) {
|
||||||
@ -100,7 +100,7 @@ fun TrackChapterSelector(
|
|||||||
) {
|
) {
|
||||||
BaseSelector(
|
BaseSelector(
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
title = stringResource(id = R.string.chapters),
|
title = stringResource(R.string.chapters),
|
||||||
content = {
|
content = {
|
||||||
WheelTextPicker(
|
WheelTextPicker(
|
||||||
modifier = Modifier.align(Alignment.Center),
|
modifier = Modifier.align(Alignment.Center),
|
||||||
@ -128,7 +128,7 @@ fun TrackScoreSelector(
|
|||||||
) {
|
) {
|
||||||
BaseSelector(
|
BaseSelector(
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
title = stringResource(id = R.string.score),
|
title = stringResource(R.string.score),
|
||||||
content = {
|
content = {
|
||||||
WheelTextPicker(
|
WheelTextPicker(
|
||||||
modifier = Modifier.align(Alignment.Center),
|
modifier = Modifier.align(Alignment.Center),
|
||||||
@ -185,7 +185,7 @@ fun TrackDateSelector(
|
|||||||
thirdButton = if (onRemove != null) {
|
thirdButton = if (onRemove != null) {
|
||||||
{
|
{
|
||||||
TextButton(onClick = onRemove) {
|
TextButton(onClick = onRemove) {
|
||||||
Text(text = stringResource(id = R.string.action_remove))
|
Text(text = stringResource(R.string.action_remove))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -224,10 +224,10 @@ private fun BaseSelector(
|
|||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
TextButton(onClick = onDismissRequest) {
|
TextButton(onClick = onDismissRequest) {
|
||||||
Text(text = stringResource(id = android.R.string.cancel))
|
Text(text = stringResource(android.R.string.cancel))
|
||||||
}
|
}
|
||||||
TextButton(onClick = onConfirm) {
|
TextButton(onClick = onConfirm) {
|
||||||
Text(text = stringResource(id = android.R.string.ok))
|
Text(text = stringResource(android.R.string.ok))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -165,7 +165,7 @@ fun TrackServiceSearch(
|
|||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
elevation = ButtonDefaults.elevatedButtonElevation(),
|
elevation = ButtonDefaults.elevatedButtonElevation(),
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.action_track))
|
Text(text = stringResource(R.string.action_track))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -206,7 +206,7 @@ fun TrackServiceSearch(
|
|||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
modifier = Modifier.padding(innerPadding),
|
modifier = Modifier.padding(innerPadding),
|
||||||
message = queryResult.exceptionOrNull()?.message
|
message = queryResult.exceptionOrNull()?.message
|
||||||
?: stringResource(id = R.string.unknown_error),
|
?: stringResource(R.string.unknown_error),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,19 +264,19 @@ private fun SearchResultItem(
|
|||||||
)
|
)
|
||||||
if (type.isNotBlank()) {
|
if (type.isNotBlank()) {
|
||||||
SearchResultItemDetails(
|
SearchResultItemDetails(
|
||||||
title = stringResource(id = R.string.track_type),
|
title = stringResource(R.string.track_type),
|
||||||
text = type,
|
text = type,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (startDate.isNotBlank()) {
|
if (startDate.isNotBlank()) {
|
||||||
SearchResultItemDetails(
|
SearchResultItemDetails(
|
||||||
title = stringResource(id = R.string.track_start_date),
|
title = stringResource(R.string.track_start_date),
|
||||||
text = startDate,
|
text = startDate,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (status.isNotBlank()) {
|
if (status.isNotBlank()) {
|
||||||
SearchResultItemDetails(
|
SearchResultItemDetails(
|
||||||
title = stringResource(id = R.string.track_status),
|
title = stringResource(R.string.track_status),
|
||||||
text = status,
|
text = status,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -156,9 +156,7 @@ internal fun PreferenceItem(
|
|||||||
.collectAsState()
|
.collectAsState()
|
||||||
item.service.run {
|
item.service.run {
|
||||||
TrackingPreferenceWidget(
|
TrackingPreferenceWidget(
|
||||||
title = item.title,
|
service = this,
|
||||||
logoRes = getLogo(),
|
|
||||||
logoColor = getLogoColor(),
|
|
||||||
checked = uName.isNotEmpty(),
|
checked = uName.isNotEmpty(),
|
||||||
onClick = { if (isLogged) item.logout() else item.login() },
|
onClick = { if (isLogged) item.logout() else item.login() },
|
||||||
)
|
)
|
||||||
|
@ -96,7 +96,7 @@ sealed class Preference {
|
|||||||
v.map { e[it] }
|
v.map { e[it] }
|
||||||
.takeIf { it.isNotEmpty() }
|
.takeIf { it.isNotEmpty() }
|
||||||
?.joinToString()
|
?.joinToString()
|
||||||
} ?: stringResource(id = R.string.none)
|
} ?: stringResource(R.string.none)
|
||||||
subtitle?.format(combined)
|
subtitle?.format(combined)
|
||||||
},
|
},
|
||||||
override val icon: ImageVector? = null,
|
override val icon: ImageVector? = null,
|
||||||
|
@ -23,7 +23,7 @@ fun PreferenceScaffold(
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text(text = stringResource(id = titleRes)) },
|
title = { Text(text = stringResource(titleRes)) },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
if (onBackPressed != null) {
|
if (onBackPressed != null) {
|
||||||
IconButton(onClick = onBackPressed) {
|
IconButton(onClick = onBackPressed) {
|
||||||
|
@ -52,7 +52,7 @@ internal fun InfoWidget(text: String) {
|
|||||||
private fun InfoWidgetPreview() {
|
private fun InfoWidgetPreview() {
|
||||||
TachiyomiTheme {
|
TachiyomiTheme {
|
||||||
Surface {
|
Surface {
|
||||||
InfoWidget(text = stringResource(id = R.string.download_ahead_info))
|
InfoWidget(text = stringResource(R.string.download_ahead_info))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package eu.kanade.presentation.more.settings.widget
|
package eu.kanade.presentation.more.settings.widget
|
||||||
|
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import androidx.annotation.DrawableRes
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@ -19,18 +15,17 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import eu.kanade.presentation.components.TrackLogoIcon
|
||||||
import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
|
import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TrackingPreferenceWidget(
|
fun TrackingPreferenceWidget(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
title: String,
|
service: TrackService,
|
||||||
@DrawableRes logoRes: Int,
|
|
||||||
@ColorInt logoColor: Int,
|
|
||||||
checked: Boolean,
|
checked: Boolean,
|
||||||
onClick: (() -> Unit)? = null,
|
onClick: (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
@ -43,20 +38,9 @@ fun TrackingPreferenceWidget(
|
|||||||
.padding(horizontal = PrefsHorizontalPadding, vertical = 8.dp),
|
.padding(horizontal = PrefsHorizontalPadding, vertical = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Box(
|
TrackLogoIcon(service)
|
||||||
modifier = Modifier
|
|
||||||
.size(48.dp)
|
|
||||||
.background(color = Color(logoColor), shape = MaterialTheme.shapes.small)
|
|
||||||
.padding(4.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(id = logoRes),
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = stringResource(service.nameRes()),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
|
@ -427,9 +427,9 @@ private data class TrackDateSelectorScreen(
|
|||||||
TrackDateSelector(
|
TrackDateSelector(
|
||||||
contentPadding = LocalNavigatorContentPadding.current,
|
contentPadding = LocalNavigatorContentPadding.current,
|
||||||
title = if (start) {
|
title = if (start) {
|
||||||
stringResource(id = R.string.track_started_reading_date)
|
stringResource(R.string.track_started_reading_date)
|
||||||
} else {
|
} else {
|
||||||
stringResource(id = R.string.track_finished_reading_date)
|
stringResource(R.string.track_finished_reading_date)
|
||||||
},
|
},
|
||||||
selection = state.selection,
|
selection = state.selection,
|
||||||
onSelectionChange = sm::setSelection,
|
onSelectionChange = sm::setSelection,
|
||||||
@ -509,7 +509,7 @@ private data class TrackDateRemoverScreen(
|
|||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.track_remove_date_conf_title),
|
text = stringResource(R.string.track_remove_date_conf_title),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -517,9 +517,9 @@ private data class TrackDateRemoverScreen(
|
|||||||
val serviceName = stringResource(sm.getServiceNameRes())
|
val serviceName = stringResource(sm.getServiceNameRes())
|
||||||
Text(
|
Text(
|
||||||
text = if (start) {
|
text = if (start) {
|
||||||
stringResource(id = R.string.track_remove_start_date_conf_text, serviceName)
|
stringResource(R.string.track_remove_start_date_conf_text, serviceName)
|
||||||
} else {
|
} else {
|
||||||
stringResource(id = R.string.track_remove_finish_date_conf_text, serviceName)
|
stringResource(R.string.track_remove_finish_date_conf_text, serviceName)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -529,7 +529,7 @@ private data class TrackDateRemoverScreen(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End),
|
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End),
|
||||||
) {
|
) {
|
||||||
TextButton(onClick = navigator::pop) {
|
TextButton(onClick = navigator::pop) {
|
||||||
Text(text = stringResource(id = android.R.string.cancel))
|
Text(text = stringResource(android.R.string.cancel))
|
||||||
}
|
}
|
||||||
FilledTonalButton(
|
FilledTonalButton(
|
||||||
onClick = { sm.removeDate(); navigator.popUntilRoot() },
|
onClick = { sm.removeDate(); navigator.popUntilRoot() },
|
||||||
@ -538,7 +538,7 @@ private data class TrackDateRemoverScreen(
|
|||||||
contentColor = MaterialTheme.colorScheme.onErrorContainer,
|
contentColor = MaterialTheme.colorScheme.onErrorContainer,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.action_remove))
|
Text(text = stringResource(R.string.action_remove))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user