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