diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 843f60d11..ecb7df170 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -16,9 +16,7 @@ import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.lib.theme.ATH import io.legado.app.ui.book.read.Help -import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.utils.postEvent -import kotlinx.android.synthetic.main.activity_book_read.* class MoreConfigDialog : DialogFragment() { private val readPreferTag = "readPreferenceFragment" @@ -97,12 +95,6 @@ class MoreConfigDialog : DialogFragment() { PreferKey.hideStatusBar -> postEvent(EventBus.UP_CONFIG, true) PreferKey.hideNavigationBar -> postEvent(EventBus.UP_CONFIG, true) PreferKey.keepLight -> postEvent(PreferKey.keepLight, true) - PreferKey.selectText -> { - val activity = activity - if (activity is ReadBookActivity) { - activity.page_view.upSelectAble() - } - } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index 315c8ddbd..867341e82 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -99,7 +99,6 @@ class PageView(context: Context, attrs: AttributeSet) : 3 -> ScrollPageDelegate(this) else -> NoAnimPageDelegate(this) } - pageDelegate?.upSelectAble() upContent() } @@ -175,10 +174,6 @@ class PageView(context: Context, attrs: AttributeSet) : nextPage.upBattery(battery) } - fun upSelectAble() { - pageDelegate?.upSelectAble() - } - override val isScrollDelegate: Boolean get() = pageDelegate is ScrollPageDelegate diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt index 45c42f077..f129d41ff 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt @@ -1,9 +1,7 @@ package io.legado.app.ui.book.read.page.delegate import android.view.MotionEvent -import io.legado.app.constant.PreferKey import io.legado.app.ui.book.read.page.PageView -import io.legado.app.utils.getPrefBoolean import kotlin.math.abs abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageView) { @@ -15,9 +13,6 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie distanceY: Float ): Boolean { if (!isMoved) { - val event = e1.toAction(MotionEvent.ACTION_UP) - curPage.dispatchTouchEvent(event) - event.recycle() if (abs(distanceX) > abs(distanceY)) { if (distanceX < 0) { //如果上一页不存在 @@ -48,13 +43,4 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie return isMoved } - override fun upSelectAble() { - pageView.curPage.contentTextView()?.apply { - if (context.getPrefBoolean(PreferKey.selectText)) { -// setTextIsSelectable(true) - } else { -// setTextIsSelectable(false) - } - } - } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt index 0f2f283ed..ed32732aa 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt @@ -185,20 +185,8 @@ abstract class PageDelegate(protected val pageView: PageView) { @CallSuper open fun onTouch(event: MotionEvent): Boolean { if (isStarted) return false - if (curPage.isTextSelected()) { - curPage.dispatchTouchEvent(event) - return true - } - if (event.action == MotionEvent.ACTION_DOWN) { - curPage.let { - it.contentTextView()?.let { contentTextView -> - // atTop = contentTextView.atTop() -// atBottom = contentTextView.atBottom() - } - it.dispatchTouchEvent(event) - } - } else if (event.action == MotionEvent.ACTION_UP) { - curPage.dispatchTouchEvent(event) + curPage.dispatchTouchEvent(event) + if (event.action == MotionEvent.ACTION_UP) { if (isMoved) { // 开启翻页效果 if (!noNext) onScrollStart() @@ -208,8 +196,6 @@ abstract class PageDelegate(protected val pageView: PageView) { return detector.onTouchEvent(event) } - abstract fun upSelectAble() - abstract fun onScrollStart()//scroller start abstract fun onDraw(canvas: Canvas)//绘制 diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt index 814d6427e..7565e6223 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt @@ -3,9 +3,7 @@ package io.legado.app.ui.book.read.page.delegate import android.graphics.Canvas import android.graphics.Matrix import android.view.MotionEvent -import io.legado.app.constant.PreferKey import io.legado.app.ui.book.read.page.PageView -import io.legado.app.utils.getPrefBoolean import kotlin.math.abs class ScrollPageDelegate(pageView: PageView) : PageDelegate(pageView) { @@ -118,14 +116,4 @@ class ScrollPageDelegate(pageView: PageView) : PageDelegate(pageView) { return isMoved } - override fun upSelectAble() { - pageView.curPage.contentTextView()?.apply { - if (context.getPrefBoolean(PreferKey.selectText)) { -// setTextIsSelectable(true) - } else { -// setTextIsSelectable(false) -// movementMethod = ScrollingMovementMethod.getInstance() - } - } - } } \ No newline at end of file