Skip to content

Commit 47f02b1

Browse files
committed
fix #18, adding an english QWERTZ keyboard layout
1 parent 9c5cf0b commit 47f02b1

File tree

6 files changed

+157
-15
lines changed

6 files changed

+157
-15
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/activities/SettingsActivity.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import com.simplemobiletools.commons.extensions.*
88
import com.simplemobiletools.commons.models.RadioItem
99
import com.simplemobiletools.keyboard.R
1010
import com.simplemobiletools.keyboard.extensions.config
11-
import com.simplemobiletools.keyboard.helpers.LANGUAGE_ENGLISH
11+
import com.simplemobiletools.keyboard.helpers.LANGUAGE_ENGLISH_QWERTY
12+
import com.simplemobiletools.keyboard.helpers.LANGUAGE_ENGLISH_QWERTZ
1213
import com.simplemobiletools.keyboard.helpers.LANGUAGE_FRENCH
1314
import com.simplemobiletools.keyboard.helpers.LANGUAGE_RUSSIAN
1415
import kotlinx.android.synthetic.main.activity_settings.*
@@ -109,26 +110,28 @@ class SettingsActivity : SimpleActivity() {
109110
}
110111

111112
private fun setupKeyboardLanguage() {
112-
settings_keyboard_language.text = getKeyboardLanguageText()
113+
settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
113114
settings_keyboard_language_holder.setOnClickListener {
114115
val items = arrayListOf(
115-
RadioItem(LANGUAGE_ENGLISH, getString(R.string.translation_english)),
116-
RadioItem(LANGUAGE_FRENCH, getString(R.string.translation_french)),
117-
RadioItem(LANGUAGE_RUSSIAN, getString(R.string.translation_russian))
116+
RadioItem(LANGUAGE_ENGLISH_QWERTY, getKeyboardLanguageText(LANGUAGE_ENGLISH_QWERTY)),
117+
RadioItem(LANGUAGE_ENGLISH_QWERTZ, getKeyboardLanguageText(LANGUAGE_ENGLISH_QWERTZ)),
118+
RadioItem(LANGUAGE_FRENCH, getKeyboardLanguageText(LANGUAGE_FRENCH)),
119+
RadioItem(LANGUAGE_RUSSIAN, getKeyboardLanguageText(LANGUAGE_RUSSIAN))
118120
)
119121

120122
RadioGroupDialog(this@SettingsActivity, items, config.keyboardLanguage) {
121123
config.keyboardLanguage = it as Int
122-
settings_keyboard_language.text = getKeyboardLanguageText()
124+
settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
123125
}
124126
}
125127
}
126128

127-
private fun getKeyboardLanguageText() = getString(
128-
when (config.keyboardLanguage) {
129-
LANGUAGE_FRENCH -> R.string.translation_french
130-
LANGUAGE_RUSSIAN -> R.string.translation_russian
131-
else -> R.string.translation_english
129+
private fun getKeyboardLanguageText(language: Int): String {
130+
return when (language) {
131+
LANGUAGE_FRENCH -> getString(R.string.translation_french)
132+
LANGUAGE_RUSSIAN -> getString(R.string.translation_russian)
133+
LANGUAGE_ENGLISH_QWERTZ -> "${getString(R.string.translation_english)} (QWERTZ)"
134+
else -> "${getString(R.string.translation_english)} (QWERTY)"
132135
}
133-
)
136+
}
134137
}

app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Config(context: Context) : BaseConfig(context) {
3030
return if (conf.locale.toString().toLowerCase(Locale.getDefault()).startsWith("ru_")) {
3131
LANGUAGE_RUSSIAN
3232
} else {
33-
LANGUAGE_ENGLISH
33+
LANGUAGE_ENGLISH_QWERTY
3434
}
3535
}
3636
}

app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Constants.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const val KEYBOARD_LANGUAGE = "keyboard_language"
1717
const val ITEM_SECTION_LABEL = 0
1818
const val ITEM_CLIP = 1
1919

20-
const val LANGUAGE_ENGLISH = 0
20+
const val LANGUAGE_ENGLISH_QWERTY = 0
2121
const val LANGUAGE_RUSSIAN = 1
2222
const val LANGUAGE_FRENCH = 2
23+
const val LANGUAGE_ENGLISH_QWERTZ = 3

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
245245
return when (baseContext.config.keyboardLanguage) {
246246
LANGUAGE_FRENCH -> R.xml.keys_letters_french
247247
LANGUAGE_RUSSIAN -> R.xml.keys_letters_russian
248-
else -> R.xml.keys_letters_english
248+
LANGUAGE_ENGLISH_QWERTZ -> R.xml.keys_letters_english_qwertz
249+
else -> R.xml.keys_letters_english_qwerty
249250
}
250251
}
251252
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Keyboard xmlns:app="http://schemas.android.com/apk/res-auto">
3+
<Row>
4+
<Key
5+
app:keyEdgeFlags="left"
6+
app:keyLabel="q"
7+
app:popupCharacters="1"
8+
app:popupKeyboard="@xml/keyboard_popup_template"
9+
app:topSmallNumber="1" />
10+
<Key
11+
app:keyLabel="w"
12+
app:popupCharacters="2"
13+
app:popupKeyboard="@xml/keyboard_popup_template"
14+
app:topSmallNumber="2" />
15+
<Key
16+
app:keyLabel="e"
17+
app:popupCharacters="éè3êëēę"
18+
app:popupKeyboard="@xml/keyboard_popup_template"
19+
app:topSmallNumber="3" />
20+
<Key
21+
app:keyLabel="r"
22+
app:popupCharacters="ř4ŕ"
23+
app:popupKeyboard="@xml/keyboard_popup_template"
24+
app:topSmallNumber="4" />
25+
<Key
26+
app:keyLabel="t"
27+
app:popupCharacters=""
28+
app:popupKeyboard="@xml/keyboard_popup_template"
29+
app:topSmallNumber="5" />
30+
<Key
31+
app:keyLabel="z"
32+
app:popupCharacters="ź6žż"
33+
app:popupKeyboard="@xml/keyboard_popup_template"
34+
app:topSmallNumber="6" />
35+
<Key
36+
app:keyLabel="u"
37+
app:popupCharacters="űúù7ûüū"
38+
app:popupKeyboard="@xml/keyboard_popup_template"
39+
app:topSmallNumber="7" />
40+
<Key
41+
app:keyLabel="i"
42+
app:popupCharacters="íìî8ïī"
43+
app:popupKeyboard="@xml/keyboard_popup_template"
44+
app:topSmallNumber="8" />
45+
<Key
46+
app:keyLabel="o"
47+
app:popupCharacters="őöóôòõ9ō"
48+
app:popupKeyboard="@xml/keyboard_popup_template"
49+
app:topSmallNumber="9" />
50+
<Key
51+
app:keyEdgeFlags="right"
52+
app:keyLabel="p"
53+
app:popupCharacters="0"
54+
app:popupKeyboard="@xml/keyboard_popup_template"
55+
app:topSmallNumber="0" />
56+
</Row>
57+
<Row>
58+
<Key
59+
app:horizontalGap="5%"
60+
app:keyEdgeFlags="left"
61+
app:keyLabel="a"
62+
app:popupCharacters="áàâãäåāæą"
63+
app:popupKeyboard="@xml/keyboard_popup_template" />
64+
<Key
65+
app:keyLabel="s"
66+
app:popupCharacters="śßš"
67+
app:popupKeyboard="@xml/keyboard_popup_template" />
68+
<Key
69+
app:keyLabel="d"
70+
app:popupCharacters="ďđ"
71+
app:popupKeyboard="@xml/keyboard_popup_template" />
72+
<Key
73+
app:keyLabel="f"
74+
app:popupCharacters=""
75+
app:popupKeyboard="@xml/keyboard_popup_template" />
76+
<Key app:keyLabel="g" />
77+
<Key app:keyLabel="h" />
78+
<Key app:keyLabel="j" />
79+
<Key app:keyLabel="k" />
80+
<Key
81+
app:keyEdgeFlags="right"
82+
app:keyLabel="l"
83+
app:popupCharacters="ĺľł"
84+
app:popupKeyboard="@xml/keyboard_popup_template" />
85+
</Row>
86+
<Row>
87+
<Key
88+
app:code="-1"
89+
app:keyEdgeFlags="left"
90+
app:keyIcon="@drawable/ic_caps_outline_vector"
91+
app:keyWidth="15%p" />
92+
<Key
93+
app:keyLabel="y"
94+
app:popupCharacters="ýÿ¥"
95+
app:popupKeyboard="@xml/keyboard_popup_template" />
96+
<Key app:keyLabel="x" />
97+
<Key
98+
app:keyLabel="c"
99+
app:popupCharacters="çčć¢"
100+
app:popupKeyboard="@xml/keyboard_popup_template" />
101+
<Key app:keyLabel="v" />
102+
<Key app:keyLabel="b" />
103+
<Key
104+
app:keyLabel="n"
105+
app:popupCharacters="ňńñ"
106+
app:popupKeyboard="@xml/keyboard_popup_template" />
107+
<Key app:keyLabel="m" />
108+
<Key
109+
app:code="-5"
110+
app:isRepeatable="true"
111+
app:keyEdgeFlags="right"
112+
app:keyIcon="@drawable/ic_clear_vector"
113+
app:keyWidth="15%p" />
114+
</Row>
115+
<Row>
116+
<Key
117+
app:code="-2"
118+
app:keyEdgeFlags="left"
119+
app:keyLabel="123"
120+
app:keyWidth="15%p" />
121+
<Key
122+
app:keyLabel=","
123+
app:keyWidth="10%p" />
124+
<Key
125+
app:code="32"
126+
app:isRepeatable="true"
127+
app:keyWidth="50%p" />
128+
<Key
129+
app:keyLabel="."
130+
app:keyWidth="10%p" />
131+
<Key
132+
app:code="-4"
133+
app:keyEdgeFlags="right"
134+
app:keyIcon="@drawable/ic_enter_vector"
135+
app:keyWidth="15%p" />
136+
</Row>
137+
</Keyboard>

0 commit comments

Comments
 (0)