mirror of
				https://github.com/SimpleMobileTools/Simple-Keyboard.git
				synced 2025-06-05 21:49:26 +02:00 
			
		
		
		
	fix #18, adding an english QWERTZ keyboard layout
This commit is contained in:
		@@ -8,7 +8,8 @@ import com.simplemobiletools.commons.extensions.*
 | 
			
		||||
import com.simplemobiletools.commons.models.RadioItem
 | 
			
		||||
import com.simplemobiletools.keyboard.R
 | 
			
		||||
import com.simplemobiletools.keyboard.extensions.config
 | 
			
		||||
import com.simplemobiletools.keyboard.helpers.LANGUAGE_ENGLISH
 | 
			
		||||
import com.simplemobiletools.keyboard.helpers.LANGUAGE_ENGLISH_QWERTY
 | 
			
		||||
import com.simplemobiletools.keyboard.helpers.LANGUAGE_ENGLISH_QWERTZ
 | 
			
		||||
import com.simplemobiletools.keyboard.helpers.LANGUAGE_FRENCH
 | 
			
		||||
import com.simplemobiletools.keyboard.helpers.LANGUAGE_RUSSIAN
 | 
			
		||||
import kotlinx.android.synthetic.main.activity_settings.*
 | 
			
		||||
@@ -109,26 +110,28 @@ class SettingsActivity : SimpleActivity() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun setupKeyboardLanguage() {
 | 
			
		||||
        settings_keyboard_language.text = getKeyboardLanguageText()
 | 
			
		||||
        settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
 | 
			
		||||
        settings_keyboard_language_holder.setOnClickListener {
 | 
			
		||||
            val items = arrayListOf(
 | 
			
		||||
                RadioItem(LANGUAGE_ENGLISH, getString(R.string.translation_english)),
 | 
			
		||||
                RadioItem(LANGUAGE_FRENCH, getString(R.string.translation_french)),
 | 
			
		||||
                RadioItem(LANGUAGE_RUSSIAN, getString(R.string.translation_russian))
 | 
			
		||||
                RadioItem(LANGUAGE_ENGLISH_QWERTY, getKeyboardLanguageText(LANGUAGE_ENGLISH_QWERTY)),
 | 
			
		||||
                RadioItem(LANGUAGE_ENGLISH_QWERTZ, getKeyboardLanguageText(LANGUAGE_ENGLISH_QWERTZ)),
 | 
			
		||||
                RadioItem(LANGUAGE_FRENCH, getKeyboardLanguageText(LANGUAGE_FRENCH)),
 | 
			
		||||
                RadioItem(LANGUAGE_RUSSIAN, getKeyboardLanguageText(LANGUAGE_RUSSIAN))
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
            RadioGroupDialog(this@SettingsActivity, items, config.keyboardLanguage) {
 | 
			
		||||
                config.keyboardLanguage = it as Int
 | 
			
		||||
                settings_keyboard_language.text = getKeyboardLanguageText()
 | 
			
		||||
                settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun getKeyboardLanguageText() = getString(
 | 
			
		||||
        when (config.keyboardLanguage) {
 | 
			
		||||
            LANGUAGE_FRENCH -> R.string.translation_french
 | 
			
		||||
            LANGUAGE_RUSSIAN -> R.string.translation_russian
 | 
			
		||||
            else -> R.string.translation_english
 | 
			
		||||
    private fun getKeyboardLanguageText(language: Int): String {
 | 
			
		||||
        return when (language) {
 | 
			
		||||
            LANGUAGE_FRENCH -> getString(R.string.translation_french)
 | 
			
		||||
            LANGUAGE_RUSSIAN -> getString(R.string.translation_russian)
 | 
			
		||||
            LANGUAGE_ENGLISH_QWERTZ -> "${getString(R.string.translation_english)} (QWERTZ)"
 | 
			
		||||
            else -> "${getString(R.string.translation_english)} (QWERTY)"
 | 
			
		||||
        }
 | 
			
		||||
    )
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ class Config(context: Context) : BaseConfig(context) {
 | 
			
		||||
        return if (conf.locale.toString().toLowerCase(Locale.getDefault()).startsWith("ru_")) {
 | 
			
		||||
            LANGUAGE_RUSSIAN
 | 
			
		||||
        } else {
 | 
			
		||||
            LANGUAGE_ENGLISH
 | 
			
		||||
            LANGUAGE_ENGLISH_QWERTY
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,7 @@ const val KEYBOARD_LANGUAGE = "keyboard_language"
 | 
			
		||||
const val ITEM_SECTION_LABEL = 0
 | 
			
		||||
const val ITEM_CLIP = 1
 | 
			
		||||
 | 
			
		||||
const val LANGUAGE_ENGLISH = 0
 | 
			
		||||
const val LANGUAGE_ENGLISH_QWERTY = 0
 | 
			
		||||
const val LANGUAGE_RUSSIAN = 1
 | 
			
		||||
const val LANGUAGE_FRENCH = 2
 | 
			
		||||
const val LANGUAGE_ENGLISH_QWERTZ = 3
 | 
			
		||||
 
 | 
			
		||||
@@ -245,7 +245,8 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
 | 
			
		||||
        return when (baseContext.config.keyboardLanguage) {
 | 
			
		||||
            LANGUAGE_FRENCH -> R.xml.keys_letters_french
 | 
			
		||||
            LANGUAGE_RUSSIAN -> R.xml.keys_letters_russian
 | 
			
		||||
            else -> R.xml.keys_letters_english
 | 
			
		||||
            LANGUAGE_ENGLISH_QWERTZ -> R.xml.keys_letters_english_qwertz
 | 
			
		||||
            else -> R.xml.keys_letters_english_qwerty
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										137
									
								
								app/src/main/res/xml/keys_letters_english_qwertz.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								app/src/main/res/xml/keys_letters_english_qwertz.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,137 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<Keyboard xmlns:app="http://schemas.android.com/apk/res-auto">
 | 
			
		||||
    <Row>
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyLabel="q"
 | 
			
		||||
            app:popupCharacters="1"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="1" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="w"
 | 
			
		||||
            app:popupCharacters="2"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="2" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="e"
 | 
			
		||||
            app:popupCharacters="éè3êëēę"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="3" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="r"
 | 
			
		||||
            app:popupCharacters="ř4ŕ"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="4" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="t"
 | 
			
		||||
            app:popupCharacters="5ť"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="5" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="z"
 | 
			
		||||
            app:popupCharacters="ź6žż"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="6" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="u"
 | 
			
		||||
            app:popupCharacters="űúù7ûüū"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="7" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="i"
 | 
			
		||||
            app:popupCharacters="íìî8ïī"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="8" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="o"
 | 
			
		||||
            app:popupCharacters="őöóôòõ9ō"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="9" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyLabel="p"
 | 
			
		||||
            app:popupCharacters="0"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template"
 | 
			
		||||
            app:topSmallNumber="0" />
 | 
			
		||||
    </Row>
 | 
			
		||||
    <Row>
 | 
			
		||||
        <Key
 | 
			
		||||
            app:horizontalGap="5%"
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyLabel="a"
 | 
			
		||||
            app:popupCharacters="áàâãäåāæą"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="s"
 | 
			
		||||
            app:popupCharacters="śßš"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="d"
 | 
			
		||||
            app:popupCharacters="ďđ"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="f"
 | 
			
		||||
            app:popupCharacters="₣"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key app:keyLabel="g" />
 | 
			
		||||
        <Key app:keyLabel="h" />
 | 
			
		||||
        <Key app:keyLabel="j" />
 | 
			
		||||
        <Key app:keyLabel="k" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyLabel="l"
 | 
			
		||||
            app:popupCharacters="ĺľł"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
    </Row>
 | 
			
		||||
    <Row>
 | 
			
		||||
        <Key
 | 
			
		||||
            app:code="-1"
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyIcon="@drawable/ic_caps_outline_vector"
 | 
			
		||||
            app:keyWidth="15%p" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="y"
 | 
			
		||||
            app:popupCharacters="ýÿ¥"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key app:keyLabel="x" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="c"
 | 
			
		||||
            app:popupCharacters="çčć¢"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key app:keyLabel="v" />
 | 
			
		||||
        <Key app:keyLabel="b" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="n"
 | 
			
		||||
            app:popupCharacters="ňńñ"
 | 
			
		||||
            app:popupKeyboard="@xml/keyboard_popup_template" />
 | 
			
		||||
        <Key app:keyLabel="m" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:code="-5"
 | 
			
		||||
            app:isRepeatable="true"
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyIcon="@drawable/ic_clear_vector"
 | 
			
		||||
            app:keyWidth="15%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="50%p" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:keyLabel="."
 | 
			
		||||
            app:keyWidth="10%p" />
 | 
			
		||||
        <Key
 | 
			
		||||
            app:code="-4"
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyIcon="@drawable/ic_enter_vector"
 | 
			
		||||
            app:keyWidth="15%p" />
 | 
			
		||||
    </Row>
 | 
			
		||||
</Keyboard>
 | 
			
		||||
		Reference in New Issue
	
	Block a user