Update linter

(cherry picked from commit ae7df4fb7fa4fc996ba26a9f6dbbb6b5277a939b)

# Conflicts:
#	app/src/main/java/eu/kanade/domain/manga/model/Manga.kt
#	app/src/main/java/eu/kanade/domain/source/model/Source.kt
#	app/src/main/java/eu/kanade/presentation/source/MigrateSourceScreen.kt
#	app/src/main/java/eu/kanade/presentation/source/SourceFilterScreen.kt
#	app/src/main/java/eu/kanade/presentation/source/SourceScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceFilterPresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt
This commit is contained in:
arkon 2022-05-10 17:54:52 -04:00 committed by Jobobby04
parent c1c934011f
commit 24c5563a02
64 changed files with 157 additions and 154 deletions

View File

@ -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)
}
},
)
}

View File

@ -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>
}

View File

@ -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>

View File

@ -8,6 +8,6 @@ val feedSavedSearchMapper: (Long, Long, Long?, Boolean) -> FeedSavedSearch =
id = id,
source = source,
savedSearch = savedSearch,
global = global
global = global,
)
}

View File

@ -9,6 +9,6 @@ val savedSearchMapper: (Long, Long, String, String?, String?) -> SavedSearch =
source = source,
name = name,
query = query,
filtersJson = filtersJson
filtersJson = filtersJson,
)
}

View File

@ -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,
)
}

View File

@ -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)
}
},
)
}

View File

@ -22,6 +22,6 @@ val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?,
status = status,
thumbnailUrl = thumbnailUrl,
initialized = initialized,
filteredScanlators = filteredScanlators
filteredScanlators = filteredScanlators,
)
}

View File

@ -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>> {

View File

@ -8,7 +8,7 @@ val sourceMapper: (eu.kanade.tachiyomi.source.Source) -> Source = { source ->
source.id,
source.lang,
source.name,
false
false,
)
}

View File

@ -11,7 +11,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>> {

View File

@ -12,5 +12,5 @@ data class Chapter(
val name: String,
val dateUpload: Long,
val chapterNumber: Float,
val scanlator: String?
val scanlator: String?,
)

View File

@ -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 {

View File

@ -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

View File

@ -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? {

View File

@ -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) {

View File

@ -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) {

View File

@ -5,5 +5,5 @@ import java.util.Date
data class History(
val id: Long?,
val chapterId: Long,
val readAt: Date?
val readAt: Date?,
)

View File

@ -9,5 +9,5 @@ data class HistoryWithRelations(
val title: String,
val thumbnailUrl: String,
val chapterNumber: Float,
val readAt: Date?
val readAt: Date?,
)

View File

@ -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>> {

View File

@ -52,7 +52,7 @@ class GetEnabledSources(
val source = it.copy(
pin = flag,
isExcludedFromDataSaver = it.id.toString() in excludedFromDataSaver,
categories = categories
categories = categories,
)
val toFlatten = mutableListOf(source)
if (source.id == lastUsedSource) {

View File

@ -17,19 +17,19 @@ class GetLanguagesWithSources(
return combine(
preferences.enabledLanguages().asFlow(),
preferences.disabledSources().asFlow(),
repository.getOnlineSources()
repository.getOnlineSources(),
) { enabledLanguage, disabledSource, onlineSources ->
val sortedSources = onlineSources.filterNot { it.id in BlacklistedSources.HIDDEN_SOURCES }.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) },
),
)
}
}

View File

@ -6,7 +6,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
class GetShowLatest(
private val preferences: PreferencesHelper
private val preferences: PreferencesHelper,
) {
fun subscribe(mode: SourceController.Mode): Flow<Boolean> {

View File

@ -4,7 +4,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import kotlinx.coroutines.flow.Flow
class GetSourceCategories(
private val preferences: PreferencesHelper
private val preferences: PreferencesHelper,
) {
fun subscribe(): Flow<Set<String>> {

View File

@ -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 {

View File

@ -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) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
class SetSourceCategories(
private val preferences: PreferencesHelper
private val preferences: PreferencesHelper,
) {
fun await(source: Source, sourceCategories: List<String>) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleExcludeFromDataSaver(
private val preferences: PreferencesHelper
private val preferences: PreferencesHelper,
) {
fun await(source: Source) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleSources(
private val preferences: PreferencesHelper
private val preferences: PreferencesHelper,
) {
fun await(isEnable: Boolean, sources: List<Source>) {

View File

@ -29,7 +29,7 @@ fun EmptyScreen(
) {
Box(
modifier = Modifier
.fillMaxSize()
.fillMaxSize(),
) {
AndroidView(
factory = { context ->

View File

@ -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,

View File

@ -42,7 +42,7 @@ fun PreferenceRow(
subtitle: String? = null,
action: @Composable (() -> Unit)? = null,
// SY -->
subtitleAnnotated: AnnotatedString? = null
subtitleAnnotated: AnnotatedString? = null,
// SY <--
) {
val height = if (subtitle != null /* SY --> */ || subtitleAnnotated != null/* SY <-- */) 72.dp else 56.dp
@ -60,7 +60,7 @@ fun PreferenceRow(
onLongClick = onLongClick,
onClick = onClick,
),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
if (painter != null) {
Icon(
@ -75,7 +75,7 @@ fun PreferenceRow(
Column(
Modifier
.padding(horizontal = horizontalPadding)
.weight(1f)
.weight(1f),
) {
Text(
text = title,
@ -114,7 +114,7 @@ fun SwitchPreference(
subtitle: String? = null,
painter: Painter? = null,
// SY -->
subtitleAnnotated: AnnotatedString? = null
subtitleAnnotated: AnnotatedString? = null,
// SY <--
) {
PreferenceRow(
@ -129,7 +129,7 @@ fun SwitchPreference(
},
onClick = { preference.value = !preference.value },
// SY -->
subtitleAnnotated = subtitleAnnotated
subtitleAnnotated = subtitleAnnotated,
// SY <--
)
}

View File

@ -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),
)
}
}

View File

@ -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,
)
}
}

View File

@ -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),

View File

@ -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) },
)
}

View File

@ -47,7 +47,7 @@ fun MigrateSourceScreen(
list = (state as MigrateSourceState.Success).sources,
onClickItem = onClickItem,
onLongClickItem = onLongClickItem,
onClickAll = onClickAll
onClickAll = onClickAll,
)
}
}
@ -75,7 +75,7 @@ fun MigrateSourceList(
modifier = Modifier
.animateItemPlacement()
.padding(horizontal = horizontalPadding, vertical = 8.dp),
style = MaterialTheme.typography.header
style = MaterialTheme.typography.header,
)
}
@ -83,7 +83,7 @@ fun MigrateSourceList(
items = list,
key = { (source, _) ->
source.id
}
},
) { (source, count) ->
MigrateSourceItem(
modifier = Modifier.animateItemPlacement(),
@ -91,7 +91,7 @@ fun MigrateSourceList(
count = count,
onClickItem = { onClickItem(source) },
onLongClickItem = { onLongClickItem(source) },
onClickAll = { onClickAll(source) }
onClickAll = { onClickAll(source) },
)
}
}
@ -118,10 +118,10 @@ fun MigrateSourceItem(
Text(
text = stringResource(id = R.string.all),
style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary
)
color = MaterialTheme.colorScheme.primary,
),
)
}
}
},
)
}

View File

@ -92,7 +92,7 @@ fun SourceFilterContent(
is FilterUiModel.Header, is FilterUiModel.ToggleHeader -> it.hashCode()
is FilterUiModel.Item -> it.source.key()
}
}
},
) { model ->
when (model) {
is FilterUiModel.Header -> {
@ -100,7 +100,7 @@ fun SourceFilterContent(
modifier = Modifier.animateItemPlacement(),
language = model.language,
isEnabled = model.isEnabled,
onClickItem = onClickLang
onClickItem = onClickLang,
)
}
// SY -->
@ -110,7 +110,7 @@ fun SourceFilterContent(
isEnabled = model.isEnabled,
onClickItem = {
onClickSources(!model.isEnabled, model.sources)
}
},
)
}
// SY <--
@ -118,7 +118,7 @@ fun SourceFilterContent(
modifier = Modifier.animateItemPlacement(),
source = model.source,
isEnabled = model.isEnabled,
onClickItem = onClickSource
onClickItem = onClickSource,
)
}
}
@ -130,7 +130,7 @@ fun SourceFilterHeader(
modifier: Modifier,
language: String,
isEnabled: Boolean,
onClickItem: (String) -> Unit
onClickItem: (String) -> Unit,
) {
PreferenceRow(
modifier = modifier,
@ -147,7 +147,7 @@ fun SourceFilterHeader(
fun SourceFilterToggle(
modifier: Modifier,
isEnabled: Boolean,
onClickItem: () -> Unit
onClickItem: () -> Unit,
) {
PreferenceRow(
modifier = modifier,
@ -156,7 +156,7 @@ fun SourceFilterToggle(
Switch(checked = isEnabled, onCheckedChange = null)
},
onClick = { onClickItem() },
painter = remember { ColorPainter(Color.Transparent) }
painter = remember { ColorPainter(Color.Transparent) },
)
}
@ -167,7 +167,7 @@ fun SourceFilterItem(
modifier: Modifier,
source: Source,
isEnabled: Boolean,
onClickItem: (Source) -> Unit
onClickItem: (Source) -> Unit,
) {
BaseSourceItem(
modifier = modifier,
@ -176,6 +176,6 @@ fun SourceFilterItem(
onClickItem = { onClickItem(source) },
action = {
Checkbox(checked = isEnabled, onCheckedChange = null)
}
},
)
}

View File

@ -59,7 +59,7 @@ fun SourceScreen(
onClickLatest: (Source) -> Unit,
onClickPin: (Source) -> Unit,
onClickSetCategories: (Source, List<String>) -> Unit,
onClickToggleDataSaver: (Source) -> Unit
onClickToggleDataSaver: (Source) -> Unit,
) {
val state by presenter.state.collectAsState()
@ -77,7 +77,7 @@ fun SourceScreen(
onClickLatest = onClickLatest,
onClickPin = onClickPin,
onClickSetCategories = onClickSetCategories,
onClickToggleDataSaver = onClickToggleDataSaver
onClickToggleDataSaver = onClickToggleDataSaver,
)
}
}
@ -94,7 +94,7 @@ fun SourceList(
onClickLatest: (Source) -> Unit,
onClickPin: (Source) -> Unit,
onClickSetCategories: (Source, List<String>) -> Unit,
onClickToggleDataSaver: (Source) -> Unit
onClickToggleDataSaver: (Source) -> Unit,
) {
if (list.isEmpty()) {
EmptyScreen(textResource = R.string.source_empty_screen)
@ -123,14 +123,14 @@ 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,
isCategory = model.isCategory
isCategory = model.isCategory,
)
}
is SourceUiModel.Item -> SourceItem(
@ -168,7 +168,7 @@ fun SourceList(
onClickToggleDataSaver(sourceState)
setSourceState(null)
},
onDismiss = { setSourceState(null) }
onDismiss = { setSourceState(null) },
)
}
if (sourceCategoriesState != null) {
@ -213,7 +213,7 @@ fun SourceItem(
onClickItem: (Source) -> Unit,
onLongClickItem: (Source) -> Unit,
onClickLatest: (Source) -> Unit,
onClickPin: (Source) -> Unit
onClickPin: (Source) -> Unit,
) {
BaseSourceItem(
modifier = modifier,
@ -226,8 +226,8 @@ fun SourceItem(
Text(
text = stringResource(id = R.string.latest),
style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary
)
color = MaterialTheme.colorScheme.primary,
),
)
}
}
@ -235,7 +235,7 @@ fun SourceItem(
if (showPin) {
SourcePinButton(
isPinned = Pin.Pinned in source.pin,
onClick = { onClickPin(source) }
onClick = { onClickPin(source) },
)
}
// SY <--
@ -245,7 +245,7 @@ fun SourceItem(
@Composable
fun SourceIcon(
source: Source
source: Source,
) {
val icon = source.icon
val modifier = Modifier
@ -269,7 +269,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
@ -277,7 +277,7 @@ fun SourcePinButton(
Icon(
imageVector = icon,
contentDescription = "",
tint = tint
tint = tint,
)
}
}
@ -303,7 +303,7 @@ fun SourceOptionsDialog(
modifier = Modifier
.clickable(onClick = onClickPin)
.fillMaxWidth()
.padding(vertical = 16.dp)
.padding(vertical = 16.dp),
)
if (source.id != LocalSource.ID) {
Text(
@ -311,7 +311,7 @@ fun SourceOptionsDialog(
modifier = Modifier
.clickable(onClick = onClickDisable)
.fillMaxWidth()
.padding(vertical = 16.dp)
.padding(vertical = 16.dp),
)
}
// SY -->
@ -320,7 +320,7 @@ fun SourceOptionsDialog(
modifier = Modifier
.clickable(onClick = onClickSetCategories)
.fillMaxWidth()
.padding(vertical = 16.dp)
.padding(vertical = 16.dp),
)
Text(
text = if (source.isExcludedFromDataSaver) {

View File

@ -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,
)
}
}

View File

@ -45,7 +45,7 @@ class AppModule(val app: Application) : InjektModule {
.callback(DbOpenCallback())
.name(DbOpenCallback.DATABASE_NAME)
.noBackupDirectory(false)
.build()
.build(),
)
}
@ -58,11 +58,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,
),
)
}

View File

@ -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,
)
}
}

View File

@ -49,7 +49,7 @@ class MigrationMangaController : ComposeController<MigrationMangaPresenter> {
},
onClickCover = {
router.pushController(MangaController(it.id))
}
},
)
}

View File

@ -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)
val state: StateFlow<MigrateMangaState> = _state.asStateFlow()

View File

@ -37,8 +37,8 @@ class SearchController(
Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking(),
sources.map { Injekt.get<SourceManager>().getOrStub(it) }.filterIsInstance<CatalogueSource>(),
) {
this.targetController = targetController
}
this.targetController = targetController
}
@Suppress("unused")
constructor(bundle: Bundle) : this(

View File

@ -43,8 +43,8 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
}.pushController(
MigrationMangaController(
source.id,
source.name
)
source.name,
),
)
},
onLongClickItem = { source ->
@ -87,12 +87,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
}

View File

@ -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)

View File

@ -74,7 +74,7 @@ class SourceController(bundle: Bundle? = null) : SearchableComposeController<Sou
SmartSearchController.ARG_SOURCE_ID to source.id,
SmartSearchController.ARG_SMART_SEARCH_CONFIG to smartSearchConfig,
),
)
),
)
}
preferences.useNewSourceNavigation().get() -> openSource(source, SourceFeedController(source.id))

View File

@ -53,8 +53,8 @@ class SourceFilterPresenter(
val toggleHeader = listOf(
FilterUiModel.ToggleHeader(
it.value,
it.value.none { (id) -> id.toString() in disabledSources }
)
it.value.none { (id) -> id.toString() in disabledSources },
),
)
// SY <--
@ -62,7 +62,7 @@ class SourceFilterPresenter(
header + toggleHeader + it.value.map { source ->
FilterUiModel.Item(
source,
source.id.toString() !in preferences.disabledSources().get()
source.id.toString() !in preferences.disabledSources().get(),
)
}
}

View File

@ -53,7 +53,7 @@ class SourcePresenter(
getSourceCategories.subscribe(),
getShowLatest.subscribe(controllerMode),
flowOf(controllerMode == SourceController.Mode.CATALOGUE),
::collectLatestSources
::collectLatestSources,
)
.catch { exception ->
_state.value = SourceState.Error(exception)
@ -99,7 +99,7 @@ class SourcePresenter(
uiModels,
categories.sortedWith(compareByDescending(String.CASE_INSENSITIVE_ORDER) { it }),
showLatest,
showPin
showPin,
)
}
@ -132,6 +132,6 @@ sealed class SourceState {
val uiModels: List<SourceUiModel>,
val sourceCategories: List<String>,
val showLatest: Boolean,
val showPin: Boolean
val showPin: Boolean,
) : SourceState()
}

View File

@ -124,7 +124,7 @@ open class BrowseSourceController(bundle: Bundle) :
query,
smartSearchConfig,
savedSearch,
filterList
filterList,
)
constructor(
@ -140,7 +140,7 @@ open class BrowseSourceController(bundle: Bundle) :
query,
smartSearchConfig,
savedSearch,
filterList
filterList,
)
private val preferences: PreferencesHelper by injectLazy()

View File

@ -130,7 +130,7 @@ open class SourceFeedPresenter(
_id = null,
source = source.id,
saved_search = savedSearchId,
global = false
global = false,
)
}
}

View File

@ -86,14 +86,14 @@ class SettingsMainController : BasicComposeController() {
SettingsSection(
titleRes = R.string.pref_category_eh,
painter = painterResource(R.drawable.eh_ic_ehlogo_red_24dp),
onClick = { router.pushController(SettingsEhController()) }
onClick = { router.pushController(SettingsEhController()) },
)
} else null,
if (MdUtil.getEnabledMangaDexs(preferences).isNotEmpty()) {
SettingsSection(
titleRes = R.string.pref_category_mangadex,
painter = painterResource(R.drawable.ic_tracker_mangadex_logo_24dp),
onClick = { router.pushController(SettingsMangaDexController()) }
onClick = { router.pushController(SettingsMangaDexController()) },
)
} else null,
// SY <--

View File

@ -26,7 +26,7 @@ fun syncChaptersWithSource(
db: DatabaseHelper,
rawSourceChapters: List<SChapter>,
manga: Manga,
source: Source
source: Source,
): Pair<List<Chapter>, List<Chapter>> {
if (rawSourceChapters.isEmpty()) {
throw NoChaptersException()

View File

@ -91,7 +91,8 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor(
currentAnimator = null
postInvalidate()
}
})
},
)
}
internal class SavedState : AbsSavedState {

View File

@ -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)
}

View File

@ -416,7 +416,7 @@ object EXHMigrations {
source = it.substringBefore(':').toLongOrNull() ?: return@forEach,
name = content["name"]!!.jsonPrimitive.content,
query = content["query"]!!.jsonPrimitive.contentOrNull?.nullIfBlank(),
filters_json = Json.encodeToString(content["filters"]!!.jsonArray)
filters_json = Json.encodeToString(content["filters"]!!.jsonArray),
)
}
}

View File

@ -84,7 +84,7 @@ class SettingsDebugController : BasicComposeController() {
Box(
Modifier
.fillMaxSize()
.nestedScroll(nestedScrollInterop)
.nestedScroll(nestedScrollInterop),
) {
var running by remember { mutableStateOf(false) }
var result by remember { mutableStateOf<Pair<String, String>?>(null) }
@ -94,7 +94,7 @@ class SettingsDebugController : BasicComposeController() {
text = "Functions",
color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(16.dp)
modifier = Modifier.padding(16.dp),
)
}
items(functions.orEmpty()) { (func, name) ->
@ -123,7 +123,7 @@ class SettingsDebugController : BasicComposeController() {
text = "Toggles",
color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(16.dp)
modifier = Modifier.padding(16.dp),
)
}
items(toggles) { (name, pref, default) ->
@ -134,7 +134,7 @@ class SettingsDebugController : BasicComposeController() {
.capitalize(Locale.getDefault()),
subtitleAnnotated = if (pref.value != default) {
AnnotatedString("MODIFIED", SpanStyle(color = Color.Red))
} else null
} else null,
)
}
item {
@ -145,7 +145,7 @@ class SettingsDebugController : BasicComposeController() {
running && result == null,
enter = fadeIn(),
exit = fadeOut(),
modifier = Modifier.fillMaxSize()
modifier = Modifier.fillMaxSize(),
) {
Box(
Modifier
@ -158,7 +158,7 @@ class SettingsDebugController : BasicComposeController() {
}
}
},
contentAlignment = Alignment.Center
contentAlignment = Alignment.Center,
) {
CircularProgressIndicator()
}
@ -174,7 +174,7 @@ class SettingsDebugController : BasicComposeController() {
SelectionContainer {
Text(text = result?.second.orEmpty())
}
}
},
)
}
}

View File

@ -27,7 +27,7 @@ object EHTags {
Character.getTags(),
Group.getTags(),
Artist.getTags(),
Artist2.getTags()
Artist2.getTags(),
).flatten().flatten()
fun getNamespaces0Tags() = listOf(

View File

@ -13,6 +13,6 @@ interface TagList {
getTags1(),
getTags2(),
getTags3(),
getTags4()
getTags4(),
)
}

View File

@ -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"}