mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
Update linter
This commit is contained in:
parent
8bee5accb7
commit
ae7df4fb7f
49 changed files with 119 additions and 117 deletions
|
@ -19,7 +19,7 @@ class AndroidDatabaseHandler(
|
|||
val db: Database,
|
||||
private val driver: SqlDriver,
|
||||
val queryDispatcher: CoroutineDispatcher = Dispatchers.IO,
|
||||
val transactionDispatcher: CoroutineDispatcher = queryDispatcher
|
||||
val transactionDispatcher: CoroutineDispatcher = queryDispatcher,
|
||||
) : DatabaseHandler {
|
||||
|
||||
val suspendingTransactionId = ThreadLocal<Int>()
|
||||
|
@ -30,21 +30,21 @@ class AndroidDatabaseHandler(
|
|||
|
||||
override suspend fun <T : Any> awaitList(
|
||||
inTransaction: Boolean,
|
||||
block: suspend Database.() -> Query<T>
|
||||
block: suspend Database.() -> Query<T>,
|
||||
): List<T> {
|
||||
return dispatch(inTransaction) { block(db).executeAsList() }
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> awaitOne(
|
||||
inTransaction: Boolean,
|
||||
block: suspend Database.() -> Query<T>
|
||||
block: suspend Database.() -> Query<T>,
|
||||
): T {
|
||||
return dispatch(inTransaction) { block(db).executeAsOne() }
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> awaitOneOrNull(
|
||||
inTransaction: Boolean,
|
||||
block: suspend Database.() -> Query<T>
|
||||
block: suspend Database.() -> Query<T>,
|
||||
): T? {
|
||||
return dispatch(inTransaction) { block(db).executeAsOneOrNull() }
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class AndroidDatabaseHandler(
|
|||
override fun <T : Any> subscribeToPagingSource(
|
||||
countQuery: Database.() -> Query<Long>,
|
||||
transacter: Database.() -> Transacter,
|
||||
queryProvider: Database.(Long, Long) -> Query<T>
|
||||
queryProvider: Database.(Long, Long) -> Query<T>,
|
||||
): PagingSource<Long, T> {
|
||||
return QueryPagingSource(
|
||||
countQuery = countQuery(db),
|
||||
|
@ -72,7 +72,7 @@ class AndroidDatabaseHandler(
|
|||
dispatcher = queryDispatcher,
|
||||
queryProvider = { limit, offset ->
|
||||
queryProvider.invoke(db, limit, offset)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,17 +12,17 @@ interface DatabaseHandler {
|
|||
|
||||
suspend fun <T : Any> awaitList(
|
||||
inTransaction: Boolean = false,
|
||||
block: suspend Database.() -> Query<T>
|
||||
block: suspend Database.() -> Query<T>,
|
||||
): List<T>
|
||||
|
||||
suspend fun <T : Any> awaitOne(
|
||||
inTransaction: Boolean = false,
|
||||
block: suspend Database.() -> Query<T>
|
||||
block: suspend Database.() -> Query<T>,
|
||||
): T
|
||||
|
||||
suspend fun <T : Any> awaitOneOrNull(
|
||||
inTransaction: Boolean = false,
|
||||
block: suspend Database.() -> Query<T>
|
||||
block: suspend Database.() -> Query<T>,
|
||||
): T?
|
||||
|
||||
fun <T : Any> subscribeToList(block: Database.() -> Query<T>): Flow<List<T>>
|
||||
|
@ -34,6 +34,6 @@ interface DatabaseHandler {
|
|||
fun <T : Any> subscribeToPagingSource(
|
||||
countQuery: Database.() -> Query<Long>,
|
||||
transacter: Database.() -> Transacter,
|
||||
queryProvider: Database.(Long, Long) -> Query<T>
|
||||
queryProvider: Database.(Long, Long) -> Query<T>,
|
||||
): PagingSource<Long, T>
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ private suspend fun AndroidDatabaseHandler.createTransactionContext(): Coroutine
|
|||
* thread by cancelling the job.
|
||||
*/
|
||||
private suspend fun CoroutineDispatcher.acquireTransactionThread(
|
||||
controlJob: Job
|
||||
controlJob: Job,
|
||||
): ContinuationInterceptor {
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
continuation.invokeOnCancellation {
|
||||
|
@ -116,8 +116,8 @@ private suspend fun CoroutineDispatcher.acquireTransactionThread(
|
|||
// Couldn't acquire a thread, cancel coroutine.
|
||||
continuation.cancel(
|
||||
IllegalStateException(
|
||||
"Unable to acquire a thread to perform the database transaction.", ex
|
||||
)
|
||||
"Unable to acquire a thread to perform the database transaction.", ex,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ private suspend fun CoroutineDispatcher.acquireTransactionThread(
|
|||
*/
|
||||
private class TransactionElement(
|
||||
private val transactionThreadControlJob: Job,
|
||||
val transactionDispatcher: ContinuationInterceptor
|
||||
val transactionDispatcher: ContinuationInterceptor,
|
||||
) : CoroutineContext.Element {
|
||||
|
||||
companion object Key : CoroutineContext.Key<TransactionElement>
|
||||
|
|
|
@ -13,7 +13,7 @@ val historyMapper: (Long, Long, Date?, Date?) -> History = { id, chapterId, read
|
|||
}
|
||||
|
||||
val historyWithRelationsMapper: (Long, Long, Long, String, String?, Float, Date?) -> HistoryWithRelations = {
|
||||
historyId, mangaId, chapterId, title, thumbnailUrl, chapterNumber, readAt ->
|
||||
historyId, mangaId, chapterId, title, thumbnailUrl, chapterNumber, readAt ->
|
||||
HistoryWithRelations(
|
||||
id = historyId,
|
||||
chapterId = chapterId,
|
||||
|
@ -21,6 +21,6 @@ val historyWithRelationsMapper: (Long, Long, Long, String, String?, Float, Date?
|
|||
title = title,
|
||||
thumbnailUrl = thumbnailUrl ?: "",
|
||||
chapterNumber = chapterNumber,
|
||||
readAt = readAt
|
||||
readAt = readAt,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import eu.kanade.domain.manga.model.Manga
|
|||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
|
||||
class HistoryRepositoryImpl(
|
||||
private val handler: DatabaseHandler
|
||||
private val handler: DatabaseHandler,
|
||||
) : HistoryRepository {
|
||||
|
||||
override fun getHistory(query: String): PagingSource<Long, HistoryWithRelations> {
|
||||
|
@ -20,7 +20,7 @@ class HistoryRepositoryImpl(
|
|||
transacter = { historyViewQueries },
|
||||
queryProvider = { limit, offset ->
|
||||
historyViewQueries.history(query, limit, offset, historyWithRelationsMapper)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import eu.kanade.domain.manga.repository.MangaRepository
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class MangaRepositoryImpl(
|
||||
private val databaseHandler: DatabaseHandler
|
||||
private val databaseHandler: DatabaseHandler,
|
||||
) : MangaRepository {
|
||||
|
||||
override fun getFavoritesBySourceId(sourceId: Long): Flow<List<Manga>> {
|
||||
|
|
|
@ -8,7 +8,7 @@ val sourceMapper: (eu.kanade.tachiyomi.source.Source) -> Source = { source ->
|
|||
source.id,
|
||||
source.lang,
|
||||
source.name,
|
||||
false
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.map
|
|||
|
||||
class SourceRepositoryImpl(
|
||||
private val sourceManager: SourceManager,
|
||||
private val handler: DatabaseHandler
|
||||
private val handler: DatabaseHandler,
|
||||
) : SourceRepository {
|
||||
|
||||
override fun getSources(): Flow<List<Source>> {
|
||||
|
|
|
@ -12,5 +12,5 @@ data class Chapter(
|
|||
val name: String,
|
||||
val dateUpload: Long,
|
||||
val chapterNumber: Float,
|
||||
val scanlator: String?
|
||||
val scanlator: String?,
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.kanade.domain.history.interactor
|
|||
import eu.kanade.domain.history.repository.HistoryRepository
|
||||
|
||||
class DeleteHistoryTable(
|
||||
private val repository: HistoryRepository
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(): Boolean {
|
||||
|
|
|
@ -8,12 +8,12 @@ import eu.kanade.domain.history.repository.HistoryRepository
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetHistory(
|
||||
private val repository: HistoryRepository
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
|
||||
fun subscribe(query: String): Flow<PagingData<HistoryWithRelations>> {
|
||||
return Pager(
|
||||
PagingConfig(pageSize = 25)
|
||||
PagingConfig(pageSize = 25),
|
||||
) {
|
||||
repository.getHistory(query)
|
||||
}.flow
|
||||
|
|
|
@ -4,7 +4,7 @@ import eu.kanade.domain.chapter.model.Chapter
|
|||
import eu.kanade.domain.history.repository.HistoryRepository
|
||||
|
||||
class GetNextChapterForManga(
|
||||
private val repository: HistoryRepository
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, chapterId: Long): Chapter? {
|
||||
|
|
|
@ -4,7 +4,7 @@ import eu.kanade.domain.history.model.HistoryWithRelations
|
|||
import eu.kanade.domain.history.repository.HistoryRepository
|
||||
|
||||
class RemoveHistoryById(
|
||||
private val repository: HistoryRepository
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(history: HistoryWithRelations) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.kanade.domain.history.interactor
|
|||
import eu.kanade.domain.history.repository.HistoryRepository
|
||||
|
||||
class RemoveHistoryByMangaId(
|
||||
private val repository: HistoryRepository
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long) {
|
||||
|
|
|
@ -5,5 +5,5 @@ import java.util.Date
|
|||
data class History(
|
||||
val id: Long?,
|
||||
val chapterId: Long,
|
||||
val readAt: Date?
|
||||
val readAt: Date?,
|
||||
)
|
||||
|
|
|
@ -9,5 +9,5 @@ data class HistoryWithRelations(
|
|||
val title: String,
|
||||
val thumbnailUrl: String,
|
||||
val chapterNumber: Float,
|
||||
val readAt: Date?
|
||||
val readAt: Date?,
|
||||
)
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.kanade.domain.manga.repository.MangaRepository
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetFavoritesBySourceId(
|
||||
private val mangaRepository: MangaRepository
|
||||
private val mangaRepository: MangaRepository,
|
||||
) {
|
||||
|
||||
fun subscribe(sourceId: Long): Flow<List<Manga>> {
|
||||
|
|
|
@ -17,7 +17,7 @@ data class Manga(
|
|||
val genre: List<String>?,
|
||||
val status: Long,
|
||||
val thumbnailUrl: String?,
|
||||
val initialized: Boolean
|
||||
val initialized: Boolean,
|
||||
) {
|
||||
|
||||
val sorting: Long
|
||||
|
|
|
@ -16,19 +16,19 @@ class GetLanguagesWithSources(
|
|||
return combine(
|
||||
preferences.enabledLanguages().asFlow(),
|
||||
preferences.disabledSources().asFlow(),
|
||||
repository.getOnlineSources()
|
||||
repository.getOnlineSources(),
|
||||
) { enabledLanguage, disabledSource, onlineSources ->
|
||||
val sortedSources = onlineSources.sortedWith(
|
||||
compareBy<Source> { it.id.toString() in disabledSource }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
|
||||
)
|
||||
|
||||
sortedSources.groupBy { it.lang }
|
||||
.toSortedMap(
|
||||
compareBy(
|
||||
{ it !in enabledLanguage },
|
||||
{ LocaleHelper.getDisplayName(it) }
|
||||
)
|
||||
{ LocaleHelper.getDisplayName(it) },
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,14 @@ import java.util.Locale
|
|||
|
||||
class GetSourcesWithFavoriteCount(
|
||||
private val repository: SourceRepository,
|
||||
private val preferences: PreferencesHelper
|
||||
private val preferences: PreferencesHelper,
|
||||
) {
|
||||
|
||||
fun subscribe(): Flow<List<Pair<Source, Long>>> {
|
||||
return combine(
|
||||
preferences.migrationSortingDirection().asFlow(),
|
||||
preferences.migrationSortingMode().asFlow(),
|
||||
repository.getSourcesWithFavoriteCount()
|
||||
repository.getSourcesWithFavoriteCount(),
|
||||
) { direction, mode, list ->
|
||||
list.sortedWith(sortFn(direction, mode))
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class GetSourcesWithFavoriteCount(
|
|||
|
||||
private fun sortFn(
|
||||
direction: SetMigrateSorting.Direction,
|
||||
sorting: SetMigrateSorting.Mode
|
||||
sorting: SetMigrateSorting.Mode,
|
||||
): java.util.Comparator<Pair<Source, Long>> {
|
||||
val locale = Locale.getDefault()
|
||||
val collator = Collator.getInstance(locale).apply {
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.kanade.domain.source.interactor
|
|||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
|
||||
class SetMigrateSorting(
|
||||
private val preferences: PreferencesHelper
|
||||
private val preferences: PreferencesHelper,
|
||||
) {
|
||||
|
||||
fun await(mode: Mode, isAscending: Boolean) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
|
|||
import eu.kanade.tachiyomi.util.preference.plusAssign
|
||||
|
||||
class ToggleLanguage(
|
||||
val preferences: PreferencesHelper
|
||||
val preferences: PreferencesHelper,
|
||||
) {
|
||||
|
||||
fun await(language: String) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
|
|||
import eu.kanade.tachiyomi.util.preference.plusAssign
|
||||
|
||||
class ToggleSource(
|
||||
private val preferences: PreferencesHelper
|
||||
private val preferences: PreferencesHelper,
|
||||
) {
|
||||
|
||||
fun await(source: Source) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
|
|||
import eu.kanade.tachiyomi.util.preference.plusAssign
|
||||
|
||||
class ToggleSourcePin(
|
||||
private val preferences: PreferencesHelper
|
||||
private val preferences: PreferencesHelper,
|
||||
) {
|
||||
|
||||
fun await(source: Source) {
|
||||
|
|
|
@ -13,7 +13,7 @@ data class Source(
|
|||
val name: String,
|
||||
val supportsLatest: Boolean,
|
||||
val pin: Pins = Pins.unpinned,
|
||||
val isUsedLast: Boolean = false
|
||||
val isUsedLast: Boolean = false,
|
||||
) {
|
||||
|
||||
val nameWithLanguage: String
|
||||
|
|
|
@ -29,7 +29,7 @@ fun EmptyScreen(
|
|||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.fillMaxSize(),
|
||||
) {
|
||||
AndroidView(
|
||||
factory = { context ->
|
||||
|
|
|
@ -23,7 +23,7 @@ enum class MangaCover(private val ratio: Float) {
|
|||
modifier: Modifier = Modifier,
|
||||
data: String?,
|
||||
contentDescription: String? = null,
|
||||
shape: Shape? = null
|
||||
shape: Shape? = null,
|
||||
) {
|
||||
AsyncImage(
|
||||
model = data,
|
||||
|
|
|
@ -56,7 +56,7 @@ fun PreferenceRow(
|
|||
onLongClick = onLongClick,
|
||||
onClick = onClick,
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
if (painter != null) {
|
||||
Icon(
|
||||
|
@ -71,7 +71,7 @@ fun PreferenceRow(
|
|||
Column(
|
||||
Modifier
|
||||
.padding(horizontal = horizontalPadding)
|
||||
.weight(1f)
|
||||
.weight(1f),
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
|
|
|
@ -88,7 +88,7 @@ fun HistoryContent(
|
|||
onClickResume: (HistoryWithRelations) -> Unit,
|
||||
onClickDelete: (HistoryWithRelations, Boolean) -> Unit,
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
nestedScroll: NestedScrollConnection
|
||||
nestedScroll: NestedScrollConnection,
|
||||
) {
|
||||
if (history.loadState.refresh is LoadState.Loading) {
|
||||
LoadingScreen()
|
||||
|
@ -118,7 +118,7 @@ fun HistoryContent(
|
|||
.animateItemPlacement(),
|
||||
date = item.date,
|
||||
relativeTime = relativeTime,
|
||||
dateFormat = dateFormat
|
||||
dateFormat = dateFormat,
|
||||
)
|
||||
}
|
||||
is HistoryUiModel.Item -> {
|
||||
|
@ -142,7 +142,7 @@ fun HistoryContent(
|
|||
onClickDelete(removeState, all)
|
||||
setRemoveState(null)
|
||||
},
|
||||
onNegative = { setRemoveState(null) }
|
||||
onNegative = { setRemoveState(null) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -160,12 +160,12 @@ fun HistoryHeader(
|
|||
text = date.toRelativeString(
|
||||
LocalContext.current,
|
||||
relativeTime,
|
||||
dateFormat
|
||||
dateFormat,
|
||||
),
|
||||
style = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ fun HistoryItem(
|
|||
text = history.title,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = textStyle.copy(fontWeight = FontWeight.SemiBold)
|
||||
style = textStyle.copy(fontWeight = FontWeight.SemiBold),
|
||||
)
|
||||
Row {
|
||||
Text(
|
||||
|
@ -232,7 +232,7 @@ fun HistoryItem(
|
|||
@Composable
|
||||
fun RemoveHistoryDialog(
|
||||
onPositive: (Boolean) -> Unit,
|
||||
onNegative: () -> Unit
|
||||
onNegative: () -> Unit,
|
||||
) {
|
||||
val (removeEverything, removeEverythingState) = remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -250,9 +250,9 @@ fun RemoveHistoryDialog(
|
|||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = null,
|
||||
value = removeEverything,
|
||||
onValueChange = removeEverythingState
|
||||
onValueChange = removeEverythingState,
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Checkbox(
|
||||
checked = removeEverything,
|
||||
|
@ -260,7 +260,7 @@ fun RemoveHistoryDialog(
|
|||
)
|
||||
Text(
|
||||
modifier = Modifier.padding(start = 4.dp),
|
||||
text = stringResource(id = R.string.dialog_with_checkbox_reset)
|
||||
text = stringResource(id = R.string.dialog_with_checkbox_reset),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ fun BaseMangaListItem(
|
|||
.clickable(onClick = onClickItem)
|
||||
.height(56.dp)
|
||||
.padding(horizontal = horizontalPadding),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
cover()
|
||||
content()
|
||||
|
@ -47,7 +47,7 @@ private val defaultCover: @Composable RowScope.(Manga, () -> Unit) -> Unit = { m
|
|||
.padding(vertical = 8.dp)
|
||||
.clickable(onClick = onClick)
|
||||
.fillMaxHeight(),
|
||||
data = manga.thumbnailUrl
|
||||
data = manga.thumbnailUrl,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ private val defaultContent: @Composable RowScope.(Manga) -> Unit = {
|
|||
.padding(start = horizontalPadding),
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.R
|
|||
fun LogoHeader() {
|
||||
Column {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_tachi),
|
||||
|
|
|
@ -25,7 +25,7 @@ fun MigrateMangaScreen(
|
|||
nestedScrollInterop: NestedScrollConnection,
|
||||
presenter: MigrationMangaPresenter,
|
||||
onClickItem: (Manga) -> Unit,
|
||||
onClickCover: (Manga) -> Unit
|
||||
onClickCover: (Manga) -> Unit,
|
||||
) {
|
||||
val state by presenter.state.collectAsState()
|
||||
|
||||
|
@ -48,7 +48,7 @@ fun MigrateMangaContent(
|
|||
nestedScrollInterop: NestedScrollConnection,
|
||||
list: List<Manga>,
|
||||
onClickItem: (Manga) -> Unit,
|
||||
onClickCover: (Manga) -> Unit
|
||||
onClickCover: (Manga) -> Unit,
|
||||
) {
|
||||
if (list.isEmpty()) {
|
||||
EmptyScreen(textResource = R.string.migrate_empty_screen)
|
||||
|
@ -62,7 +62,7 @@ fun MigrateMangaContent(
|
|||
MigrateMangaItem(
|
||||
manga = manga,
|
||||
onClickItem = onClickItem,
|
||||
onClickCover = onClickCover
|
||||
onClickCover = onClickCover,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -73,12 +73,12 @@ fun MigrateMangaItem(
|
|||
modifier: Modifier = Modifier,
|
||||
manga: Manga,
|
||||
onClickItem: (Manga) -> Unit,
|
||||
onClickCover: (Manga) -> Unit
|
||||
onClickCover: (Manga) -> Unit,
|
||||
) {
|
||||
BaseMangaListItem(
|
||||
modifier = modifier,
|
||||
manga = manga,
|
||||
onClickItem = { onClickItem(manga) },
|
||||
onClickCover = { onClickCover(manga) }
|
||||
onClickCover = { onClickCover(manga) },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ fun MigrateSourceList(
|
|||
modifier = Modifier
|
||||
.animateItemPlacement()
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.header
|
||||
style = MaterialTheme.typography.header,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -78,14 +78,14 @@ fun MigrateSourceList(
|
|||
items = list,
|
||||
key = { (source, _) ->
|
||||
source.id
|
||||
}
|
||||
},
|
||||
) { (source, count) ->
|
||||
MigrateSourceItem(
|
||||
modifier = Modifier.animateItemPlacement(),
|
||||
source = source,
|
||||
count = count,
|
||||
onClickItem = { onClickItem(source) },
|
||||
onLongClickItem = { onLongClickItem(source) }
|
||||
onLongClickItem = { onLongClickItem(source) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ fun SourceFilterScreen(
|
|||
nestedScrollInterop: NestedScrollConnection,
|
||||
presenter: SourceFilterPresenter,
|
||||
onClickLang: (String) -> Unit,
|
||||
onClickSource: (Source) -> Unit
|
||||
onClickSource: (Source) -> Unit,
|
||||
) {
|
||||
val state by presenter.state.collectAsState()
|
||||
|
||||
|
@ -53,7 +53,7 @@ fun SourceFilterContent(
|
|||
nestedScrollInterop: NestedScrollConnection,
|
||||
items: List<FilterUiModel>,
|
||||
onClickLang: (String) -> Unit,
|
||||
onClickSource: (Source) -> Unit
|
||||
onClickSource: (Source) -> Unit,
|
||||
) {
|
||||
if (items.isEmpty()) {
|
||||
EmptyScreen(textResource = R.string.source_filter_empty_screen)
|
||||
|
@ -76,7 +76,7 @@ fun SourceFilterContent(
|
|||
is FilterUiModel.Header -> it.hashCode()
|
||||
is FilterUiModel.Item -> it.source.key()
|
||||
}
|
||||
}
|
||||
},
|
||||
) { model ->
|
||||
when (model) {
|
||||
is FilterUiModel.Header -> {
|
||||
|
@ -84,14 +84,14 @@ fun SourceFilterContent(
|
|||
modifier = Modifier.animateItemPlacement(),
|
||||
language = model.language,
|
||||
isEnabled = model.isEnabled,
|
||||
onClickItem = onClickLang
|
||||
onClickItem = onClickLang,
|
||||
)
|
||||
}
|
||||
is FilterUiModel.Item -> SourceFilterItem(
|
||||
modifier = Modifier.animateItemPlacement(),
|
||||
source = model.source,
|
||||
isEnabled = model.isEnabled,
|
||||
onClickItem = onClickSource
|
||||
onClickItem = onClickSource,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ fun SourceFilterHeader(
|
|||
modifier: Modifier,
|
||||
language: String,
|
||||
isEnabled: Boolean,
|
||||
onClickItem: (String) -> Unit
|
||||
onClickItem: (String) -> Unit,
|
||||
) {
|
||||
PreferenceRow(
|
||||
modifier = modifier,
|
||||
|
@ -120,7 +120,7 @@ fun SourceFilterItem(
|
|||
modifier: Modifier,
|
||||
source: Source,
|
||||
isEnabled: Boolean,
|
||||
onClickItem: (Source) -> Unit
|
||||
onClickItem: (Source) -> Unit,
|
||||
) {
|
||||
BaseSourceItem(
|
||||
modifier = modifier,
|
||||
|
@ -129,6 +129,6 @@ fun SourceFilterItem(
|
|||
onClickItem = { onClickItem(source) },
|
||||
action = {
|
||||
Checkbox(checked = isEnabled, onCheckedChange = null)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -105,13 +105,13 @@ fun SourceList(
|
|||
is SourceUiModel.Header -> it.hashCode()
|
||||
is SourceUiModel.Item -> it.source.key()
|
||||
}
|
||||
}
|
||||
},
|
||||
) { model ->
|
||||
when (model) {
|
||||
is SourceUiModel.Header -> {
|
||||
SourceHeader(
|
||||
modifier = Modifier.animateItemPlacement(),
|
||||
language = model.language
|
||||
language = model.language,
|
||||
)
|
||||
}
|
||||
is SourceUiModel.Item -> SourceItem(
|
||||
|
@ -139,7 +139,7 @@ fun SourceList(
|
|||
onClickDisable(sourceState)
|
||||
setSourceState(null)
|
||||
},
|
||||
onDismiss = { setSourceState(null) }
|
||||
onDismiss = { setSourceState(null) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -147,14 +147,14 @@ fun SourceList(
|
|||
@Composable
|
||||
fun SourceHeader(
|
||||
modifier: Modifier = Modifier,
|
||||
language: String
|
||||
language: String,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
Text(
|
||||
text = LocaleHelper.getSourceDisplayName(language, context),
|
||||
modifier = modifier
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.header
|
||||
style = MaterialTheme.typography.header,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ fun SourceItem(
|
|||
onClickItem: (Source) -> Unit,
|
||||
onLongClickItem: (Source) -> Unit,
|
||||
onClickLatest: (Source) -> Unit,
|
||||
onClickPin: (Source) -> Unit
|
||||
onClickPin: (Source) -> Unit,
|
||||
) {
|
||||
BaseSourceItem(
|
||||
modifier = modifier,
|
||||
|
@ -178,14 +178,14 @@ fun SourceItem(
|
|||
Text(
|
||||
text = stringResource(id = R.string.latest),
|
||||
style = LocalTextStyle.current.copy(
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
SourcePinButton(
|
||||
isPinned = Pin.Pinned in source.pin,
|
||||
onClick = { onClickPin(source) }
|
||||
onClick = { onClickPin(source) },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
@ -193,7 +193,7 @@ fun SourceItem(
|
|||
|
||||
@Composable
|
||||
fun SourceIcon(
|
||||
source: Source
|
||||
source: Source,
|
||||
) {
|
||||
val icon = source.icon
|
||||
val modifier = Modifier
|
||||
|
@ -217,7 +217,7 @@ fun SourceIcon(
|
|||
@Composable
|
||||
fun SourcePinButton(
|
||||
isPinned: Boolean,
|
||||
onClick: () -> Unit
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
val icon = if (isPinned) Icons.Filled.PushPin else Icons.Outlined.PushPin
|
||||
val tint = if (isPinned) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground
|
||||
|
@ -225,7 +225,7 @@ fun SourcePinButton(
|
|||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = "",
|
||||
tint = tint
|
||||
tint = tint,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ fun SourceOptionsDialog(
|
|||
modifier = Modifier
|
||||
.clickable(onClick = onClickPin)
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp)
|
||||
.padding(vertical = 16.dp),
|
||||
)
|
||||
if (source.id != LocalSource.ID) {
|
||||
Text(
|
||||
|
@ -257,7 +257,7 @@ fun SourceOptionsDialog(
|
|||
modifier = Modifier
|
||||
.clickable(onClick = onClickDisable)
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp)
|
||||
.padding(vertical = 16.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ fun BaseSourceItem(
|
|||
modifier = modifier
|
||||
.combinedClickable(
|
||||
onClick = onClickItem,
|
||||
onLongClick = onLongClickItem
|
||||
onLongClick = onLongClickItem,
|
||||
)
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
icon.invoke(this, source)
|
||||
content.invoke(this, source, showLanguageInContent)
|
||||
|
@ -51,20 +51,20 @@ private val defaultContent: @Composable RowScope.(Source, Boolean) -> Unit = { s
|
|||
Column(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = horizontalPadding)
|
||||
.weight(1f)
|
||||
.weight(1f),
|
||||
) {
|
||||
Text(
|
||||
text = source.name,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
if (showLanguageInContent) {
|
||||
Text(
|
||||
text = LocaleHelper.getDisplayName(source.lang),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class AppModule(val app: Application) : InjektModule {
|
|||
.callback(DbOpenCallback())
|
||||
.name(DbOpenCallback.DATABASE_NAME)
|
||||
.noBackupDirectory(false)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -56,11 +56,11 @@ class AppModule(val app: Application) : InjektModule {
|
|||
driver = get(),
|
||||
historyAdapter = History.Adapter(
|
||||
history_last_readAdapter = dateAdapter,
|
||||
history_time_readAdapter = dateAdapter
|
||||
history_time_readAdapter = dateAdapter,
|
||||
),
|
||||
mangasAdapter = Mangas.Adapter(
|
||||
genreAdapter = listOfStringsAdapter
|
||||
)
|
||||
genreAdapter = listOfStringsAdapter,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(Database.Schema.version)
|
|||
Database.Schema.migrate(
|
||||
driver = AndroidSqliteDriver(database = db, cacheSize = 1),
|
||||
oldVersion = oldVersion,
|
||||
newVersion = newVersion
|
||||
newVersion = newVersion,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class MigrationMangaController : ComposeController<MigrationMangaPresenter> {
|
|||
},
|
||||
onClickCover = {
|
||||
router.pushController(MangaController(it.id))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import uy.kohesive.injekt.api.get
|
|||
|
||||
class MigrationMangaPresenter(
|
||||
private val sourceId: Long,
|
||||
private val getFavoritesBySourceId: GetFavoritesBySourceId = Injekt.get()
|
||||
private val getFavoritesBySourceId: GetFavoritesBySourceId = Injekt.get(),
|
||||
) : BasePresenter<MigrationMangaController>() {
|
||||
|
||||
private val _state: MutableStateFlow<MigrateMangaState> = MutableStateFlow(MigrateMangaState.Loading)
|
||||
|
|
|
@ -28,7 +28,7 @@ class SearchController(
|
|||
constructor(mangaId: Long) : this(
|
||||
Injekt.get<DatabaseHelper>()
|
||||
.getManga(mangaId)
|
||||
.executeAsBlocking()
|
||||
.executeAsBlocking(),
|
||||
)
|
||||
|
||||
private var newManga: Manga? = null
|
||||
|
|
|
@ -30,8 +30,8 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
|
|||
parentController!!.router.pushController(
|
||||
MigrationMangaController(
|
||||
source.id,
|
||||
source.name
|
||||
)
|
||||
source.name,
|
||||
),
|
||||
)
|
||||
},
|
||||
onLongClickItem = { source ->
|
||||
|
@ -51,12 +51,14 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
|
|||
true
|
||||
}
|
||||
R.id.asc_alphabetical,
|
||||
R.id.desc_alphabetical -> {
|
||||
R.id.desc_alphabetical,
|
||||
-> {
|
||||
presenter.setAlphabeticalSorting(itemId == R.id.asc_alphabetical)
|
||||
true
|
||||
}
|
||||
R.id.asc_count,
|
||||
R.id.desc_count -> {
|
||||
R.id.desc_count,
|
||||
-> {
|
||||
presenter.setTotalSorting(itemId == R.id.asc_count)
|
||||
true
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import uy.kohesive.injekt.api.get
|
|||
|
||||
class MigrationSourcesPresenter(
|
||||
private val getSourcesWithFavoriteCount: GetSourcesWithFavoriteCount = Injekt.get(),
|
||||
private val setMigrateSorting: SetMigrateSorting = Injekt.get()
|
||||
private val setMigrateSorting: SetMigrateSorting = Injekt.get(),
|
||||
) : BasePresenter<MigrationSourcesController>() {
|
||||
|
||||
private val _state: MutableStateFlow<MigrateSourceState> = MutableStateFlow(MigrateSourceState.Loading)
|
||||
|
|
|
@ -20,7 +20,7 @@ class SourceFilterPresenter(
|
|||
private val getLanguagesWithSources: GetLanguagesWithSources = Injekt.get(),
|
||||
private val toggleSource: ToggleSource = Injekt.get(),
|
||||
private val toggleLanguage: ToggleLanguage = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) : BasePresenter<SourceFilterController>() {
|
||||
|
||||
private val _state: MutableStateFlow<SourceFilterState> = MutableStateFlow(SourceFilterState.Loading)
|
||||
|
@ -49,7 +49,7 @@ class SourceFilterPresenter(
|
|||
header + it.value.map { source ->
|
||||
FilterUiModel.Item(
|
||||
source,
|
||||
source.id.toString() !in preferences.disabledSources().get()
|
||||
source.id.toString() !in preferences.disabledSources().get(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.TreeMap
|
|||
class SourcePresenter(
|
||||
private val getEnabledSources: GetEnabledSources = Injekt.get(),
|
||||
private val toggleSource: ToggleSource = Injekt.get(),
|
||||
private val toggleSourcePin: ToggleSourcePin = Injekt.get()
|
||||
private val toggleSourcePin: ToggleSourcePin = Injekt.get(),
|
||||
) : BasePresenter<SourceController>() {
|
||||
|
||||
private val _state: MutableStateFlow<SourceState> = MutableStateFlow(SourceState.Loading)
|
||||
|
|
|
@ -25,7 +25,7 @@ fun syncChaptersWithSource(
|
|||
db: DatabaseHelper,
|
||||
rawSourceChapters: List<SChapter>,
|
||||
manga: Manga,
|
||||
source: Source
|
||||
source: Source,
|
||||
): Pair<List<Chapter>, List<Chapter>> {
|
||||
if (rawSourceChapters.isEmpty()) {
|
||||
throw NoChaptersException()
|
||||
|
|
|
@ -91,7 +91,7 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor(
|
|||
currentAnimator = null
|
||||
postInvalidate()
|
||||
}
|
||||
})
|
||||
},)
|
||||
}
|
||||
|
||||
internal class SavedState : AbsSavedState {
|
||||
|
|
|
@ -25,7 +25,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
|
|||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThemeViewHolder {
|
||||
val themeResIds = ThemingDelegate.getThemeResIds(themes[viewType], preferences.themeDarkAmoled().get())
|
||||
val themedContext = themeResIds.fold(parent.context) {
|
||||
context, themeResId ->
|
||||
context, themeResId ->
|
||||
ContextThemeWrapper(context, themeResId)
|
||||
}
|
||||
|
||||
|
|
|
@ -111,5 +111,5 @@ conductor = ["conductor-core","conductor-viewpager","conductor-support-preferenc
|
|||
shizuku = ["shizuku-api","shizuku-provider"]
|
||||
|
||||
[plugins]
|
||||
kotlinter = { id = "org.jmailen.kotlinter", version = "3.6.0"}
|
||||
kotlinter = { id = "org.jmailen.kotlinter", version = "3.10.0"}
|
||||
versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0"}
|
Loading…
Reference in a new issue