mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Bump dependencies + linting
This commit is contained in:
parent
5b474e96b7
commit
cd3cb72b65
33 changed files with 195 additions and 104 deletions
|
@ -13,11 +13,13 @@ class SetMigrateSorting(
|
||||||
|
|
||||||
enum class Mode {
|
enum class Mode {
|
||||||
ALPHABETICAL,
|
ALPHABETICAL,
|
||||||
TOTAL;
|
TOTAL,
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Direction {
|
enum class Direction {
|
||||||
ASCENDING,
|
ASCENDING,
|
||||||
DESCENDING;
|
DESCENDING,
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,9 @@ private fun InfoText(
|
||||||
|
|
||||||
val clickableModifier = if (onClick != null) {
|
val clickableModifier = if (onClick != null) {
|
||||||
Modifier.clickable(interactionSource, indication = null) { onClick() }
|
Modifier.clickable(interactionSource, indication = null) { onClick() }
|
||||||
} else Modifier
|
} else {
|
||||||
|
Modifier
|
||||||
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.then(clickableModifier),
|
modifier = modifier.then(clickableModifier),
|
||||||
|
|
|
@ -18,7 +18,8 @@ import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
enum class MangaCover(val ratio: Float) {
|
enum class MangaCover(val ratio: Float) {
|
||||||
Square(1f / 1f),
|
Square(1f / 1f),
|
||||||
Book(2f / 3f);
|
Book(2f / 3f),
|
||||||
|
;
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
operator fun invoke(
|
operator fun invoke(
|
||||||
|
@ -42,7 +43,9 @@ enum class MangaCover(val ratio: Float) {
|
||||||
role = Role.Button,
|
role = Role.Button,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
)
|
)
|
||||||
} else Modifier,
|
} else {
|
||||||
|
Modifier
|
||||||
|
},
|
||||||
),
|
),
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
)
|
)
|
||||||
|
|
|
@ -220,12 +220,18 @@ private fun ScaffoldLayout(
|
||||||
.asPaddingValues(this@SubcomposeLayout)
|
.asPaddingValues(this@SubcomposeLayout)
|
||||||
val innerPadding = PaddingValues(
|
val innerPadding = PaddingValues(
|
||||||
top =
|
top =
|
||||||
if (topBarHeight == 0) insets.calculateTopPadding()
|
if (topBarHeight == 0) {
|
||||||
else topBarHeight.toDp(),
|
insets.calculateTopPadding()
|
||||||
|
} else {
|
||||||
|
topBarHeight.toDp()
|
||||||
|
},
|
||||||
bottom =
|
bottom =
|
||||||
(
|
(
|
||||||
if (bottomBarHeight == 0) insets.calculateBottomPadding()
|
if (bottomBarHeight == 0) {
|
||||||
else bottomBarHeight.toDp()
|
insets.calculateBottomPadding()
|
||||||
|
} else {
|
||||||
|
bottomBarHeight.toDp()
|
||||||
|
}
|
||||||
) + fabHeight.toDp(),
|
) + fabHeight.toDp(),
|
||||||
start = insets.calculateLeftPadding((this@SubcomposeLayout).layoutDirection),
|
start = insets.calculateLeftPadding((this@SubcomposeLayout).layoutDirection),
|
||||||
end = insets.calculateRightPadding((this@SubcomposeLayout).layoutDirection),
|
end = insets.calculateRightPadding((this@SubcomposeLayout).layoutDirection),
|
||||||
|
|
|
@ -145,13 +145,17 @@ fun VerticalFastScroller(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else Modifier,
|
} else {
|
||||||
|
Modifier
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
// Exclude thumb from gesture area only when needed
|
// Exclude thumb from gesture area only when needed
|
||||||
if (isThumbVisible && !isThumbDragged && !listState.isScrollInProgress) {
|
if (isThumbVisible && !isThumbDragged && !listState.isScrollInProgress) {
|
||||||
Modifier.systemGestureExclusion()
|
Modifier.systemGestureExclusion()
|
||||||
} else Modifier,
|
} else {
|
||||||
|
Modifier
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.height(ThumbLength)
|
.height(ThumbLength)
|
||||||
.padding(horizontal = 8.dp)
|
.padding(horizontal = 8.dp)
|
||||||
|
@ -321,13 +325,17 @@ fun VerticalGridFastScroller(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else Modifier,
|
} else {
|
||||||
|
Modifier
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
// Exclude thumb from gesture area only when needed
|
// Exclude thumb from gesture area only when needed
|
||||||
if (isThumbVisible && !isThumbDragged && !state.isScrollInProgress) {
|
if (isThumbVisible && !isThumbDragged && !state.isScrollInProgress) {
|
||||||
Modifier.systemGestureExclusion()
|
Modifier.systemGestureExclusion()
|
||||||
} else Modifier,
|
} else {
|
||||||
|
Modifier
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.height(ThumbLength)
|
.height(ThumbLength)
|
||||||
.padding(horizontal = 8.dp)
|
.padding(horizontal = 8.dp)
|
||||||
|
|
|
@ -673,7 +673,9 @@ private fun LazyListScope.sharedChapterItems(
|
||||||
},
|
},
|
||||||
onDownloadClick = if (onDownloadChapter != null) {
|
onDownloadClick = if (onDownloadChapter != null) {
|
||||||
{ onDownloadChapter(listOf(chapterItem), it) }
|
{ onDownloadChapter(listOf(chapterItem), it) }
|
||||||
} else null,
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ enum class DownloadAction {
|
||||||
NEXT_10_CHAPTERS,
|
NEXT_10_CHAPTERS,
|
||||||
CUSTOM,
|
CUSTOM,
|
||||||
UNREAD_CHAPTERS,
|
UNREAD_CHAPTERS,
|
||||||
ALL_CHAPTERS
|
ALL_CHAPTERS,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class EditCoverAction {
|
enum class EditCoverAction {
|
||||||
|
|
|
@ -316,10 +316,12 @@ private fun MangaAndSourceTitlesLarge(
|
||||||
.padding(top = 2.dp)
|
.padding(top = 2.dp)
|
||||||
.clickableNoIndication(
|
.clickableNoIndication(
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
if (!author.isNullOrBlank()) context.copyToClipboard(
|
if (!author.isNullOrBlank()) {
|
||||||
author,
|
context.copyToClipboard(
|
||||||
author,
|
author,
|
||||||
)
|
author,
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
|
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
|
||||||
),
|
),
|
||||||
|
@ -428,10 +430,12 @@ private fun MangaAndSourceTitlesSmall(
|
||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
modifier = Modifier.clickableNoIndication(
|
modifier = Modifier.clickableNoIndication(
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
if (title.isNotBlank()) context.copyToClipboard(
|
if (title.isNotBlank()) {
|
||||||
title,
|
context.copyToClipboard(
|
||||||
title,
|
title,
|
||||||
)
|
title,
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onClick = { if (title.isNotBlank()) doSearch(title, true) },
|
onClick = { if (title.isNotBlank()) doSearch(title, true) },
|
||||||
),
|
),
|
||||||
|
@ -446,10 +450,12 @@ private fun MangaAndSourceTitlesSmall(
|
||||||
.padding(top = 2.dp)
|
.padding(top = 2.dp)
|
||||||
.clickableNoIndication(
|
.clickableNoIndication(
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
if (!author.isNullOrBlank()) context.copyToClipboard(
|
if (!author.isNullOrBlank()) {
|
||||||
author,
|
context.copyToClipboard(
|
||||||
author,
|
author,
|
||||||
)
|
author,
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
|
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
|
||||||
),
|
),
|
||||||
|
|
|
@ -103,12 +103,16 @@ private fun Modifier.drawScrollbar(
|
||||||
val estimatedItemSize = if (items.isEmpty()) 0f else itemsSize.toFloat() / items.size
|
val estimatedItemSize = if (items.isEmpty()) 0f else itemsSize.toFloat() / items.size
|
||||||
val totalSize = estimatedItemSize * layoutInfo.totalItemsCount
|
val totalSize = estimatedItemSize * layoutInfo.totalItemsCount
|
||||||
val thumbSize = viewportSize / totalSize * viewportSize
|
val thumbSize = viewportSize / totalSize * viewportSize
|
||||||
val startOffset = if (items.isEmpty()) 0f else items
|
val startOffset = if (items.isEmpty()) {
|
||||||
.first()
|
0f
|
||||||
.run {
|
} else {
|
||||||
val startPadding = if (reverseDirection) layoutInfo.afterContentPadding else layoutInfo.beforeContentPadding
|
items
|
||||||
startPadding + ((estimatedItemSize * index - offset) / totalSize * viewportSize)
|
.first()
|
||||||
}
|
.run {
|
||||||
|
val startPadding = if (reverseDirection) layoutInfo.afterContentPadding else layoutInfo.beforeContentPadding
|
||||||
|
startPadding + ((estimatedItemSize * index - offset) / totalSize * viewportSize)
|
||||||
|
}
|
||||||
|
}
|
||||||
val drawScrollbar = onDrawScrollbar(
|
val drawScrollbar = onDrawScrollbar(
|
||||||
orientation, reverseDirection, atEnd, showScrollbar,
|
orientation, reverseDirection, atEnd, showScrollbar,
|
||||||
thickness, color, alpha, thumbSize, startOffset, positionOffset,
|
thickness, color, alpha, thumbSize, startOffset, positionOffset,
|
||||||
|
@ -202,7 +206,9 @@ private fun Modifier.drawScrollbar(
|
||||||
val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr
|
val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr
|
||||||
val reverseDirection = if (orientation == Orientation.Horizontal) {
|
val reverseDirection = if (orientation == Orientation.Horizontal) {
|
||||||
if (isLtr) reverseScrolling else !reverseScrolling
|
if (isLtr) reverseScrolling else !reverseScrolling
|
||||||
} else reverseScrolling
|
} else {
|
||||||
|
reverseScrolling
|
||||||
|
}
|
||||||
val atEnd = if (orientation == Orientation.Vertical) isLtr else true
|
val atEnd = if (orientation == Orientation.Vertical) isLtr else true
|
||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
|
@ -111,8 +111,11 @@ object Migrations {
|
||||||
// Migrate library filters to tri-state versions
|
// Migrate library filters to tri-state versions
|
||||||
fun convertBooleanPrefToTriState(key: String): Int {
|
fun convertBooleanPrefToTriState(key: String): Int {
|
||||||
val oldPrefValue = prefs.getBoolean(key, false)
|
val oldPrefValue = prefs.getBoolean(key, false)
|
||||||
return if (oldPrefValue) ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE.value
|
return if (oldPrefValue) {
|
||||||
else ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value
|
ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE.value
|
||||||
|
} else {
|
||||||
|
ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
putInt(PreferenceKeys.filterDownloaded, convertBooleanPrefToTriState("pref_filter_downloaded_key"))
|
putInt(PreferenceKeys.filterDownloaded, convertBooleanPrefToTriState("pref_filter_downloaded_key"))
|
||||||
|
|
|
@ -44,8 +44,11 @@ class BackupFileValidator(
|
||||||
.filter { sourceManager.get(it.key) == null }
|
.filter { sourceManager.get(it.key) == null }
|
||||||
.values.map {
|
.values.map {
|
||||||
val id = it.toLongOrNull()
|
val id = it.toLongOrNull()
|
||||||
if (id == null) it
|
if (id == null) {
|
||||||
else sourceManager.getOrStub(id).toString()
|
it
|
||||||
|
} else {
|
||||||
|
sourceManager.getOrStub(id).toString()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.distinct()
|
.distinct()
|
||||||
.sorted()
|
.sorted()
|
||||||
|
|
|
@ -11,7 +11,8 @@ data class BackupTracking(
|
||||||
@ProtoNumber(1) var syncId: Int,
|
@ProtoNumber(1) var syncId: Int,
|
||||||
// LibraryId is not null in 1.x
|
// LibraryId is not null in 1.x
|
||||||
@ProtoNumber(2) var libraryId: Long,
|
@ProtoNumber(2) var libraryId: Long,
|
||||||
@Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING) @ProtoNumber(3)
|
@Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING)
|
||||||
|
@ProtoNumber(3)
|
||||||
var mediaIdInt: Int = 0,
|
var mediaIdInt: Int = 0,
|
||||||
// trackingUrl is called mediaUrl in 1.x
|
// trackingUrl is called mediaUrl in 1.x
|
||||||
@ProtoNumber(4) var trackingUrl: String = "",
|
@ProtoNumber(4) var trackingUrl: String = "",
|
||||||
|
|
|
@ -30,29 +30,37 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val authRequest = if (originalRequest.method == "GET") originalRequest.newBuilder()
|
val authRequest = if (originalRequest.method == "GET") {
|
||||||
.header("User-Agent", "Tachiyomi")
|
originalRequest.newBuilder()
|
||||||
.url(
|
.header("User-Agent", "Tachiyomi")
|
||||||
originalRequest.url.newBuilder()
|
.url(
|
||||||
.addQueryParameter("access_token", currAuth.access_token).build(),
|
originalRequest.url.newBuilder()
|
||||||
)
|
.addQueryParameter("access_token", currAuth.access_token).build(),
|
||||||
.build() else originalRequest.newBuilder()
|
)
|
||||||
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
|
.build()
|
||||||
.header("User-Agent", "Tachiyomi")
|
} else {
|
||||||
.build()
|
originalRequest.newBuilder()
|
||||||
|
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
|
||||||
|
.header("User-Agent", "Tachiyomi")
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
return chain.proceed(authRequest)
|
return chain.proceed(authRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun newAuth(oauth: OAuth?) {
|
fun newAuth(oauth: OAuth?) {
|
||||||
this.oauth = if (oauth == null) null else OAuth(
|
this.oauth = if (oauth == null) {
|
||||||
oauth.access_token,
|
null
|
||||||
oauth.token_type,
|
} else {
|
||||||
System.currentTimeMillis() / 1000,
|
OAuth(
|
||||||
oauth.expires_in,
|
oauth.access_token,
|
||||||
oauth.refresh_token,
|
oauth.token_type,
|
||||||
this.oauth?.user_id,
|
System.currentTimeMillis() / 1000,
|
||||||
)
|
oauth.expires_in,
|
||||||
|
oauth.refresh_token,
|
||||||
|
this.oauth?.user_id,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
bangumi.saveToken(oauth)
|
bangumi.saveToken(oauth)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,11 @@ class KomgaApi(private val client: OkHttpClient) {
|
||||||
val progress = client
|
val progress = client
|
||||||
.newCall(GET("${url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi"))
|
.newCall(GET("${url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi"))
|
||||||
.await().let {
|
.await().let {
|
||||||
if (url.contains("/api/v1/series/")) it.parseAs<ReadProgressV2Dto>()
|
if (url.contains("/api/v1/series/")) {
|
||||||
else it.parseAs<ReadProgressDto>().toV2()
|
it.parseAs<ReadProgressV2Dto>()
|
||||||
|
} else {
|
||||||
|
it.parseAs<ReadProgressDto>().toV2()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
track.apply {
|
track.apply {
|
||||||
|
|
|
@ -29,14 +29,18 @@ internal class ExtensionGithubApi {
|
||||||
|
|
||||||
suspend fun findExtensions(): List<Extension.Available> {
|
suspend fun findExtensions(): List<Extension.Available> {
|
||||||
return withIOContext {
|
return withIOContext {
|
||||||
val githubResponse = if (requiresFallbackSource) null else try {
|
val githubResponse = if (requiresFallbackSource) {
|
||||||
networkService.client
|
|
||||||
.newCall(GET("${REPO_URL_PREFIX}index.min.json"))
|
|
||||||
.await()
|
|
||||||
} catch (e: Throwable) {
|
|
||||||
logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" }
|
|
||||||
requiresFallbackSource = true
|
|
||||||
null
|
null
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
networkService.client
|
||||||
|
.newCall(GET("${REPO_URL_PREFIX}index.min.json"))
|
||||||
|
.await()
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" }
|
||||||
|
requiresFallbackSource = true
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val response = githubResponse ?: run {
|
val response = githubResponse ?: run {
|
||||||
|
|
|
@ -50,11 +50,13 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
|
||||||
|
|
||||||
when (intent.action) {
|
when (intent.action) {
|
||||||
Intent.ACTION_PACKAGE_ADDED -> {
|
Intent.ACTION_PACKAGE_ADDED -> {
|
||||||
if (!isReplacing(intent)) launchNow {
|
if (!isReplacing(intent)) {
|
||||||
when (val result = getExtensionFromIntent(context, intent)) {
|
launchNow {
|
||||||
is LoadResult.Success -> listener.onExtensionInstalled(result.extension)
|
when (val result = getExtensionFromIntent(context, intent)) {
|
||||||
is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension)
|
is LoadResult.Success -> listener.onExtensionInstalled(result.extension)
|
||||||
else -> {}
|
is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension)
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,9 @@ class UpdatesGridGlanceWidget : GlanceAppWidget() {
|
||||||
.let {
|
.let {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||||
it.transformations(RoundedCornersTransformation(roundPx))
|
it.transformations(RoundedCornersTransformation(roundPx))
|
||||||
} else it // Handled by system
|
} else {
|
||||||
|
it // Handled by system
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.build()
|
.build()
|
||||||
Pair(updatesView.mangaId, app.imageLoader.executeBlocking(request).drawable?.toBitmap())
|
Pair(updatesView.mangaId, app.imageLoader.executeBlocking(request).drawable?.toBitmap())
|
||||||
|
|
|
@ -74,10 +74,12 @@ internal class RateLimitInterceptor(
|
||||||
throw IOException("Canceled")
|
throw IOException("Canceled")
|
||||||
} else if (hasRemovedExpired) {
|
} else if (hasRemovedExpired) {
|
||||||
break
|
break
|
||||||
} else try { // wait for the first entry to expire, or notified by cached response
|
} else {
|
||||||
(requestQueue as Object).wait(requestQueue.first - periodStart)
|
try { // wait for the first entry to expire, or notified by cached response
|
||||||
} catch (_: InterruptedException) {
|
(requestQueue as Object).wait(requestQueue.first - periodStart)
|
||||||
continue
|
} catch (_: InterruptedException) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ private var lockState = LockState.INACTIVE
|
||||||
private enum class LockState {
|
private enum class LockState {
|
||||||
INACTIVE,
|
INACTIVE,
|
||||||
PENDING,
|
PENDING,
|
||||||
ACTIVE
|
ACTIVE,
|
||||||
}
|
}
|
||||||
|
|
||||||
class SecureActivityDelegateImpl : SecureActivityDelegate, DefaultLifecycleObserver {
|
class SecureActivityDelegateImpl : SecureActivityDelegate, DefaultLifecycleObserver {
|
||||||
|
|
|
@ -167,8 +167,11 @@ class SearchPresenter(
|
||||||
val service = enhancedServices
|
val service = enhancedServices
|
||||||
.firstOrNull { it.isTrackFrom(updatedTrack, prevManga, prevSource) }
|
.firstOrNull { it.isTrackFrom(updatedTrack, prevManga, prevSource) }
|
||||||
|
|
||||||
if (service != null) service.migrateTrack(updatedTrack, manga, source)
|
if (service != null) {
|
||||||
else updatedTrack
|
service.migrateTrack(updatedTrack, manga, source)
|
||||||
|
} else {
|
||||||
|
updatedTrack
|
||||||
|
}
|
||||||
}
|
}
|
||||||
insertTrack.awaitAll(tracks)
|
insertTrack.awaitAll(tracks)
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,32 +190,44 @@ class LibraryPresenter(
|
||||||
else -> downloadManager.getDownloadCount(item.manga.toDomainManga()!!) > 0
|
else -> downloadManager.getDownloadCount(item.manga.toDomainManga()!!) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return@downloaded if (downloadedOnly || filterDownloaded == State.INCLUDE.value) isDownloaded
|
return@downloaded if (downloadedOnly || filterDownloaded == State.INCLUDE.value) {
|
||||||
else !isDownloaded
|
isDownloaded
|
||||||
|
} else {
|
||||||
|
!isDownloaded
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val filterFnUnread: (LibraryItem) -> Boolean = unread@{ item ->
|
val filterFnUnread: (LibraryItem) -> Boolean = unread@{ item ->
|
||||||
if (filterUnread == State.IGNORE.value) return@unread true
|
if (filterUnread == State.IGNORE.value) return@unread true
|
||||||
val isUnread = item.manga.unreadCount != 0
|
val isUnread = item.manga.unreadCount != 0
|
||||||
|
|
||||||
return@unread if (filterUnread == State.INCLUDE.value) isUnread
|
return@unread if (filterUnread == State.INCLUDE.value) {
|
||||||
else !isUnread
|
isUnread
|
||||||
|
} else {
|
||||||
|
!isUnread
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val filterFnStarted: (LibraryItem) -> Boolean = started@{ item ->
|
val filterFnStarted: (LibraryItem) -> Boolean = started@{ item ->
|
||||||
if (filterStarted == State.IGNORE.value) return@started true
|
if (filterStarted == State.IGNORE.value) return@started true
|
||||||
val hasStarted = item.manga.hasStarted
|
val hasStarted = item.manga.hasStarted
|
||||||
|
|
||||||
return@started if (filterStarted == State.INCLUDE.value) hasStarted
|
return@started if (filterStarted == State.INCLUDE.value) {
|
||||||
else !hasStarted
|
hasStarted
|
||||||
|
} else {
|
||||||
|
!hasStarted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val filterFnCompleted: (LibraryItem) -> Boolean = completed@{ item ->
|
val filterFnCompleted: (LibraryItem) -> Boolean = completed@{ item ->
|
||||||
if (filterCompleted == State.IGNORE.value) return@completed true
|
if (filterCompleted == State.IGNORE.value) return@completed true
|
||||||
val isCompleted = item.manga.status == SManga.COMPLETED
|
val isCompleted = item.manga.status == SManga.COMPLETED
|
||||||
|
|
||||||
return@completed if (filterCompleted == State.INCLUDE.value) isCompleted
|
return@completed if (filterCompleted == State.INCLUDE.value) {
|
||||||
else !isCompleted
|
isCompleted
|
||||||
|
} else {
|
||||||
|
!isCompleted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val filterFnTracking: (LibraryItem) -> Boolean = tracking@{ item ->
|
val filterFnTracking: (LibraryItem) -> Boolean = tracking@{ item ->
|
||||||
|
|
|
@ -305,7 +305,8 @@ class MangaController : FullComposeController<MangaPresenter> {
|
||||||
previousController.search(query)
|
previousController.search(query)
|
||||||
}
|
}
|
||||||
is UpdatesController,
|
is UpdatesController,
|
||||||
is HistoryController, -> {
|
is HistoryController,
|
||||||
|
-> {
|
||||||
// Manually navigate to LibraryController
|
// Manually navigate to LibraryController
|
||||||
router.handleBack()
|
router.handleBack()
|
||||||
(router.activity as MainActivity).setSelectedNavItem(R.id.nav_library)
|
(router.activity as MainActivity).setSelectedNavItem(R.id.nav_library)
|
||||||
|
|
|
@ -151,7 +151,9 @@ class HttpPageLoader(
|
||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
if (it.status == Page.QUEUE) {
|
if (it.status == Page.QUEUE) {
|
||||||
PriorityPage(it, 0).apply { queue.offer(this) }
|
PriorityPage(it, 0).apply { queue.offer(this) }
|
||||||
} else null
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ enum class OrientationType(val prefValue: Int, val flag: Int, @StringRes val str
|
||||||
REVERSE_PORTRAIT(6, ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, R.string.rotation_reverse_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000030),
|
REVERSE_PORTRAIT(6, ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, R.string.rotation_reverse_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000030),
|
||||||
LANDSCAPE(3, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018),
|
LANDSCAPE(3, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018),
|
||||||
LOCKED_PORTRAIT(4, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, R.string.rotation_force_portrait, R.drawable.ic_screen_lock_portrait_24dp, 0x00000020),
|
LOCKED_PORTRAIT(4, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, R.string.rotation_force_portrait, R.drawable.ic_screen_lock_portrait_24dp, 0x00000020),
|
||||||
LOCKED_LANDSCAPE(5, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, R.string.rotation_force_landscape, R.drawable.ic_screen_lock_landscape_24dp, 0x00000028);
|
LOCKED_LANDSCAPE(5, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, R.string.rotation_force_landscape, R.drawable.ic_screen_lock_landscape_24dp, 0x00000028),
|
||||||
|
;
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val MASK = 0x00000038
|
const val MASK = 0x00000038
|
||||||
|
|
|
@ -171,7 +171,8 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
|
||||||
|
|
||||||
val placeAtIndex = when (viewer) {
|
val placeAtIndex = when (viewer) {
|
||||||
is L2RPagerViewer,
|
is L2RPagerViewer,
|
||||||
is VerticalPagerViewer, -> currentIndex + 1
|
is VerticalPagerViewer,
|
||||||
|
-> currentIndex + 1
|
||||||
else -> currentIndex
|
else -> currentIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,13 @@ private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutin
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCompleted() {
|
override fun onCompleted() {
|
||||||
if (cont.isActive) cont.resumeWithException(
|
if (cont.isActive) {
|
||||||
IllegalStateException(
|
cont.resumeWithException(
|
||||||
"Should have invoked onNext",
|
IllegalStateException(
|
||||||
),
|
"Should have invoked onNext",
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ open class ExtendedNavigationView @JvmOverloads constructor(
|
||||||
enum class State(val value: Int) {
|
enum class State(val value: Int) {
|
||||||
IGNORE(0),
|
IGNORE(0),
|
||||||
INCLUDE(1),
|
INCLUDE(1),
|
||||||
EXCLUDE(2)
|
EXCLUDE(2),
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStateDrawable(context: Context): Drawable? {
|
override fun getStateDrawable(context: Context): Drawable? {
|
||||||
|
|
|
@ -46,7 +46,9 @@ class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: Attr
|
||||||
} else {
|
} else {
|
||||||
event.x > handle.width + ViewCompat.getPaddingStart(handle)
|
event.x > handle.width + ViewCompat.getPaddingStart(handle)
|
||||||
}
|
}
|
||||||
) return false
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
// end
|
// end
|
||||||
|
|
||||||
if (ignoreTouchesOutsideHandle &&
|
if (ignoreTouchesOutsideHandle &&
|
||||||
|
|
|
@ -39,7 +39,9 @@ class TachiyomiChangeHandlerFrameLayout(
|
||||||
behavior.apply {
|
behavior.apply {
|
||||||
shouldHeaderOverlap = overlapHeader
|
shouldHeaderOverlap = overlapHeader
|
||||||
}
|
}
|
||||||
} else null
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
// The behavior doesn't reset translationY when shouldHeaderOverlap is false
|
// The behavior doesn't reset translationY when shouldHeaderOverlap is false
|
||||||
translationY = 0F
|
translationY = 0F
|
||||||
|
|
|
@ -48,7 +48,9 @@ class TachiyomiSearchView @JvmOverloads constructor(
|
||||||
clearFocus()
|
clearFocus()
|
||||||
listener?.onQueryTextSubmit(query.toString())
|
listener?.onQueryTextSubmit(query.toString())
|
||||||
true
|
true
|
||||||
} else false
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ lifecycle_version = "2.5.1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
annotation = "androidx.annotation:annotation:1.4.0"
|
annotation = "androidx.annotation:annotation:1.4.0"
|
||||||
appcompat = "androidx.appcompat:appcompat:1.6.0-beta01"
|
appcompat = "androidx.appcompat:appcompat:1.6.0-rc01"
|
||||||
biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha04"
|
biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha04"
|
||||||
constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
|
constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
|
||||||
coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
|
coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
|
||||||
corektx = "androidx.core:core-ktx:1.8.0"
|
corektx = "androidx.core:core-ktx:1.9.0"
|
||||||
splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02"
|
splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02"
|
||||||
recyclerview = "androidx.recyclerview:recyclerview:1.3.0-beta02"
|
recyclerview = "androidx.recyclerview:recyclerview:1.3.0-beta02"
|
||||||
viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01"
|
viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[versions]
|
[versions]
|
||||||
compiler = "1.3.0-rc02"
|
compiler = "1.3.1"
|
||||||
compose = "1.2.1"
|
compose = "1.2.1"
|
||||||
accompanist = "0.25.1"
|
accompanist = "0.25.1"
|
||||||
material3 = "1.0.0-beta01"
|
material3 = "1.0.0-beta01"
|
||||||
|
|
|
@ -103,5 +103,5 @@ conductor = ["conductor-core", "conductor-support-preference"]
|
||||||
shizuku = ["shizuku-api", "shizuku-provider"]
|
shizuku = ["shizuku-api", "shizuku-provider"]
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
kotlinter = { id = "org.jmailen.kotlinter", version = "3.11.1" }
|
kotlinter = { id = "org.jmailen.kotlinter", version = "3.12.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 a new issue