diff --git a/src/KeePass.sln b/src/KeePass.sln index bc7325c6..e5c04757 100644 --- a/src/KeePass.sln +++ b/src/KeePass.sln @@ -138,6 +138,7 @@ Global {A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU {53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}.Debug|Win32.ActiveCfg = Debug|Any CPU @@ -216,6 +217,7 @@ Global {5CF675A5-9BEE-4720-BED9-D5BF14A2EBF9}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU {48574278-4779-4B3A-A9E4-9CF1BC285D0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48574278-4779-4B3A-A9E4-9CF1BC285D0B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48574278-4779-4B3A-A9E4-9CF1BC285D0B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {48574278-4779-4B3A-A9E4-9CF1BC285D0B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {48574278-4779-4B3A-A9E4-9CF1BC285D0B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {48574278-4779-4B3A-A9E4-9CF1BC285D0B}.Debug|Win32.ActiveCfg = Debug|Any CPU @@ -252,6 +254,7 @@ Global {3C0F7FE5-639F-4422-A087-8B26CF862D1B}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU {70D3844A-D9FA-4A64-B205-A84C6A822196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {70D3844A-D9FA-4A64-B205-A84C6A822196}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70D3844A-D9FA-4A64-B205-A84C6A822196}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {70D3844A-D9FA-4A64-B205-A84C6A822196}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {70D3844A-D9FA-4A64-B205-A84C6A822196}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {70D3844A-D9FA-4A64-B205-A84C6A822196}.Debug|Win32.ActiveCfg = Debug|Any CPU diff --git a/src/Kp2aKeyboardBinding/Kp2aKeyboardBinding.csproj b/src/Kp2aKeyboardBinding/Kp2aKeyboardBinding.csproj index d3e509b5..8d8c5fae 100644 --- a/src/Kp2aKeyboardBinding/Kp2aKeyboardBinding.csproj +++ b/src/Kp2aKeyboardBinding/Kp2aKeyboardBinding.csproj @@ -52,15 +52,9 @@ - - project.zip + + Jars\app-debug.aar - - libs\armeabi-v7a\libjni_latinime.so - - - libs\armeabi\libjni_latinime.so - @@ -69,6 +63,8 @@ - + + + \ No newline at end of file diff --git a/src/java/KP2ASoftKeyboard/project.zip b/src/java/KP2ASoftKeyboard/project.zip deleted file mode 100644 index a29e7d43..00000000 Binary files a/src/java/KP2ASoftKeyboard/project.zip and /dev/null differ diff --git a/src/java/KP2ASoftKeyboard2/java/gen/keepass2android/softkeyboard/BuildConfig.java b/src/java/KP2ASoftKeyboard2/java/gen/keepass2android/softkeyboard/BuildConfig.java index 7048a099..80eada24 100644 --- a/src/java/KP2ASoftKeyboard2/java/gen/keepass2android/softkeyboard/BuildConfig.java +++ b/src/java/KP2ASoftKeyboard2/java/gen/keepass2android/softkeyboard/BuildConfig.java @@ -1,6 +1,8 @@ -/** Automatically generated file. DO NOT MODIFY */ +/*___Generated_by_IDEA___*/ + package keepass2android.softkeyboard; +/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */ public final class BuildConfig { - public final static boolean DEBUG = true; + public final static boolean DEBUG = Boolean.parseBoolean(null); } \ No newline at end of file diff --git a/src/java/KP2ASoftKeyboard2/java/libs/mips/libjni_latinime.so b/src/java/KP2ASoftKeyboard2/java/libs/mips/libjni_latinime.so deleted file mode 100644 index 87fddde6..00000000 Binary files a/src/java/KP2ASoftKeyboard2/java/libs/mips/libjni_latinime.so and /dev/null differ diff --git a/src/java/KP2ASoftKeyboard2/java/project.zip b/src/java/KP2ASoftKeyboard2/java/project.zip deleted file mode 100644 index 158d8576..00000000 Binary files a/src/java/KP2ASoftKeyboard2/java/project.zip and /dev/null differ diff --git a/src/java/KP2ASoftKeyboard2/native/libs/mips/libjni_latinime.so b/src/java/KP2ASoftKeyboard2/native/libs/mips/libjni_latinime.so deleted file mode 100644 index 87fddde6..00000000 Binary files a/src/java/KP2ASoftKeyboard2/native/libs/mips/libjni_latinime.so and /dev/null differ diff --git a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/cache.properties.lock index 6b3f09e9..94b02216 100644 Binary files a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/cache.properties.lock and b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/cache.properties.lock differ diff --git a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileHashes.bin index d7797471..ff714fc7 100644 Binary files a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileHashes.bin and b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileHashes.bin differ diff --git a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin index b5aac01a..7b9ef049 100644 Binary files a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin and b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin differ diff --git a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/outputFileStates.bin b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/outputFileStates.bin index 95cbdb0a..d320d644 100644 Binary files a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/outputFileStates.bin and b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/outputFileStates.bin differ diff --git a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin index 7074d5ee..be55e640 100644 Binary files a/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin and b/src/java/KP2ASoftkeyboard_AS/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin differ diff --git a/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml b/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml index 6946705a..0fc24cac 100644 --- a/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml +++ b/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml @@ -1,5 +1,10 @@ + + + + + @@ -29,103 +34,175 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - + + - - + + + + + + + + @@ -1414,9 +1497,10 @@ - @@ -1441,21 +1525,7 @@ - - - - - - - - - - - + @@ -1502,7 +1572,11 @@ @@ -1520,22 +1594,78 @@ - + + + + + + + + + + + @@ -1714,32 +1844,32 @@ - - + + + - - + + - + - + - @@ -1757,7 +1887,9 @@ - + + @@ -1785,6 +1917,24 @@ + + + + + + + + + + + + + + + + + + @@ -1825,6 +1975,22 @@ + + + + + + + + + + + + + + + + @@ -1833,6 +1999,14 @@ + + + + + + + + @@ -1849,6 +2023,22 @@ + + + + + + + + + + + + + + + + @@ -1857,20 +2047,23 @@ - + - - - - - - - + + - + + + + + + + + + @@ -1888,11 +2081,190 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/kbbridge/Loc.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/kbbridge/Loc.java new file mode 100644 index 00000000..7c986bfa --- /dev/null +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/kbbridge/Loc.java @@ -0,0 +1,29 @@ +package keepass2android.kbbridge; + +import java.text.Collator; +import java.util.Locale; + +/** + * Created by Philipp on 16.01.2016. + */ + +public class Loc implements Comparable { + static Collator sCollator = Collator.getInstance(); + + public String label; + public Locale locale; + + public Loc(String label, Locale locale) { + this.label = label; + this.locale = locale; + } + + @Override + public String toString() { + return this.label; + } + + public int compareTo(Object o) { + return sCollator.compare(this.label, ((Loc) o).label); + } +} diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/kbbridge/LocaleHelper.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/kbbridge/LocaleHelper.java new file mode 100644 index 00000000..98184c6e --- /dev/null +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/kbbridge/LocaleHelper.java @@ -0,0 +1,109 @@ +package keepass2android.kbbridge; + +import android.content.Context; + +import java.text.Collator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +import keepass2android.softkeyboard.LanguageSwitcher; + + +public class LocaleHelper +{ + public boolean x() + { + return true; + } + + + private static final String[] WHITELIST_LANGUAGES = { + "cs", "da", "de", "en", "en_GB", "en_US", "es", "es_US", "fr", "it", "nb", "nl", "pl", "pt", + "ru", "tr" + }; + + private static final String[] WEAK_WHITELIST_LANGUAGES = { + "cs", "da", "de", "en_GB", "en_US", "es", "es_US", "fr", "it", "nb", "nl", "pl", "pt", + "ru", "tr", "en" + }; + + private static boolean isWhitelisted(String lang, boolean strict) { + for (String s : (strict? WHITELIST_LANGUAGES : WEAK_WHITELIST_LANGUAGES)) { + if (s.equalsIgnoreCase(lang)) { + return true; + } + if ((!strict) && (s.length()==2) && lang.toLowerCase(Locale.US).startsWith(s)) + { + return true; + } + } + return false; + } + + + public static ArrayList getUniqueLocales(Context ctx, boolean strict) { + String[] locales = ctx.getAssets().getLocales(); + Arrays.sort(locales); + ArrayList uniqueLocales = new ArrayList(); + + android.util.Log.d("KP2AK", "getUniqueLocales"); + final int origSize = locales.length; + Loc[] preprocess = new Loc[origSize]; + int finalSize = 0; + for (int i = 0 ; i < origSize; i++ ) { + String s = locales[i]; + + int len = s.length(); + final Locale l; + final String language; + if (len == 5) { + language = s.substring(0, 2); + String country = s.substring(3, 5); + l = new Locale(language, country); + } else if (len == 2) { + language = s; + l = new Locale(language); + } else { + android.util.Log.d("KP2AK", "locale "+s+" has unexpected length."); + continue; + } + // Exclude languages that are not relevant to LatinIME + if (!isWhitelisted(s, strict)) + { + android.util.Log.d("KP2AK", "locale "+s+" is not white-listed " + (strict ? " s " : "w")); + continue; + } + + android.util.Log.d("KP2AK", "adding locale "+s); + if (finalSize == 0) { + preprocess[finalSize++] = + new Loc(LanguageSwitcher.toTitleCase(l.getDisplayName(l), l), l); + } else { + // check previous entry: + // same lang and a country -> upgrade to full name and + // insert ours with full name + // diff lang -> insert ours with lang-only name + if (preprocess[finalSize-1].locale.getLanguage().equals( + language)) { + preprocess[finalSize-1].label = LanguageSwitcher.toTitleCase( + preprocess[finalSize-1].locale.getDisplayName(), + preprocess[finalSize-1].locale); + preprocess[finalSize++] = + new Loc(LanguageSwitcher.toTitleCase(l.getDisplayName(), l), l); + } else { + String displayName; + if (s.equals("zz_ZZ")) { + } else { + displayName = LanguageSwitcher.toTitleCase(l.getDisplayName(l), l); + preprocess[finalSize++] = new Loc(displayName, l); + } + } + } + } + for (int i = 0; i < finalSize ; i++) { + uniqueLocales.add(preprocess[i]); + } + return uniqueLocales; + } +} diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/InputLanguageSelection.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/InputLanguageSelection.java index 66cb46f0..adb3c744 100644 --- a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/InputLanguageSelection.java +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/InputLanguageSelection.java @@ -38,51 +38,8 @@ import java.util.Locale; public class InputLanguageSelection extends PreferenceActivity { private String mSelectedLanguages; - private ArrayList mAvailableLanguages = new ArrayList(); + private ArrayList mAvailableLanguages = new ArrayList(); - private static final String[] WHITELIST_LANGUAGES = { - "cs", "da", "de", "en_GB", "en_US", "es", "es_US", "fr", "it", "nb", "nl", "pl", "pt", - "ru", "tr" - }; - - private static final String[] WEAK_WHITELIST_LANGUAGES = { - "cs", "da", "de", "en_GB", "en_US", "es", "es_US", "fr", "it", "nb", "nl", "pl", "pt", - "ru", "tr", "en" - }; - - private static boolean isWhitelisted(String lang, boolean strict) { - for (String s : (strict? WHITELIST_LANGUAGES : WEAK_WHITELIST_LANGUAGES)) { - if (s.equalsIgnoreCase(lang)) { - return true; - } - if ((!strict) && (s.length()==2) && lang.toLowerCase(Locale.US).startsWith(s)) - { - return true; - } - } - return false; - } - - private static class Loc implements Comparable { - static Collator sCollator = Collator.getInstance(); - - String label; - Locale locale; - - public Loc(String label, Locale locale) { - this.label = label; - this.locale = locale; - } - - @Override - public String toString() { - return this.label; - } - - public int compareTo(Object o) { - return sCollator.compare(this.label, ((Loc) o).label); - } - } @Override protected void onCreate(Bundle icicle) { @@ -184,67 +141,9 @@ public class InputLanguageSelection extends PreferenceActivity { SharedPreferencesCompat.apply(editor); } - ArrayList getUniqueLocales(boolean strict) { - String[] locales = getAssets().getLocales(); - Arrays.sort(locales); - ArrayList uniqueLocales = new ArrayList(); - - final int origSize = locales.length; - Loc[] preprocess = new Loc[origSize]; - int finalSize = 0; - for (int i = 0 ; i < origSize; i++ ) { - String s = locales[i]; - - int len = s.length(); - final Locale l; - final String language; - if (len == 5) { - language = s.substring(0, 2); - String country = s.substring(3, 5); - l = new Locale(language, country); - } else if (len == 2) { - language = s; - l = new Locale(language); - } else { - android.util.Log.d("KP2AK", "locale "+s+" has unexpected length."); - continue; - } - // Exclude languages that are not relevant to LatinIME - if (!isWhitelisted(s, strict)) - { - android.util.Log.d("KP2AK", "locale "+s+" is not white-listed"); - continue; - } - - android.util.Log.d("KP2AK", "adding locale "+s); - if (finalSize == 0) { - preprocess[finalSize++] = - new Loc(LanguageSwitcher.toTitleCase(l.getDisplayName(l), l), l); - } else { - // check previous entry: - // same lang and a country -> upgrade to full name and - // insert ours with full name - // diff lang -> insert ours with lang-only name - if (preprocess[finalSize-1].locale.getLanguage().equals( - language)) { - preprocess[finalSize-1].label = LanguageSwitcher.toTitleCase( - preprocess[finalSize-1].locale.getDisplayName(), - preprocess[finalSize-1].locale); - preprocess[finalSize++] = - new Loc(LanguageSwitcher.toTitleCase(l.getDisplayName(), l), l); - } else { - String displayName; - if (s.equals("zz_ZZ")) { - } else { - displayName = LanguageSwitcher.toTitleCase(l.getDisplayName(l), l); - preprocess[finalSize++] = new Loc(displayName, l); - } - } - } - } - for (int i = 0; i < finalSize ; i++) { - uniqueLocales.add(preprocess[i]); - } - return uniqueLocales; + ArrayList getUniqueLocales(boolean strict) { + return keepass2android.kbbridge.LocaleHelper.getUniqueLocales(this, strict); } + + } diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java index a0a5dfde..9f042ee3 100644 --- a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java @@ -989,7 +989,7 @@ public class KP2AKeyboard extends InputMethodService @Override public void setCandidatesViewShown(boolean shown) { - setCandidatesViewShownInternal(shown, true /* needsInputViewShown */ ); + setCandidatesViewShownInternal(shown, true /* needsInputViewShown */); } @Override @@ -1689,7 +1689,7 @@ public class KP2AKeyboard extends InputMethodService } postUpdateSuggestions(); } else { - sendKeyChar((char)primaryCode); + sendKeyChar((char) primaryCode); } updateShiftKeyState(getCurrentInputEditorInfo()); if (KP2AKeyboard.PERF_DEBUG) measureCps(); @@ -1815,12 +1815,13 @@ public class KP2AKeyboard extends InputMethodService public void run() { mRecognizing = false; if (mKeyboardSwitcher.getInputView() != null) { - setInputView(mKeyboardSwitcher.getInputView()); + setInputView(mKeyboardSwitcher.getInputView()); } setCandidatesViewShown(true); updateInputViewShown(); postUpdateSuggestions(); - }}); + } + }); } private void clearSuggestions() { @@ -2234,7 +2235,7 @@ public class KP2AKeyboard extends InputMethodService public boolean isWordSeparator(int code) { String separators = getWordSeparators(); - return separators.contains(String.valueOf((char)code)); + return separators.contains(String.valueOf((char) code)); } private boolean isSentenceSeparator(int code) { @@ -2460,32 +2461,54 @@ public class KP2AKeyboard extends InputMethodService startActivity(intent); } - private void loadSettings() { - // Get the settings preferences - SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); - mVibrateOn = sp.getBoolean(PREF_VIBRATE_ON, false); - mSoundOn = sp.getBoolean(PREF_SOUND_ON, false); - mPopupOn = sp.getBoolean(PREF_POPUP_ON, - mResources.getBoolean(R.bool.default_popup_preview)); - mAutoCap = sp.getBoolean(PREF_AUTO_CAP, true); - mQuickFixes = sp.getBoolean(PREF_QUICK_FIXES, true); - - mKp2aAutoFillOn = sp.getBoolean("kp2a_auto_fill", true); - mKp2aRememberAutoFill = sp.getBoolean(PREF_KP2A_REMEMBER_AUTO_FILL, true); - mKp2aEnableSimpleKeyboard = sp.getBoolean("kp2a_simple_keyboard", true); - mKp2aSwitchKeyboardOnSendGoDone = sp.getBoolean("kp2a_switch_on_sendgodone", false); - mKp2aLockOnSendGoDone = sp.getBoolean("kp2a_lock_on_sendgodone", false); - - - mShowSuggestions = sp.getBoolean(PREF_SHOW_SUGGESTIONS, true); + private void loadSettings() + { + try { + // Get the settings preferences + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); + mVibrateOn = sp.getBoolean(PREF_VIBRATE_ON, false); + mSoundOn = sp.getBoolean(PREF_SOUND_ON, false); + mPopupOn = sp.getBoolean(PREF_POPUP_ON, + mResources.getBoolean(R.bool.default_popup_preview)); + mAutoCap = sp.getBoolean(PREF_AUTO_CAP, true); + mQuickFixes = sp.getBoolean(PREF_QUICK_FIXES, true); - mAutoCorrectEnabled = sp.getBoolean(PREF_AUTO_COMPLETE, - mResources.getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions; - //mBigramSuggestionEnabled = sp.getBoolean( - // PREF_BIGRAM_SUGGESTIONS, true) & mShowSuggestions; - updateCorrectionMode(); - updateAutoTextEnabled(mResources.getConfiguration().locale); - mLanguageSwitcher.loadLocales(sp); + mKp2aAutoFillOn = sp.getBoolean("kp2a_auto_fill", true); + mKp2aRememberAutoFill = sp.getBoolean(PREF_KP2A_REMEMBER_AUTO_FILL, true); + mKp2aEnableSimpleKeyboard = sp.getBoolean("kp2a_simple_keyboard", true); + mKp2aSwitchKeyboardOnSendGoDone = sp.getBoolean("kp2a_switch_on_sendgodone", false); + mKp2aLockOnSendGoDone = sp.getBoolean("kp2a_lock_on_sendgodone", false); + + + mShowSuggestions = sp.getBoolean(PREF_SHOW_SUGGESTIONS, true); + + mAutoCorrectEnabled = sp.getBoolean(PREF_AUTO_COMPLETE, + mResources.getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions; + //mBigramSuggestionEnabled = sp.getBoolean( + // PREF_BIGRAM_SUGGESTIONS, true) & mShowSuggestions; + updateCorrectionMode(); + updateAutoTextEnabled(mResources.getConfiguration().locale); + mLanguageSwitcher.loadLocales(sp); + } + catch (Exception e) + { + android.util.Log.d("KP2AK", e.toString()); + //in a very special case loading the settings might fail. revert to defaults then. + /*this case occurs on some Samsung devices when an external Bluetooth Keyboard is connected + the code is then run from a different user id. + */ + mQuickFixes = true; + + mKp2aAutoFillOn = true; + mKp2aRememberAutoFill = true; + mKp2aEnableSimpleKeyboard = true; + + mShowSuggestions = true; + + mAutoCorrectEnabled = mResources.getBoolean(R.bool.enable_autocorrect) & mShowSuggestions; + updateCorrectionMode(); + updateAutoTextEnabled(mResources.getConfiguration().locale); + } } private void initSuggestPuncList() { diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java index afed1204..dd35caef 100644 --- a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java @@ -575,7 +575,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } private void updateSettingsKeyState(SharedPreferences prefs) { - Resources resources = mInputMethodService.getResources(); + /*Resources resources = mInputMethodService.getResources(); final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY, resources.getString(DEFAULT_SETTINGS_KEY_MODE)); // We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or @@ -586,6 +586,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha mHasSettingsKey = true; } else { mHasSettingsKey = false; - } + }*/ + mHasSettingsKey = true; } } diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/LanguageSwitcher.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/LanguageSwitcher.java index 844b7c4c..6b8d0b4f 100644 --- a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/LanguageSwitcher.java +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/softkeyboard/LanguageSwitcher.java @@ -191,7 +191,7 @@ public class LanguageSwitcher { SharedPreferencesCompat.apply(editor); } - static String toTitleCase(String s, Locale locale) { + public static String toTitleCase(String s, Locale locale) { if (s.length() == 0) { return s; } diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/jniLibs/mips/libjni_latinime.so b/src/java/KP2ASoftkeyboard_AS/app/src/main/jniLibs/mips/libjni_latinime.so deleted file mode 100644 index 87fddde6..00000000 Binary files a/src/java/KP2ASoftkeyboard_AS/app/src/main/jniLibs/mips/libjni_latinime.so and /dev/null differ