Minor cleanup

This commit is contained in:
arkon 2022-12-17 12:02:01 -05:00
parent 235bc77457
commit 0e2bdb7863
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")
@ -245,7 +246,6 @@ dependencies {
// Image loading
implementation(libs.bundles.coil)
implementation(libs.subsamplingscaleimageview) {
exclude(module = "image-decoder")
}
@ -310,7 +310,7 @@ tasks {
}
}
withType<org.jmailen.gradle.kotlinter.tasks.LintTask>().configureEach {
withType<LintTask>().configureEach {
exclude { it.file.path.contains("generated[\\\\/]".toRegex()) }
}

View File

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

View File

@ -105,9 +105,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()
@ -274,7 +272,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.items.getOrNull(pager.currentItem) is ChapterTransition
adapter.setChapters(chapters, forceTransition)
@ -291,7 +288,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.items.indexOf(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

@ -40,11 +40,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
@ -226,8 +221,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

@ -119,9 +119,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()
@ -245,7 +243,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)
@ -261,7 +258,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)