Minor cleanup

(cherry picked from commit 0e2bdb7863c25f6f980e59c09d95d4687bf112d5)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt
This commit is contained in:
arkon 2022-12-17 12:02:01 -05:00 committed by Jobobby04
parent 149ac4a363
commit b364ffdeea
6 changed files with 6 additions and 21 deletions

View File

@ -1,5 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jmailen.gradle.kotlinter.tasks.LintTask
plugins {
id("com.android.application")
@ -242,7 +243,6 @@ dependencies {
// Image loading
implementation(libs.bundles.coil)
implementation(libs.subsamplingscaleimageview) {
exclude(module = "image-decoder")
}
@ -322,7 +322,7 @@ tasks {
}
}
withType<org.jmailen.gradle.kotlinter.tasks.LintTask>().configureEach {
withType<LintTask>().configureEach {
exclude { it.file.path.contains("generated[\\\\/]".toRegex()) }
}

View File

@ -123,7 +123,6 @@ fun ExtensionDetailsScreen(
)
},
) { paddingValues ->
if (state.extension == null) {
EmptyScreen(
textResource = R.string.empty_screen,

View File

@ -110,9 +110,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
)
pager.tapListener = { event ->
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
val navigator = config.navigator
when (navigator.getAction(pos)) {
when (config.navigator.getAction(pos)) {
NavigationRegion.MENU -> activity.toggleMenu()
NavigationRegion.NEXT -> moveToNext()
NavigationRegion.PREV -> moveToPrevious()
@ -286,7 +284,6 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
* Sets the active [chapters] on this pager.
*/
private fun setChaptersInternal(chapters: ViewerChapters) {
logcat { "setChaptersInternal" }
val forceTransition = config.alwaysShowChapterTransition || adapter.joinedItems.getOrNull(pager.currentItem)?.first is ChapterTransition
adapter.setChapters(chapters, forceTransition)
@ -303,7 +300,6 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
* Tells this viewer to move to the given [page].
*/
override fun moveToPage(page: ReaderPage) {
logcat { "moveToPage ${page.number}" }
val position = adapter.joinedItems.indexOfFirst { it.first == page || it.second == page }
if (position != -1) {
val currentPosition = pager.currentItem

View File

@ -85,7 +85,7 @@ class WebtoonPageHolder(
/**
* Subscription used to read the header of the image. This is needed in order to instantiate
* the appropiate image view depending if the image is animated (GIF).
* the appropriate image view depending if the image is animated (GIF).
*/
private var readImageHeaderSubscription: Subscription? = null

View File

@ -53,11 +53,6 @@ class WebtoonRecyclerView @JvmOverloads constructor(
var tapListener: ((MotionEvent) -> Unit)? = null
var longTapListener: ((MotionEvent) -> Boolean)? = null
init {
isVerticalScrollBarEnabled = false
isHorizontalScrollBarEnabled = false
}
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
halfWidth = MeasureSpec.getSize(widthSpec) / 2
halfHeight = MeasureSpec.getSize(heightSpec) / 2
@ -241,8 +236,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
}
override fun onLongTapConfirmed(ev: MotionEvent) {
val listener = longTapListener
if (listener != null && listener.invoke(ev)) {
if (longTapListener?.invoke(ev) == true) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
}
}

View File

@ -120,9 +120,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
)
recycler.tapListener = { event ->
val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height)
val navigator = config.navigator
when (navigator.getAction(pos)) {
when (config.navigator.getAction(pos)) {
NavigationRegion.MENU -> activity.toggleMenu()
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
NavigationRegion.PREV, NavigationRegion.LEFT -> scrollUp()
@ -252,7 +250,6 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
* Tells this viewer to set the given [chapters] as active.
*/
override fun setChapters(chapters: ViewerChapters) {
logcat { "setChapters" }
val forceTransition = config.alwaysShowChapterTransition || currentPage is ChapterTransition
adapter.setChapters(chapters, forceTransition)
@ -268,7 +265,6 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
* Tells this viewer to move to the given [page].
*/
override fun moveToPage(page: ReaderPage) {
logcat { "moveToPage" }
val position = adapter.items.indexOf(page)
if (position != -1) {
layoutManager.scrollToPositionWithOffset(position, 0)