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:
parent
149ac4a363
commit
b364ffdeea
@ -1,5 +1,6 @@
|
|||||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
@ -242,7 +243,6 @@ dependencies {
|
|||||||
|
|
||||||
// Image loading
|
// Image loading
|
||||||
implementation(libs.bundles.coil)
|
implementation(libs.bundles.coil)
|
||||||
|
|
||||||
implementation(libs.subsamplingscaleimageview) {
|
implementation(libs.subsamplingscaleimageview) {
|
||||||
exclude(module = "image-decoder")
|
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()) }
|
exclude { it.file.path.contains("generated[\\\\/]".toRegex()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,6 @@ fun ExtensionDetailsScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
|
|
||||||
if (state.extension == null) {
|
if (state.extension == null) {
|
||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
textResource = R.string.empty_screen,
|
textResource = R.string.empty_screen,
|
||||||
|
@ -110,9 +110,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
)
|
)
|
||||||
pager.tapListener = { event ->
|
pager.tapListener = { event ->
|
||||||
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
|
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
|
||||||
val navigator = config.navigator
|
when (config.navigator.getAction(pos)) {
|
||||||
|
|
||||||
when (navigator.getAction(pos)) {
|
|
||||||
NavigationRegion.MENU -> activity.toggleMenu()
|
NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
NavigationRegion.NEXT -> moveToNext()
|
NavigationRegion.NEXT -> moveToNext()
|
||||||
NavigationRegion.PREV -> moveToPrevious()
|
NavigationRegion.PREV -> moveToPrevious()
|
||||||
@ -286,7 +284,6 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
* Sets the active [chapters] on this pager.
|
* Sets the active [chapters] on this pager.
|
||||||
*/
|
*/
|
||||||
private fun setChaptersInternal(chapters: ViewerChapters) {
|
private fun setChaptersInternal(chapters: ViewerChapters) {
|
||||||
logcat { "setChaptersInternal" }
|
|
||||||
val forceTransition = config.alwaysShowChapterTransition || adapter.joinedItems.getOrNull(pager.currentItem)?.first is ChapterTransition
|
val forceTransition = config.alwaysShowChapterTransition || adapter.joinedItems.getOrNull(pager.currentItem)?.first is ChapterTransition
|
||||||
adapter.setChapters(chapters, forceTransition)
|
adapter.setChapters(chapters, forceTransition)
|
||||||
|
|
||||||
@ -303,7 +300,6 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
* Tells this viewer to move to the given [page].
|
* Tells this viewer to move to the given [page].
|
||||||
*/
|
*/
|
||||||
override fun moveToPage(page: ReaderPage) {
|
override fun moveToPage(page: ReaderPage) {
|
||||||
logcat { "moveToPage ${page.number}" }
|
|
||||||
val position = adapter.joinedItems.indexOfFirst { it.first == page || it.second == page }
|
val position = adapter.joinedItems.indexOfFirst { it.first == page || it.second == page }
|
||||||
if (position != -1) {
|
if (position != -1) {
|
||||||
val currentPosition = pager.currentItem
|
val currentPosition = pager.currentItem
|
||||||
|
@ -85,7 +85,7 @@ class WebtoonPageHolder(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscription used to read the header of the image. This is needed in order to instantiate
|
* 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
|
private var readImageHeaderSubscription: Subscription? = null
|
||||||
|
|
||||||
|
@ -53,11 +53,6 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
var tapListener: ((MotionEvent) -> Unit)? = null
|
var tapListener: ((MotionEvent) -> Unit)? = null
|
||||||
var longTapListener: ((MotionEvent) -> Boolean)? = null
|
var longTapListener: ((MotionEvent) -> Boolean)? = null
|
||||||
|
|
||||||
init {
|
|
||||||
isVerticalScrollBarEnabled = false
|
|
||||||
isHorizontalScrollBarEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
|
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
|
||||||
halfWidth = MeasureSpec.getSize(widthSpec) / 2
|
halfWidth = MeasureSpec.getSize(widthSpec) / 2
|
||||||
halfHeight = MeasureSpec.getSize(heightSpec) / 2
|
halfHeight = MeasureSpec.getSize(heightSpec) / 2
|
||||||
@ -241,8 +236,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onLongTapConfirmed(ev: MotionEvent) {
|
override fun onLongTapConfirmed(ev: MotionEvent) {
|
||||||
val listener = longTapListener
|
if (longTapListener?.invoke(ev) == true) {
|
||||||
if (listener != null && listener.invoke(ev)) {
|
|
||||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,9 +120,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
)
|
)
|
||||||
recycler.tapListener = { event ->
|
recycler.tapListener = { event ->
|
||||||
val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height)
|
val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height)
|
||||||
val navigator = config.navigator
|
when (config.navigator.getAction(pos)) {
|
||||||
|
|
||||||
when (navigator.getAction(pos)) {
|
|
||||||
NavigationRegion.MENU -> activity.toggleMenu()
|
NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
||||||
NavigationRegion.PREV, NavigationRegion.LEFT -> scrollUp()
|
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.
|
* Tells this viewer to set the given [chapters] as active.
|
||||||
*/
|
*/
|
||||||
override fun setChapters(chapters: ViewerChapters) {
|
override fun setChapters(chapters: ViewerChapters) {
|
||||||
logcat { "setChapters" }
|
|
||||||
val forceTransition = config.alwaysShowChapterTransition || currentPage is ChapterTransition
|
val forceTransition = config.alwaysShowChapterTransition || currentPage is ChapterTransition
|
||||||
adapter.setChapters(chapters, forceTransition)
|
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].
|
* Tells this viewer to move to the given [page].
|
||||||
*/
|
*/
|
||||||
override fun moveToPage(page: ReaderPage) {
|
override fun moveToPage(page: ReaderPage) {
|
||||||
logcat { "moveToPage" }
|
|
||||||
val position = adapter.items.indexOf(page)
|
val position = adapter.items.indexOf(page)
|
||||||
if (position != -1) {
|
if (position != -1) {
|
||||||
layoutManager.scrollToPositionWithOffset(position, 0)
|
layoutManager.scrollToPositionWithOffset(position, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user