Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class AbbrevKeyboardView : KeyboardView, KeyboardView.OnKeyboardActionListener {
// repeatable
Keyboard.KEYCODE_DELETE -> {
if (!isCapsLocked) isShifted = false
if (!mService.handleBackspace()) mService.keyDownUp(KeyEvent.KEYCODE_DEL)
if (!mService.handleBackspace()) mService.pressDel()
}
// codes[0] 以外
Keyboard.KEYCODE_CAPSLOCK -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ class FlickJPKeyboardView(context: Context, attrs: AttributeSet?) : KeyboardView
override fun onLongPress(key: Keyboard.Key): Boolean {
val code = key.codes[0]
if (code == KEYCODE_FLICK_JP_ENTER) {
mService.keyDownUp(KeyEvent.KEYCODE_SEARCH)
mService.pressSearch()
return true
}

Expand Down Expand Up @@ -911,7 +911,7 @@ class FlickJPKeyboardView(context: Context, attrs: AttributeSet?) : KeyboardView
when (primaryCode) {
// repeatable
Keyboard.KEYCODE_DELETE -> if (!mService.handleBackspace()) {
mService.keyDownUp(KeyEvent.KEYCODE_DEL)
mService.pressDel()
}

KEYCODE_FLICK_JP_LEFT -> if (!mArrowFlicked && !mService.handleDpad(KeyEvent.KEYCODE_DPAD_LEFT)) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/jp/deadend/noname/skk/GodanKeyboardView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class GodanKeyboardView(context: Context, attrs: AttributeSet?) : KeyboardView(c
override fun onLongPress(key: Keyboard.Key): Boolean {
val code = key.codes[0]
if (code == KEYCODE_GODAN_ENTER) {
mService.keyDownUp(KeyEvent.KEYCODE_SEARCH)
mService.pressSearch()
return true
}

Expand Down Expand Up @@ -625,7 +625,7 @@ class GodanKeyboardView(context: Context, attrs: AttributeSet?) : KeyboardView(c
// repeatable
Keyboard.KEYCODE_DELETE -> if (!mService.handleBackspace()) {
if (!isCapsLocked) isShifted = false
mService.keyDownUp(KeyEvent.KEYCODE_DEL)
mService.pressDel()
}

KEYCODE_GODAN_LEFT -> if (!mArrowFlicked && !mService.handleDpad(KeyEvent.KEYCODE_DPAD_LEFT)) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/jp/deadend/noname/skk/QwertyKeyboardView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class QwertyKeyboardView : KeyboardView, KeyboardView.OnKeyboardActionListener {

override fun onLongPress(key: Keyboard.Key): Boolean {
if (key.codes[0] == KEYCODE_QWERTY_ENTER) {
mService.keyDownUp(KeyEvent.KEYCODE_SEARCH)
mService.pressSearch()
return true
}

Expand Down Expand Up @@ -120,7 +120,7 @@ class QwertyKeyboardView : KeyboardView, KeyboardView.OnKeyboardActionListener {
// repeatable
Keyboard.KEYCODE_DELETE -> {
if (!isCapsLocked) isShifted = false
if (!mService.handleBackspace()) mService.keyDownUp(KeyEvent.KEYCODE_DEL)
if (!mService.handleBackspace()) mService.pressDel()
}
// codes[0] 以外
Keyboard.KEYCODE_CAPSLOCK -> {
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/jp/deadend/noname/skk/SKKService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,18 @@ class SKKService : InputMethodService() {
updateSuggestionsASCII()
}

fun pressDel() {
val ic = currentInputConnection ?: return
ic.deleteSurroundingText(1, 0)
updateSuggestionsASCII()
}

fun pressSearch() {
val ic = currentInputConnection ?: return
ic.performEditorAction(EditorInfo.IME_ACTION_SEARCH)
updateSuggestionsASCII()
}

fun pressEnter() {
val ic = currentInputConnection ?: return
val editorInfo = currentInputEditorInfo
Expand Down
Loading