mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 23:18:17 +03:00
Minor cleanup
This commit is contained in:
parent
235bc77457
commit
0e2bdb7863
6 changed files with 6 additions and 21 deletions
|
@ -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")
|
||||||
|
@ -245,7 +246,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")
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,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()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,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,
|
||||||
|
|
|
@ -105,9 +105,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()
|
||||||
|
@ -274,7 +272,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.items.getOrNull(pager.currentItem) is ChapterTransition
|
val forceTransition = config.alwaysShowChapterTransition || adapter.items.getOrNull(pager.currentItem) is ChapterTransition
|
||||||
adapter.setChapters(chapters, forceTransition)
|
adapter.setChapters(chapters, forceTransition)
|
||||||
|
|
||||||
|
@ -291,7 +288,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.items.indexOf(page)
|
val position = adapter.items.indexOf(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
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,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
|
||||||
|
@ -226,8 +221,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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,9 +119,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()
|
||||||
|
@ -245,7 +243,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)
|
||||||
|
|
||||||
|
@ -261,7 +258,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…
Reference in a new issue