Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Fix doc comment and return values of onTextContextMenuItem
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinesp committed Jan 5, 2024
1 parent 4f2998c commit 3fc6833
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class EditorEditText : AppCompatEditText {
}

/**
* Override cut & paste events so output is redirected to the [inputProcessor].
* Override context menu actions, such as cut & paste so its input is redirected to the [viewModel].
*/
override fun onTextContextMenuItem(id: Int): Boolean {
when (id) {
Expand All @@ -240,9 +240,8 @@ class EditorEditText : AppCompatEditText {
setSelectionFromComposerUpdate(result.selection.first, result.selection.last)
}

return false
return true
}

android.R.id.paste, android.R.id.pasteAsPlainText -> {
val clipBoardManager =
context.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
Expand All @@ -257,17 +256,16 @@ class EditorEditText : AppCompatEditText {
setSelectionFromComposerUpdate(result.selection.first, result.selection.last)
}

return false
return true
}
android.R.id.undo -> {
undo()
return false
return true
}
android.R.id.redo -> {
redo()
return false
return true
}

else -> return super.onTextContextMenuItem(id)
}
}
Expand Down

0 comments on commit 3fc6833

Please sign in to comment.