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