Skip to content

Commit 5e50fee

Browse files
authored
Merge pull request #194 from Merkost/capitalizing_refactoring
Fixed some wrong capitalizing scenarios
2 parents 97204cb + dfb4382 commit 5e50fee

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import com.simplemobiletools.keyboard.extensions.safeStorageContext
1818
import com.simplemobiletools.keyboard.helpers.*
1919
import com.simplemobiletools.keyboard.interfaces.OnKeyboardActionListener
2020
import com.simplemobiletools.keyboard.views.MyKeyboardView
21-
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.*
21+
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_holder
22+
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_view
2223

2324
// based on https://www.androidauthority.com/lets-build-custom-keyboard-android-832362/
2425
class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, SharedPreferences.OnSharedPreferenceChangeListener {
@@ -67,11 +68,11 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
6768
keyboard = createNewKeyboard()
6869
keyboardView?.setKeyboard(keyboard!!)
6970
keyboardView?.setEditorInfo(attribute)
70-
updateShiftKeyState(null)
71+
updateShiftKeyState()
7172
}
7273

73-
private fun updateShiftKeyState(code: Int?) {
74-
if (code == MyKeyboard.KEYCODE_SHIFT) {
74+
private fun updateShiftKeyState() {
75+
if (keyboard!!.mShiftState == ShiftState.ON_PERMANENT) {
7576
return
7677
}
7778

@@ -181,10 +182,6 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
181182
}
182183
}
183184
}
184-
185-
if (keyboard!!.mShiftState != ShiftState.ON_PERMANENT) {
186-
updateShiftKeyState(code)
187-
}
188185
}
189186

190187
override fun onActionUp() {
@@ -258,6 +255,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
258255
if (newSelStart == newSelEnd) {
259256
keyboardView?.closeClipboardManager()
260257
}
258+
updateShiftKeyState()
261259
}
262260

263261
private fun moveCursor(moveRight: Boolean) {

0 commit comments

Comments
 (0)