adding a russian keyboard
This commit is contained in:
parent
c4c2431894
commit
0bad827830
|
@ -19,4 +19,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var lastExportedClipsFolder: String
|
||||
get() = prefs.getString(LAST_EXPORTED_CLIPS_FOLDER, "")!!
|
||||
set(lastExportedClipsFolder) = prefs.edit().putString(LAST_EXPORTED_CLIPS_FOLDER, lastExportedClipsFolder).apply()
|
||||
|
||||
var keyboardLanguage: String
|
||||
get() = prefs.getString(KEYBOARD_LANGUAGE, "en")!!
|
||||
set(keyboardLanguage) = prefs.edit().putString(KEYBOARD_LANGUAGE, keyboardLanguage).apply()
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ const val MAX_KEYS_PER_MINI_ROW = 8
|
|||
const val VIBRATE_ON_KEYPRESS = "vibrate_on_keypress"
|
||||
const val SHOW_POPUP_ON_KEYPRESS = "show_popup_on_keypress"
|
||||
const val LAST_EXPORTED_CLIPS_FOLDER = "last_exported_clips_folder"
|
||||
const val KEYBOARD_LANGUAGE = "keyboard_language"
|
||||
|
||||
// differentiate current and pinned clips at the keyboards' Clipboard section
|
||||
const val ITEM_SECTION_LABEL = 0
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.view.inputmethod.EditorInfo
|
|||
import android.view.inputmethod.EditorInfo.IME_ACTION_NONE
|
||||
import android.view.inputmethod.ExtractedTextRequest
|
||||
import com.simplemobiletools.keyboard.R
|
||||
import com.simplemobiletools.keyboard.extensions.config
|
||||
import com.simplemobiletools.keyboard.helpers.MyKeyboard
|
||||
import com.simplemobiletools.keyboard.helpers.SHIFT_OFF
|
||||
import com.simplemobiletools.keyboard.helpers.SHIFT_ON_ONE_CHAR
|
||||
|
@ -33,7 +34,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
|||
|
||||
override fun onInitializeInterface() {
|
||||
super.onInitializeInterface()
|
||||
keyboard = MyKeyboard(this, R.xml.keys_letters_english, enterKeyType)
|
||||
keyboard = MyKeyboard(this, getKeyboardLayoutXML(), enterKeyType)
|
||||
}
|
||||
|
||||
override fun onCreateInputView(): View {
|
||||
|
@ -63,7 +64,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
|||
}
|
||||
else -> {
|
||||
keyboardMode = KEYBOARD_LETTERS
|
||||
R.xml.keys_letters_english
|
||||
getKeyboardLayoutXML()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +138,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
|||
R.xml.keys_symbols
|
||||
} else {
|
||||
keyboardMode = KEYBOARD_LETTERS
|
||||
R.xml.keys_letters_english
|
||||
getKeyboardLayoutXML()
|
||||
}
|
||||
keyboard = MyKeyboard(this, keyboardXml, enterKeyType)
|
||||
keyboardView!!.setKeyboard(keyboard!!)
|
||||
|
@ -175,7 +176,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
|||
override fun onActionUp() {
|
||||
if (switchToLetters) {
|
||||
keyboardMode = KEYBOARD_LETTERS
|
||||
keyboard = MyKeyboard(this, R.xml.keys_letters_english, enterKeyType)
|
||||
keyboard = MyKeyboard(this, getKeyboardLayoutXML(), enterKeyType)
|
||||
|
||||
val editorInfo = currentInputEditorInfo
|
||||
if (editorInfo != null && editorInfo.inputType != InputType.TYPE_NULL && keyboard?.mShiftState != SHIFT_ON_PERMANENT) {
|
||||
|
@ -212,4 +213,11 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
|||
|
||||
currentInputConnection?.setSelection(newCursorPosition, newCursorPosition)
|
||||
}
|
||||
|
||||
private fun getKeyboardLayoutXML(): Int {
|
||||
return when (baseContext.config.keyboardLanguage) {
|
||||
"ru" -> R.xml.keys_letters_russian
|
||||
else -> R.xml.keys_letters_english
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Keyboard xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<Row>
|
||||
<Key
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyLabel="й"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="1"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="1" />
|
||||
<Key
|
||||
app:keyLabel="ц"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="2"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="2" />
|
||||
<Key
|
||||
app:keyLabel="у"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="3"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="3" />
|
||||
<Key
|
||||
app:keyLabel="к"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="4"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="4" />
|
||||
<Key
|
||||
app:keyLabel="е"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="5"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="5" />
|
||||
<Key
|
||||
app:keyLabel="н"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="6"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="6" />
|
||||
<Key
|
||||
app:keyLabel="г"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="7"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="7" />
|
||||
<Key
|
||||
app:keyLabel="ш"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="8"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="8" />
|
||||
<Key
|
||||
app:keyLabel="щ"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="9"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="9" />
|
||||
<Key
|
||||
app:keyLabel="з"
|
||||
app:keyWidth="9.05%p"
|
||||
app:popupCharacters="0"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="0" />
|
||||
<Key
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyLabel="х"
|
||||
app:keyWidth="9.05%p" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyLabel="ф"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="ы"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="в"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="а"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="п"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="р"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="о"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="л"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="д"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyLabel="ж"
|
||||
app:keyWidth="9.05%p" />
|
||||
<Key
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyLabel="э"
|
||||
app:keyWidth="9.05%p" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key
|
||||
app:code="-1"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_caps_outline_vector"
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:keyLabel="я"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="ч"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="с"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="м"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="и"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="т"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="ь"
|
||||
app:keyWidth="8.8%p"
|
||||
app:popupCharacters="ъ"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key
|
||||
app:keyLabel="б"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:keyLabel="ю"
|
||||
app:keyWidth="8.8%p" />
|
||||
<Key
|
||||
app:code="-5"
|
||||
app:isRepeatable="true"
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyIcon="@drawable/ic_clear_vector"
|
||||
app:keyWidth="10%p" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key
|
||||
app:code="-2"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyLabel="123"
|
||||
app:keyWidth="15%p" />
|
||||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="45%p" />
|
||||
<Key app:keyLabel="." />
|
||||
<Key
|
||||
app:code="-4"
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyIcon="@drawable/ic_enter_vector"
|
||||
app:keyWidth="20%p" />
|
||||
</Row>
|
||||
</Keyboard>
|
Loading…
Reference in New Issue