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>
|
||||
@@ -1227,5 +1227,7 @@ Initial public release
|
||||
|
||||
<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>
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace keepass2android
|
||||
protected override void OnCreate(Bundle 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
|
||||
{
|
||||
@@ -32,6 +35,11 @@ namespace keepass2android
|
||||
{
|
||||
base.OnResume();
|
||||
|
||||
TrySwitchKeyboard();
|
||||
}
|
||||
|
||||
private void TrySwitchKeyboard()
|
||||
{
|
||||
var needsKeyboardSwitch = NeedsKeyboardSwitch();
|
||||
|
||||
if (needsKeyboardSwitch)
|
||||
@@ -50,8 +58,6 @@ namespace keepass2android
|
||||
if (!NeedsKeyboardSwitch()) Finish();
|
||||
});
|
||||
}, null, timeToWait, timeToWait);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
Finish();
|
||||
|
||||
@@ -2053,6 +2053,11 @@
|
||||
<Version>1.3.50.1</Version>
|
||||
</PackageReference>
|
||||
</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" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -849,7 +849,7 @@ namespace keepass2android
|
||||
ActivityManager.RunningAppProcessInfo appProcessInfo = new ActivityManager.RunningAppProcessInfo();
|
||||
ActivityManager.GetMyMemoryState(appProcessInfo);
|
||||
//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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user