improved behavior for keyboard/autofill service activation (don't activate keyboard if looking up for autofill, ask autofill/keyboard before bringing up keyboard activation)

added preference to install keyboardswap
adjusted keyboardswap package name
This commit is contained in:
Philipp Crocoll
2017-06-27 06:49:41 +02:00
parent f2994295d8
commit 0fd5758566
7 changed files with 329 additions and 67 deletions

View File

@@ -37,11 +37,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="AutoFillService.java" pinned="false" current-in-tab="true">
<file leaf-file-name="AutoFillService.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="173">
<caret line="83" column="34" selection-start-line="83" selection-start-column="34" selection-end-line="83" selection-end-column="34" />
<state relative-caret-position="109">
<caret line="226" column="61" selection-start-line="226" selection-start-column="53" selection-end-line="226" selection-end-column="61" />
<folding>
<element signature="e#2189#2190#0" expanded="true" />
<element signature="e#2234#2235#0" expanded="true" />
@@ -113,11 +113,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="ImeSwitcher.java" pinned="false" current-in-tab="false">
<file leaf-file-name="ImeSwitcher.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/ImeSwitcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="22">
<caret line="59" column="28" selection-start-line="59" selection-start-column="28" selection-end-line="59" selection-end-column="28" />
<caret line="51" column="13" selection-start-line="51" selection-start-column="13" selection-end-line="51" selection-end-column="13" />
<folding />
</state>
</provider>
@@ -128,7 +128,50 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5500">
<caret line="326" column="20" selection-start-line="326" selection-start-column="20" selection-end-line="326" selection-end-column="20" />
<folding />
<folding>
<element signature="e#0#100279#0" expanded="false" />
<element signature="imports" expanded="false" />
<element signature="e#8691#8692#0" expanded="false" />
<element signature="e#8739#8740#0" expanded="false" />
<element signature="e#8790#8791#0" expanded="false" />
<element signature="e#8843#8844#0" expanded="false" />
<element signature="e#8947#8948#0" expanded="false" />
<element signature="e#8989#8990#0" expanded="false" />
<element signature="e#9468#9469#0" expanded="false" />
<element signature="e#9518#9519#0" expanded="false" />
<element signature="e#9591#9592#0" expanded="false" />
<element signature="e#9647#9648#0" expanded="false" />
<element signature="e#51293#51294#0" expanded="false" />
<element signature="e#51354#51355#0" expanded="false" />
<element signature="e#59864#59865#0" expanded="false" />
<element signature="e#59905#59906#0" expanded="false" />
<element signature="e#59939#59940#0" expanded="false" />
<element signature="e#59981#59982#0" expanded="false" />
<element signature="e#67589#67590#0" expanded="false" />
<element signature="e#67625#67626#0" expanded="false" />
<element signature="e#67674#67675#0" expanded="false" />
<element signature="e#67733#67734#0" expanded="false" />
<element signature="e#68330#68331#0" expanded="false" />
<element signature="e#68387#68388#0" expanded="false" />
<element signature="e#81359#81360#0" expanded="false" />
<element signature="e#81428#81429#0" expanded="false" />
<element signature="e#85149#85150#0" expanded="false" />
<element signature="e#85187#85188#0" expanded="false" />
<element signature="e#85712#85713#0" expanded="false" />
<element signature="e#85765#85766#0" expanded="false" />
<element signature="e#87861#87862#0" expanded="false" />
<element signature="e#87890#87891#0" expanded="false" />
<element signature="e#89833#89834#0" expanded="false" />
<element signature="e#89875#89876#0" expanded="false" />
<element signature="e#91923#91924#0" expanded="false" />
<element signature="e#91951#91952#0" expanded="false" />
<element signature="e#91993#91994#0" expanded="false" />
<element signature="e#92024#92025#0" expanded="false" />
<element signature="e#93068#93069#0" expanded="false" />
<element signature="e#93122#93123#0" expanded="false" />
<element signature="e#93163#93164#0" expanded="false" />
<element signature="e#93222#93223#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@@ -1356,8 +1399,8 @@
<option value="$PROJECT_DIR$/gradle.properties" />
<option value="$PROJECT_DIR$/settings.gradle" />
<option value="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/ImeSwitcher.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java" />
<option value="$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/ImeSwitcher.java" />
</list>
</option>
</component>
@@ -1371,7 +1414,7 @@
<component name="ProjectFrameBounds">
<option name="x" value="-9" />
<option name="y" value="-9" />
<option name="width" value="1932" />
<option name="width" value="1938" />
<option name="height" value="1048" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
@@ -1462,6 +1505,103 @@
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android App">
<module name="" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ENABLE_ADVANCED_PROFILING" value="true" />
<option name="SUPPORT_LIB_ENABLED" value="true" />
<option name="INSTRUMENTATION_ENABLED" value="true" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method />
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Instrumented Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ENABLE_ADVANCED_PROFILING" value="true" />
<option name="SUPPORT_LIB_ENABLED" value="true" />
<option name="INSTRUMENTATION_ENABLED" value="true" />
</Profilers>
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
@@ -1477,6 +1617,22 @@
<envs />
<method />
</configuration>
<configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<method />
</configuration>
<configuration default="true" type="JarApplication" factoryName="JAR Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<envs />
@@ -1659,11 +1815,11 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-9" y="-9" width="1932" height="1048" extended-state="0" />
<frame x="-9" y="-9" width="1938" height="1048" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32470587" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3903819" 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" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
@@ -1675,8 +1831,8 @@
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" 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" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24515086" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3635294" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24436091" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30235294" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24962063" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
@@ -2074,15 +2230,50 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5500">
<caret line="326" column="20" selection-start-line="326" selection-start-column="20" selection-end-line="326" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/ImeSwitcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="22">
<caret line="59" column="28" selection-start-line="59" selection-start-column="28" selection-end-line="59" selection-end-column="28" />
<folding />
<folding>
<element signature="e#0#100279#0" expanded="false" />
<element signature="imports" expanded="false" />
<element signature="e#8691#8692#0" expanded="false" />
<element signature="e#8739#8740#0" expanded="false" />
<element signature="e#8790#8791#0" expanded="false" />
<element signature="e#8843#8844#0" expanded="false" />
<element signature="e#8947#8948#0" expanded="false" />
<element signature="e#8989#8990#0" expanded="false" />
<element signature="e#9468#9469#0" expanded="false" />
<element signature="e#9518#9519#0" expanded="false" />
<element signature="e#9591#9592#0" expanded="false" />
<element signature="e#9647#9648#0" expanded="false" />
<element signature="e#51293#51294#0" expanded="false" />
<element signature="e#51354#51355#0" expanded="false" />
<element signature="e#59864#59865#0" expanded="false" />
<element signature="e#59905#59906#0" expanded="false" />
<element signature="e#59939#59940#0" expanded="false" />
<element signature="e#59981#59982#0" expanded="false" />
<element signature="e#67589#67590#0" expanded="false" />
<element signature="e#67625#67626#0" expanded="false" />
<element signature="e#67674#67675#0" expanded="false" />
<element signature="e#67733#67734#0" expanded="false" />
<element signature="e#68330#68331#0" expanded="false" />
<element signature="e#68387#68388#0" expanded="false" />
<element signature="e#81359#81360#0" expanded="false" />
<element signature="e#81428#81429#0" expanded="false" />
<element signature="e#85149#85150#0" expanded="false" />
<element signature="e#85187#85188#0" expanded="false" />
<element signature="e#85712#85713#0" expanded="false" />
<element signature="e#85765#85766#0" expanded="false" />
<element signature="e#87861#87862#0" expanded="false" />
<element signature="e#87890#87891#0" expanded="false" />
<element signature="e#89833#89834#0" expanded="false" />
<element signature="e#89875#89876#0" expanded="false" />
<element signature="e#91923#91924#0" expanded="false" />
<element signature="e#91951#91952#0" expanded="false" />
<element signature="e#91993#91994#0" expanded="false" />
<element signature="e#92024#92025#0" expanded="false" />
<element signature="e#93068#93069#0" expanded="false" />
<element signature="e#93122#93123#0" expanded="false" />
<element signature="e#93163#93164#0" expanded="false" />
<element signature="e#93222#93223#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@@ -2104,8 +2295,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="173">
<caret line="83" column="34" selection-start-line="83" selection-start-column="34" selection-end-line="83" selection-end-column="34" />
<state relative-caret-position="109">
<caret line="226" column="61" selection-start-line="226" selection-start-column="53" selection-end-line="226" selection-end-column="61" />
<folding>
<element signature="e#2189#2190#0" expanded="true" />
<element signature="e#2234#2235#0" expanded="true" />
@@ -2113,5 +2304,13 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/kbbridge/ImeSwitcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="22">
<caret line="51" column="13" selection-start-line="51" selection-start-column="13" selection-end-line="51" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View File

@@ -54,8 +54,10 @@ public class ImeSwitcher {
}
return;
}
Intent swapPluginIntent = ctx.getPackageManager().getLaunchIntentForPackage("keepass2android.plugin.keyboardswap");
if (newImeName != null) {
Intent swapPluginIntent = getLaunchIntentForKeyboardSwap(ctx);
if ((swapPluginIntent != null) && (newImeName != null))
{
swapPluginIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
swapPluginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
swapPluginIntent.putExtra("ImeName", newImeName);
@@ -64,7 +66,7 @@ public class ImeSwitcher {
boolean sentBroadcast = false;
if (!ctx.getPackageManager().queryIntentActivities(swapPluginIntent,0).isEmpty())
if ((swapPluginIntent != null) && (!ctx.getPackageManager().queryIntentActivities(swapPluginIntent,0).isEmpty()))
{
Log.d(Tag, "Found keyboard swap plugin.");
ctx.startActivity(swapPluginIntent);
@@ -117,6 +119,10 @@ public class ImeSwitcher {
}
public static Intent getLaunchIntentForKeyboardSwap(Context ctx) {
return ctx.getPackageManager().getLaunchIntentForPackage("keepass2android.plugin.keyboardswap2");
}
private static boolean autoSwitchEnabled(Context ctx) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ctx);
return sp.getBoolean("kp2a_switch_rooted", false);

View File

@@ -376,6 +376,8 @@
<string name="kp2a_switch_rooted">Auto-switch keyboard</string>
<string name="kp2a_switch_rooted_summary">Automatically switch to KP2A keyboard when entry is opened. Requires correctly prepared KeyboardSwap Plugin or a rooted device and the Secure Settings app with System+. </string>
<string name="get_keyboardswap">Install KeyboardSwap Plugin</string>
<string name="get_keyboardswap_summary">This plugin allows to switch to the KP2A keyboard without root. Requires ADB. </string>
<string name="OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_title">Auto-switch only after search</string>
<string name="OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_summary">Only automatically switch to KP2A keyboard after using the Share URL function (but not when opening an entry in another way)</string>
@@ -680,6 +682,16 @@
<string name="ActivateAutoFillService_btnAutoFill">Use AutoFill service</string>
<string name="ActivateAutoFillService_toast">Please enable the Keepass2Android service.</string>
<string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string>
<string name="ChangeLog_1_02">
Version 1.02\n
* Support for KeyboardSwapPlugin (see password access options): allows to switch input method automatically on non-rooted devices. Thanks to Mishaal Rahman from XDA-Developers to make this possible.\n
* Fix for Accessibility Service with recent Chrome versions\n
* Fix for unnecessary clearing of fingerprint data\n
* Fix minor crashes\n
* Updated build tools\n
</string>
<string name="ChangeLog_1_01g">
Version 1.01-g\n
* Fix for crash when trying to work offline\n

View File

@@ -331,6 +331,11 @@
android:defaultValue="false"
/>
<Preference
android:key="get_keyboardswap"
android:summary="@string/get_keyboardswap_summary"
android:title="@string/get_keyboardswap"
/>
<!-- no autoswitch on root only-->
<CheckBoxPreference

View File

@@ -421,16 +421,22 @@ namespace keepass2android
{
notBuilder.AddKeyboardAccess();
if (closeAfterCreate && Keepass2android.Autofill.AutoFillService.IsAvailable && (!Keepass2android.Autofill.AutoFillService.IsRunning))
if (closeAfterCreate && Keepass2android.Autofill.AutoFillService.IsAvailable)
{
if (!prefs.GetBoolean("has_asked_autofillservice", false))
if (IsKp2aInputMethodEnabled)
{
ActivateKeyboardIfAppropriate(closeAfterCreate, prefs);
} else if (Keepass2android.Autofill.AutoFillService.IsRunning)
{
//don't do anything, service is notified
}
else //neither keyboard nor activity service are running/enabled. Ask the user what to do.
{
var i = new Intent(this, typeof(ActivateAutoFillActivity));
i.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
StartActivity(i);
prefs.Edit().PutBoolean("has_asked_autofillservice", true).Commit();
}
else ActivateKeyboardIfAppropriate(closeAfterCreate, prefs);
}
else ActivateKeyboardIfAppropriate(closeAfterCreate, prefs);
@@ -540,7 +546,8 @@ namespace keepass2android
var key = pair.Key;
var value = pair.Value.ReadString();
if (!PwDefs.IsStandardField(key)) {
if (!PwDefs.IsStandardField(key))
{
kbdataBuilder.AddString(pair.Key, pair.Key, value);
hasData = true;
}
@@ -692,25 +699,26 @@ namespace keepass2android
ContentResolver,
Android.Provider.Settings.Secure.DefaultInputMethod);
string kp2aIme = PackageName + "/keepass2android.softkeyboard.KP2AKeyboard";
string kp2aIme = Kp2aInputMethodName;
if (currentIme == kp2aIme)
{
InputMethodManager imeManager = (InputMethodManager)ApplicationContext.GetSystemService(InputMethodService);
if (imeManager == null)
{
Toast.MakeText(this, Resource.String.not_possible_im_picker, ToastLength.Long).Show();
return;
}
if (currentIme == kp2aIme)
{
imeManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.None);
}
else
{
IList<InputMethodInfo> inputMethodProperties = imeManager.EnabledInputMethodList;
if (!inputMethodProperties.Any(imi => imi.Id.Equals(kp2aIme)))
if (!IsKp2aInputMethodEnabled)
{
Toast.MakeText(this, Resource.String.please_activate_keyboard, ToastLength.Long).Show();
Intent settingsIntent = new Intent(Android.Provider.Settings.ActionInputMethodSettings);
@@ -726,7 +734,22 @@ namespace keepass2android
}
}
public bool IsKp2aInputMethodEnabled
{
get
{
InputMethodManager imeManager = (InputMethodManager)ApplicationContext.GetSystemService(InputMethodService);
if (imeManager == null)
return false;
IList<InputMethodInfo> inputMethodProperties = imeManager.EnabledInputMethodList;
return inputMethodProperties.Any(imi => imi.Id.Equals(Kp2aInputMethodName));
}
}
private string Kp2aInputMethodName
{
get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; }
}
}
[BroadcastReceiver(Permission = "keepass2android." + AppNames.PackagePart + ".permission.CopyToClipboard")]

View File

@@ -23,6 +23,7 @@ using System.Threading;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Content.Res;
using Android.Graphics;
using Android.Graphics.Drawables;
@@ -263,6 +264,22 @@ namespace keepass2android
var act = fragment.Activity;
this._act = act;
this._fragment = fragment;
this._screen = (PreferenceScreen)_fragment.FindPreference(act.GetString(Resource.String.keyboardswitch_prefs_key));
var keyboardSwapPref = _fragment.FindPreference("get_keyboardswap");
var pm = fragment.Context.PackageManager;
var intnt = Keepass2android.Kbbridge.ImeSwitcher.GetLaunchIntentForKeyboardSwap(fragment.Context);
if ((intnt != null) && pm.QueryIntentActivities(intnt, 0).Any())
{
_screen.RemovePreference(keyboardSwapPref);
}
else
{
keyboardSwapPref.PreferenceClick += (sender, args) =>
{
Util.GotoUrl(fragment.Context, fragment.Context.GetString(Resource.String.MarketURL) + "keepass2android.plugin.keyboardswap2");
};
}
_switchPref = (CheckBoxPreference)_fragment.FindPreference("kp2a_switch_rooted");
_openKp2aAutoPref =
@@ -272,7 +289,7 @@ namespace keepass2android
_fragment.FindPreference(act.GetString(Resource.String.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key));
_switchBackPref =
(CheckBoxPreference)_fragment.FindPreference(act.GetString(Resource.String.AutoSwitchBackKeyboard_key));
_screen = (PreferenceScreen)_fragment.FindPreference(act.GetString(Resource.String.keyboardswitch_prefs_key));
EnableSwitchPreferences(_switchPref.Checked);
_switchPref.PreferenceChange += (sender, args) =>