|
|
@ -19,8 +19,10 @@ import io.legado.app.ui.book.read.page.entities.TextPos |
|
|
|
import io.legado.app.ui.book.read.page.provider.ChapterProvider |
|
|
|
import io.legado.app.ui.book.read.page.provider.ChapterProvider |
|
|
|
import io.legado.app.ui.book.read.page.provider.ImageProvider |
|
|
|
import io.legado.app.ui.book.read.page.provider.ImageProvider |
|
|
|
import io.legado.app.ui.book.read.page.provider.TextPageFactory |
|
|
|
import io.legado.app.ui.book.read.page.provider.TextPageFactory |
|
|
|
import io.legado.app.ui.widget.dialog.PhotoDialog |
|
|
|
import io.legado.app.utils.activity |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
|
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
|
|
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
import kotlin.math.min |
|
|
|
import kotlin.math.min |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -217,16 +219,16 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
* 长按 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun longPress( |
|
|
|
fun longPress( |
|
|
|
x: Float, |
|
|
|
x: Float, |
|
|
|
y: Float, |
|
|
|
y: Float, |
|
|
|
select: (relativePage: Int, lineIndex: Int, charIndex: Int) -> Unit, |
|
|
|
select: (relativePage: Int, lineIndex: Int, charIndex: Int) -> Unit, |
|
|
|
) { |
|
|
|
) { |
|
|
|
touch(x, y) { _, relativePos, textPage, lineIndex, _, charIndex, textChar -> |
|
|
|
touch(x, y) { _, relativePos, _, lineIndex, _, charIndex, textChar -> |
|
|
|
if (textChar.isImage) { |
|
|
|
if (textChar.isImage) { |
|
|
|
activity?.showDialogFragment(PhotoDialog(textPage.chapterIndex, textChar.charData)) |
|
|
|
callBack.onImageLongPress(textChar.charData) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!selectAble) return@touch |
|
|
|
if (!selectAble) return@touch |
|
|
|
textChar.selected = true |
|
|
|
textChar.selected = true |
|
|
@ -459,12 +461,13 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
interface CallBack { |
|
|
|
fun upSelectedStart(x: Float, y: Float, top: Float) |
|
|
|
|
|
|
|
fun upSelectedEnd(x: Float, y: Float) |
|
|
|
|
|
|
|
fun onCancelSelect() |
|
|
|
|
|
|
|
val headerHeight: Int |
|
|
|
val headerHeight: Int |
|
|
|
val pageFactory: TextPageFactory |
|
|
|
val pageFactory: TextPageFactory |
|
|
|
val isScroll: Boolean |
|
|
|
val isScroll: Boolean |
|
|
|
var isSelectingSearchResult: Boolean |
|
|
|
var isSelectingSearchResult: Boolean |
|
|
|
|
|
|
|
fun upSelectedStart(x: Float, y: Float, top: Float) |
|
|
|
|
|
|
|
fun upSelectedEnd(x: Float, y: Float) |
|
|
|
|
|
|
|
fun onCancelSelect() |
|
|
|
|
|
|
|
fun onImageLongPress(src: String) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|