mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 13:57:10 +09:00
editor adapter hypertext click fix
This commit is contained in:
parent
6fa5894a47
commit
1ceb679a88
2 changed files with 11 additions and 13 deletions
|
@ -249,9 +249,11 @@ class EditorAdapter(
|
|||
class BulletHolder(itemView: View) : ViewHolder(itemView) {
|
||||
|
||||
fun bind(block: BlockView, clickListener: (BlockView) -> Unit) = with(block) {
|
||||
itemView.tvContent.text = SpannableString(content.text).withBulletSpan(gapWidth = 40, start = 0)
|
||||
itemView.tvContent.text =
|
||||
SpannableString(content.text).withBulletSpan(gapWidth = 40, start = 0)
|
||||
.addMarks(marks = content.marks, textView = itemView.tvContent,
|
||||
click = {})
|
||||
click = {Timber.d("Hey Hey I got bullet click : $it")}, itemView = itemView
|
||||
)
|
||||
itemView.setOnClickListener { clickListener(this) }
|
||||
}
|
||||
}
|
||||
|
@ -262,8 +264,9 @@ class EditorAdapter(
|
|||
itemView.positionText.text = "${param.number}."
|
||||
if (marks.isNotEmpty()) {
|
||||
itemView.contentText.text = SpannableString(text)
|
||||
.addMarks(marks = marks, textView = itemView.positionText,
|
||||
click = {})
|
||||
.addMarks(marks = marks, textView = itemView.contentText,
|
||||
click = {Timber.d("Hey Hey I got numbered click : $it") }, itemView = itemView
|
||||
)
|
||||
} else {
|
||||
itemView.contentText.text = text
|
||||
}
|
||||
|
@ -277,16 +280,12 @@ class EditorAdapter(
|
|||
.addMarks(
|
||||
marks = marks,
|
||||
textView = tvContent,
|
||||
click = { Timber.d("Hey Hey I got click : $it") })
|
||||
click = { Timber.d("Hey Hey I got click : $it") },
|
||||
itemView = itemView
|
||||
)
|
||||
} else {
|
||||
tvContent.text = content
|
||||
}
|
||||
|
||||
fun getBulletContentSpannable(text: CharSequence, gapWidth: Int, start: Int) =
|
||||
SpannableString(text).withBulletSpan(gapWidth, start)
|
||||
.apply {
|
||||
setSpan(BulletSpan(gapWidth), start, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue