mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 13:57:10 +09:00
Fix backspace and enter-press detector issues (#147)
* Clearing input filters for enter-press handling * Changed focus timeout for keyboard
This commit is contained in:
parent
e06a6a8f04
commit
892cf663f5
2 changed files with 16 additions and 6 deletions
|
@ -361,8 +361,12 @@ class BlockAdapter(
|
|||
|
||||
if (holder is BlockViewHolder.TextHolder) {
|
||||
holder.enableEnterKeyDetector(
|
||||
onEndLineEnterClicked = { onEndLineEnterClicked(blocks[position].id) },
|
||||
onSplitLineEnterClicked = { onSplitLineEnterClicked(blocks[position].id) }
|
||||
onEndLineEnterClicked = {
|
||||
onEndLineEnterClicked(blocks[position].id)
|
||||
},
|
||||
onSplitLineEnterClicked = {
|
||||
onSplitLineEnterClicked(blocks[position].id)
|
||||
}
|
||||
)
|
||||
holder.enableBackspaceDetector { onEmptyBlockBackspaceClicked(blocks[position].id) }
|
||||
}
|
||||
|
|
|
@ -57,12 +57,18 @@ sealed class BlockViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
|||
onEndLineEnterClicked: () -> Unit,
|
||||
onSplitLineEnterClicked: () -> Unit
|
||||
) {
|
||||
content.filters += DefaultEnterKeyDetector(
|
||||
onSplitLineEnterClicked = onSplitLineEnterClicked,
|
||||
onEndLineEnterClicked = onEndLineEnterClicked
|
||||
content.filters = arrayOf(
|
||||
DefaultEnterKeyDetector(
|
||||
onSplitLineEnterClicked = onSplitLineEnterClicked,
|
||||
onEndLineEnterClicked = onEndLineEnterClicked
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun removeEnterKeyDetectors() {
|
||||
content.filters = arrayOf()
|
||||
}
|
||||
|
||||
fun enableBackspaceDetector(
|
||||
onEmptyBlockBackspaceClicked: () -> Unit
|
||||
) {
|
||||
|
@ -548,6 +554,6 @@ sealed class BlockViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
|||
const val HOLDER_DIVIDER = 16
|
||||
const val HOLDER_HIGHLIGHT = 17
|
||||
|
||||
const val FOCUS_TIMEOUT_MILLIS = 300L
|
||||
const val FOCUS_TIMEOUT_MILLIS = 60L
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue