improve keyboard activation
This commit is contained in:
		| @@ -0,0 +1,28 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |                xmlns:tools="http://schemas.android.com/tools" | ||||||
|  |                android:orientation="vertical" | ||||||
|  |                android:layout_width="match_parent" | ||||||
|  |                android:layout_height="match_parent" | ||||||
|  |                android:paddingBottom="@dimen/activity_vertical_margin" | ||||||
|  |                android:paddingLeft="@dimen/activity_horizontal_margin" | ||||||
|  |                android:paddingRight="@dimen/activity_horizontal_margin" | ||||||
|  |                android:paddingTop="@dimen/activity_vertical_margin" | ||||||
|  | > | ||||||
|  |     <TextView  android:layout_width="match_parent" | ||||||
|  |                android:layout_height="wrap_content" | ||||||
|  |                android:text="@string/switch_ime_text" /> | ||||||
|  |  | ||||||
|  |     <Button  | ||||||
|  |       android:id="@+id/btn_reopen" | ||||||
|  |       android:layout_width="match_parent" | ||||||
|  |                android:layout_height="wrap_content" | ||||||
|  |                android:text="@string/switch_ime_reopen" /> | ||||||
|  |  | ||||||
|  |     <Button  | ||||||
|  |       android:id="@+id/btn_cancel" | ||||||
|  |       android:layout_width="match_parent" | ||||||
|  |       android:layout_height="wrap_content" | ||||||
|  |       android:text="@string/cancel" /> | ||||||
|  |  | ||||||
|  | </LinearLayout> | ||||||
| @@ -1226,6 +1226,8 @@ Initial public release | |||||||
|   <string name="emergency_infotext_main">Did you ever consider what happens if you are no longer able to access your password database? What if you have an accident? It is good practice to pass your master key to some trusted person for emergency cases. Nobody will have access to your passwords otherwise.</string> |   <string name="emergency_infotext_main">Did you ever consider what happens if you are no longer able to access your password database? What if you have an accident? It is good practice to pass your master key to some trusted person for emergency cases. Nobody will have access to your passwords otherwise.</string> | ||||||
|  |  | ||||||
|   <string name="no_secure_display">The currently valid display is not marked as secure. This means that screenshots might be taken by other apps. Keepass2Android is configured to display sensitive information on secure displays only. Please change to a secure display (e.g. by detaching an HDMI monitor) or change the app settings.</string> |   <string name="no_secure_display">The currently valid display is not marked as secure. This means that screenshots might be taken by other apps. Keepass2Android is configured to display sensitive information on secure displays only. Please change to a secure display (e.g. by detaching an HDMI monitor) or change the app settings.</string> | ||||||
|    |  | ||||||
|  |   <string name="switch_ime_text">Please activate the Keepass2Android keyboard.</string> | ||||||
|  |   <string name="switch_ime_reopen">Retry</string> | ||||||
|  |  | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
| @@ -20,6 +20,9 @@ namespace keepass2android | |||||||
|         protected override void OnCreate(Bundle savedInstanceState) |         protected override void OnCreate(Bundle savedInstanceState) | ||||||
|         { |         { | ||||||
|             base.OnCreate(savedInstanceState); |             base.OnCreate(savedInstanceState); | ||||||
|  |             SetContentView(Resource.Layout.switch_ime_activity_layout); | ||||||
|  |             FindViewById<Button>(Resource.Id.btn_reopen).Click += (sender, args) => TrySwitchKeyboard(); | ||||||
|  |             FindViewById<Button>(Resource.Id.btn_cancel).Click += (sender, args) => Finish(); | ||||||
|         } |         } | ||||||
|         private string Kp2aInputMethodName |         private string Kp2aInputMethodName | ||||||
|         { |         { | ||||||
| @@ -32,6 +35,11 @@ namespace keepass2android | |||||||
|         { |         { | ||||||
|             base.OnResume(); |             base.OnResume(); | ||||||
|  |  | ||||||
|  |             TrySwitchKeyboard(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         private void TrySwitchKeyboard() | ||||||
|  |         { | ||||||
|             var needsKeyboardSwitch = NeedsKeyboardSwitch(); |             var needsKeyboardSwitch = NeedsKeyboardSwitch(); | ||||||
|  |  | ||||||
|             if (needsKeyboardSwitch) |             if (needsKeyboardSwitch) | ||||||
| @@ -50,8 +58,6 @@ namespace keepass2android | |||||||
|                         if (!NeedsKeyboardSwitch()) Finish(); |                         if (!NeedsKeyboardSwitch()) Finish(); | ||||||
|                     }); |                     }); | ||||||
|                 }, null, timeToWait, timeToWait); |                 }, null, timeToWait, timeToWait); | ||||||
|  |  | ||||||
|  |  | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|                 Finish(); |                 Finish(); | ||||||
|   | |||||||
| @@ -2053,6 +2053,11 @@ | |||||||
|       <Version>1.3.50.1</Version> |       <Version>1.3.50.1</Version> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |   <ItemGroup> | ||||||
|  |     <AndroidResource Include="Resources\layout\switch_ime_activity_layout.xml"> | ||||||
|  |       <SubType>Designer</SubType> | ||||||
|  |     </AndroidResource> | ||||||
|  |   </ItemGroup> | ||||||
|   <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> |   <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> | ||||||
|   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||||||
|     <PropertyGroup> |     <PropertyGroup> | ||||||
|   | |||||||
| @@ -849,7 +849,7 @@ namespace keepass2android | |||||||
|                         ActivityManager.RunningAppProcessInfo appProcessInfo = new ActivityManager.RunningAppProcessInfo(); |                         ActivityManager.RunningAppProcessInfo appProcessInfo = new ActivityManager.RunningAppProcessInfo(); | ||||||
|                         ActivityManager.GetMyMemoryState(appProcessInfo); |                         ActivityManager.GetMyMemoryState(appProcessInfo); | ||||||
|                         //at least on Samsung devices, we always need the helper activity |                         //at least on Samsung devices, we always need the helper activity | ||||||
|                         mustUseHelperActivity = true;// TODO enable again (appProcessInfo.Importance != Importance.Foreground) || (Build.Manufacturer != "Google"); |                         mustUseHelperActivity = (appProcessInfo.Importance != Importance.Foreground) || (Build.Manufacturer != "Google"); | ||||||
|                     } |                     } | ||||||
|                     if (mustUseHelperActivity) |                     if (mustUseHelperActivity) | ||||||
|                     { |                     { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll