* don't crash when loading keyboard settings fails

* added "en" to white-list
* always show settings key
This commit is contained in:
Philipp Crocoll 2016-01-17 21:01:22 +01:00
parent bc0659957f
commit 0f46f18ca5
20 changed files with 677 additions and 243 deletions

View File

@ -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

View File

@ -52,15 +52,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<LibraryProjectZip Include="..\java\KP2ASoftKeyboard2\java\project.zip">
<Link>project.zip</Link>
<LibraryProjectZip Include="..\java\KP2ASoftkeyboard_AS\app\build\outputs\aar\app-debug.aar">
<Link>Jars\app-debug.aar</Link>
</LibraryProjectZip>
<EmbeddedNativeLibrary Include="..\java\KP2ASoftKeyboard2\native\libs\armeabi-v7a\libjni_latinime.so">
<Link>libs\armeabi-v7a\libjni_latinime.so</Link>
</EmbeddedNativeLibrary>
<EmbeddedNativeLibrary Include="..\java\KP2ASoftKeyboard2\native\libs\armeabi\libjni_latinime.so">
<Link>libs\armeabi\libjni_latinime.so</Link>
</EmbeddedNativeLibrary>
<None Include="Additions\AboutAdditions.txt" />
<None Include="Jars\AboutJars.txt" />
</ItemGroup>
@ -69,6 +63,8 @@
<TransformFile Include="Transforms\EnumMethods.xml" />
<TransformFile Include="Transforms\Metadata.xml" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="libs\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Xamarin.Android.Bindings.targets" />
</Project>

View File

@ -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);
}

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidLayouts">
<shared>
<config />
</shared>
</component>
<component name="ChangeListManager">
<list default="true" id="d4fa0d1a-5b1d-4c4c-9674-0eb896f6d066" name="Default" comment="" />
<ignored path="java.iws" />
@ -29,103 +34,175 @@
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="import-summary.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/import-summary.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.gradle" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="15" column="0" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.gradle" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.71428573">
<caret line="15" column="9" selection-start-line="15" selection-start-column="9" selection-end-line="15" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="LatinKeyboardBaseView.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardBaseView.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="436" column="65" selection-start-line="436" selection-start-column="65" selection-end-line="436" selection-end-column="65" />
<caret line="1234" column="25" selection-start-line="1234" selection-start-column="25" selection-end-line="1234" selection-end-column="25" />
<folding>
<element signature="e#18750#18803#0" expanded="true" />
<element signature="e#18834#18886#0" expanded="true" />
<element signature="e#19642#19697#0" expanded="true" />
<element signature="e#22092#22144#0" expanded="true" />
<element signature="method#LatinKeyboardBaseView#1;class#LatinKeyboardBaseView#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="attrs.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/attrs.xml">
<file leaf-file-name="KP2AKeyboard.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="25" column="20" selection-start-line="25" selection-start-column="20" selection-end-line="25" selection-end-column="20" />
<caret line="2465" column="13" selection-start-line="2465" selection-start-column="13" selection-end-line="2465" selection-end-column="13" />
<folding>
<element signature="e#17350#17396#0" expanded="true" />
<element signature="e#17428#17478#0" expanded="true" />
<element signature="e#39322#39384#0" expanded="true" />
<element signature="e#51293#51294#0" expanded="true" />
<element signature="e#51354#51355#0" expanded="true" />
<element signature="e#53061#53091#0" expanded="true" />
<element signature="e#53167#53199#0" expanded="true" />
<element signature="e#53556#53613#0" expanded="true" />
<element signature="e#59864#59865#0" expanded="true" />
<element signature="e#59905#59906#0" expanded="true" />
<element signature="e#59939#59940#0" expanded="true" />
<element signature="e#59981#59982#0" expanded="true" />
<element signature="e#67589#67590#0" expanded="true" />
<element signature="e#67625#67626#0" expanded="true" />
<element signature="e#67674#67675#0" expanded="true" />
<element signature="e#67733#67734#0" expanded="true" />
<element signature="e#68330#68331#0" expanded="true" />
<element signature="e#68387#68388#0" expanded="true" />
<element signature="e#81359#81360#0" expanded="true" />
<element signature="e#81428#81429#0" expanded="true" />
<element signature="e#85149#85150#0" expanded="true" />
<element signature="e#85187#85188#0" expanded="true" />
<element signature="e#85712#85713#0" expanded="true" />
<element signature="e#85765#85766#0" expanded="true" />
<element signature="e#87861#87862#0" expanded="true" />
<element signature="e#87890#87891#0" expanded="true" />
<element signature="e#91923#91924#0" expanded="true" />
<element signature="e#91951#91952#0" expanded="true" />
<element signature="e#91993#91994#0" expanded="true" />
<element signature="e#92024#92025#0" expanded="true" />
<element signature="e#93068#93069#0" expanded="true" />
<element signature="e#93122#93123#0" expanded="true" />
<element signature="e#93163#93164#0" expanded="true" />
<element signature="e#93222#93223#0" expanded="true" />
<element signature="e#95957#96010#0" expanded="true" />
<element signature="e#96648#96688#0" expanded="true" />
<element signature="e#96729#96766#0" expanded="true" />
<element signature="e#96878#97414#0" expanded="true" />
<element signature="e#97413#97414#0" expanded="true" />
<element signature="e#97442#97498#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="LocaleHelper.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/LocaleHelper.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="49" column="53" selection-start-line="49" selection-start-column="53" selection-end-line="49" selection-end-column="53" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="kbd_qwerty.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/xml/kbd_qwerty.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="476" column="38" selection-start-line="476" selection-start-column="38" selection-end-line="476" selection-end-column="38" />
<folding>
<element signature="e#5702#5728#0" expanded="true" />
<element signature="e#6920#6946#0" expanded="true" />
<element signature="e#8140#8166#0" expanded="true" />
<element signature="e#9357#9383#0" expanded="true" />
<element signature="e#10581#10607#0" expanded="true" />
<element signature="e#12082#12108#0" expanded="true" />
<element signature="e#13602#13628#0" expanded="true" />
<element signature="e#15124#15150#0" expanded="true" />
<element signature="e#16643#16669#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="kbd_qwerty_black.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/xml/kbd_qwerty_black.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="146" column="46" selection-start-line="146" selection-start-column="35" selection-end-line="146" selection-end-column="46" />
<folding>
<element signature="e#5666#5692#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="kbd_qwerty.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/xml-de/kbd_qwerty.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="147" column="38" selection-start-line="147" selection-start-column="38" selection-end-line="147" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="settings.gradle" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/settings.gradle">
<file leaf-file-name="KeyboardSwitcher.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<caret line="591" column="0" selection-start-line="591" selection-start-column="0" selection-end-line="591" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="local.properties" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/local.properties">
<file leaf-file-name="LatinIMESettings.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinIMESettings.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<caret line="54" column="0" selection-start-line="54" selection-start-column="0" selection-end-line="54" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="KP2ASoftkeyboard_AS.iml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/KP2ASoftkeyboard_AS.iml">
<file leaf-file-name="LatinKeyboardView.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardView.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<caret line="36" column="23" selection-start-line="36" selection-start-column="23" selection-end-line="36" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="strings.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings.xml">
<file leaf-file-name="LatinKeyboard.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboard.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="309" column="46" selection-start-line="309" selection-start-column="46" selection-end-line="309" selection-end-column="46" />
<folding />
<caret line="397" column="24" selection-start-line="397" selection-start-column="24" selection-end-line="397" selection-end-column="24" />
<folding>
<element signature="e#15971#15972#0" expanded="true" />
<element signature="e#16007#16008#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="GradleLocalSettings">
<option name="availableProjects">
<map>
@ -1400,6 +1477,12 @@
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/app/build.gradle" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardBaseView.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LanguageSwitcher.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/Loc.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/InputLanguageSelection.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/LocaleHelper.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java" />
</list>
</option>
</component>
@ -1414,9 +1497,10 @@
<order />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-7" />
<option name="width" value="1378" />
<option name="height" value="735" />
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1382" />
<option name="height" value="744" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
@ -1441,21 +1525,7 @@
<sortByType />
</navigator>
<panes>
<pane id="AndroidView">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.android.tools.idea.navigator.nodes.AndroidViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Gradle Scripts" />
<option name="myItemType" value="com.android.tools.idea.navigator.nodes.AndroidBuildScriptsGroupNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<PATH>
@ -1502,7 +1572,11 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="build" />
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@ -1520,22 +1594,78 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="build" />
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="outputs" />
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="aar" />
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="keepass2android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="softkeyboard" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="KP2ASoftkeyboard_AS" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="keepass2android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="kbbridge" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="AndroidView">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.android.tools.idea.navigator.nodes.AndroidViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Gradle Scripts" />
<option name="myItemType" value="com.android.tools.idea.navigator.nodes.AndroidBuildScriptsGroupNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
</panes>
</component>
<component name="PropertiesComponent">
@ -1714,32 +1844,32 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-7" y="0" width="1378" height="735" extended-state="0" />
<editor active="false" />
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3270869" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.33391005" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32879046" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Android" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24962063" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24886535" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32879046" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
@ -1757,7 +1887,9 @@
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<breakpoint-manager>
<option name="time" value="1" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
@ -1785,6 +1917,24 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardBaseView.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="436" column="65" selection-start-line="436" selection-start-column="65" selection-end-line="436" selection-end-column="65" />
<folding>
<element signature="method#LatinKeyboardBaseView#1;class#LatinKeyboardBaseView#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/attrs.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="25" column="20" selection-start-line="25" selection-start-column="20" selection-end-line="25" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/settings.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
@ -1825,6 +1975,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="15" column="0" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/settings.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
@ -1833,6 +1999,14 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/local.properties">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/KP2ASoftkeyboard_AS.iml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
@ -1849,6 +2023,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/settings.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/KP2ASoftkeyboard_AS.iml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/attrs.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
@ -1857,20 +2047,23 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardBaseView.java">
<entry file="file://$PROJECT_DIR$/local.properties">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="436" column="65" selection-start-line="436" selection-start-column="65" selection-end-line="436" selection-end-column="65" />
<folding>
<element signature="e#18750#18803#0" expanded="true" />
<element signature="e#18834#18886#0" expanded="true" />
<element signature="e#19642#19697#0" expanded="true" />
<element signature="e#22092#22144#0" expanded="true" />
</folding>
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/local.properties">
<entry file="file://$USER_HOME$/AppData/Local/Android/android-sdk/sources/android-23/java/lang/String.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="434" column="65" selection-start-line="434" selection-start-column="65" selection-end-line="434" selection-end-column="65" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/import-summary.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
@ -1888,11 +2081,190 @@
</entry>
<entry file="file://$PROJECT_DIR$/app/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.71428573">
<caret line="15" column="9" selection-start-line="15" selection-start-column="9" selection-end-line="15" selection-end-column="9" />
<state vertical-scroll-proportion="0.0">
<caret line="11" column="16" selection-start-line="11" selection-start-column="16" selection-end-line="11" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/InputLanguageSelection.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="92" column="16" selection-start-line="92" selection-start-column="16" selection-end-line="92" selection-end-column="16" />
<folding>
<element signature="e#0#5655#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#1509#1539#0" expanded="true" />
<element signature="e#2941#2964#0" expanded="true" />
<element signature="e#4545#4546#0" expanded="true" />
<element signature="e#4577#4578#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LanguageSwitcher.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="62" column="13" selection-start-line="62" selection-start-column="13" selection-end-line="62" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/Loc.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="9" column="13" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-4.88">
<caret line="187" column="34" selection-start-line="187" selection-start-column="18" selection-end-line="187" selection-end-column="34" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardView.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="36" column="23" selection-start-line="36" selection-start-column="23" selection-end-line="36" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboard.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="397" column="24" selection-start-line="397" selection-start-column="24" selection-end-line="397" selection-end-column="24" />
<folding>
<element signature="e#15971#15972#0" expanded="true" />
<element signature="e#16007#16008#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinKeyboardBaseView.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="1234" column="25" selection-start-line="1234" selection-start-column="25" selection-end-line="1234" selection-end-column="25" />
<folding>
<element signature="method#LatinKeyboardBaseView#1;class#LatinKeyboardBaseView#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/xml/kbd_qwerty.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="476" column="38" selection-start-line="476" selection-start-column="38" selection-end-line="476" selection-end-column="38" />
<folding>
<element signature="e#5702#5728#0" expanded="true" />
<element signature="e#6920#6946#0" expanded="true" />
<element signature="e#8140#8166#0" expanded="true" />
<element signature="e#9357#9383#0" expanded="true" />
<element signature="e#10581#10607#0" expanded="true" />
<element signature="e#12082#12108#0" expanded="true" />
<element signature="e#13602#13628#0" expanded="true" />
<element signature="e#15124#15150#0" expanded="true" />
<element signature="e#16643#16669#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/xml/kbd_qwerty_black.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="146" column="46" selection-start-line="146" selection-start-column="35" selection-end-line="146" selection-end-column="46" />
<folding>
<element signature="e#5666#5692#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/xml-de/kbd_qwerty.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="147" column="38" selection-start-line="147" selection-start-column="38" selection-end-line="147" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/KeyboardSwitcher.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="591" column="0" selection-start-line="591" selection-start-column="0" selection-end-line="591" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/LatinIMESettings.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="54" column="0" selection-start-line="54" selection-start-column="0" selection-end-line="54" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/LocaleHelper.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="49" column="53" selection-start-line="49" selection-start-column="53" selection-end-line="49" selection-end-column="53" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/softkeyboard/KP2AKeyboard.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="2465" column="13" selection-start-line="2465" selection-start-column="13" selection-end-line="2465" selection-end-column="13" />
<folding>
<element signature="e#17350#17396#0" expanded="true" />
<element signature="e#17428#17478#0" expanded="true" />
<element signature="e#39322#39384#0" expanded="true" />
<element signature="e#51293#51294#0" expanded="true" />
<element signature="e#51354#51355#0" expanded="true" />
<element signature="e#53061#53091#0" expanded="true" />
<element signature="e#53167#53199#0" expanded="true" />
<element signature="e#53556#53613#0" expanded="true" />
<element signature="e#59864#59865#0" expanded="true" />
<element signature="e#59905#59906#0" expanded="true" />
<element signature="e#59939#59940#0" expanded="true" />
<element signature="e#59981#59982#0" expanded="true" />
<element signature="e#67589#67590#0" expanded="true" />
<element signature="e#67625#67626#0" expanded="true" />
<element signature="e#67674#67675#0" expanded="true" />
<element signature="e#67733#67734#0" expanded="true" />
<element signature="e#68330#68331#0" expanded="true" />
<element signature="e#68387#68388#0" expanded="true" />
<element signature="e#81359#81360#0" expanded="true" />
<element signature="e#81428#81429#0" expanded="true" />
<element signature="e#85149#85150#0" expanded="true" />
<element signature="e#85187#85188#0" expanded="true" />
<element signature="e#85712#85713#0" expanded="true" />
<element signature="e#85765#85766#0" expanded="true" />
<element signature="e#87861#87862#0" expanded="true" />
<element signature="e#87890#87891#0" expanded="true" />
<element signature="e#91923#91924#0" expanded="true" />
<element signature="e#91951#91952#0" expanded="true" />
<element signature="e#91993#91994#0" expanded="true" />
<element signature="e#92024#92025#0" expanded="true" />
<element signature="e#93068#93069#0" expanded="true" />
<element signature="e#93122#93123#0" expanded="true" />
<element signature="e#93163#93164#0" expanded="true" />
<element signature="e#93222#93223#0" expanded="true" />
<element signature="e#95957#96010#0" expanded="true" />
<element signature="e#96648#96688#0" expanded="true" />
<element signature="e#96729#96766#0" expanded="true" />
<element signature="e#96878#97414#0" expanded="true" />
<element signature="e#97413#97414#0" expanded="true" />
<element signature="e#97442#97498#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View File

@ -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<Object> {
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);
}
}

View File

@ -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<Loc> getUniqueLocales(Context ctx, boolean strict) {
String[] locales = ctx.getAssets().getLocales();
Arrays.sort(locales);
ArrayList<Loc> uniqueLocales = new ArrayList<Loc>();
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;
}
}

View File

@ -38,51 +38,8 @@ import java.util.Locale;
public class InputLanguageSelection extends PreferenceActivity {
private String mSelectedLanguages;
private ArrayList<Loc> mAvailableLanguages = new ArrayList<Loc>();
private ArrayList<keepass2android.kbbridge.Loc> mAvailableLanguages = new ArrayList<keepass2android.kbbridge.Loc>();
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<Object> {
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<Loc> getUniqueLocales(boolean strict) {
String[] locales = getAssets().getLocales();
Arrays.sort(locales);
ArrayList<Loc> uniqueLocales = new ArrayList<Loc>();
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<keepass2android.kbbridge.Loc> getUniqueLocales(boolean strict) {
return keepass2android.kbbridge.LocaleHelper.getUniqueLocales(this, strict);
}
}

View File

@ -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() {

View File

@ -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;
}
}

View File

@ -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;
}