More crash fixes
This commit is contained in:
parent
6cf84256fe
commit
4a6e2a5d99
@ -172,14 +172,16 @@ abstract class PagerReader : BaseReader() {
|
|||||||
protected fun createGestureDetector(): GestureDetector {
|
protected fun createGestureDetector(): GestureDetector {
|
||||||
return GestureDetector(activity, object : GestureDetector.SimpleOnGestureListener() {
|
return GestureDetector(activity, object : GestureDetector.SimpleOnGestureListener() {
|
||||||
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||||
val positionX = e.x
|
if (isAdded) {
|
||||||
|
val positionX = e.x
|
||||||
|
|
||||||
if (positionX < pager.width * LEFT_REGION) {
|
if (positionX < pager.width * LEFT_REGION) {
|
||||||
if (tappingEnabled) onLeftSideTap()
|
if (tappingEnabled) onLeftSideTap()
|
||||||
} else if (positionX > pager.width * RIGHT_REGION) {
|
} else if (positionX > pager.width * RIGHT_REGION) {
|
||||||
if (tappingEnabled) onRightSideTap()
|
if (tappingEnabled) onRightSideTap()
|
||||||
} else {
|
} else {
|
||||||
readerActivity.toggleMenu()
|
readerActivity.toggleMenu()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -127,14 +127,16 @@ class WebtoonReader : BaseReader() {
|
|||||||
protected fun createGestureDetector(): GestureDetector {
|
protected fun createGestureDetector(): GestureDetector {
|
||||||
return GestureDetector(context, object : SimpleOnGestureListener() {
|
return GestureDetector(context, object : SimpleOnGestureListener() {
|
||||||
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||||
val positionX = e.x
|
if (isAdded) {
|
||||||
|
val positionX = e.x
|
||||||
|
|
||||||
if (positionX < recycler.width * LEFT_REGION) {
|
if (positionX < recycler.width * LEFT_REGION) {
|
||||||
if (tappingEnabled) moveToPrevious()
|
if (tappingEnabled) moveToPrevious()
|
||||||
} else if (positionX > recycler.width * RIGHT_REGION) {
|
} else if (positionX > recycler.width * RIGHT_REGION) {
|
||||||
if (tappingEnabled) moveToNext()
|
if (tappingEnabled) moveToNext()
|
||||||
} else {
|
} else {
|
||||||
readerActivity.toggleMenu()
|
readerActivity.toggleMenu()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user