added ConfigChanges flags to all activities which could potentially show the ykDroid dialog to reduce the chance of activity recreation (this is considered a workaround, waiting for the solution at https://github.com/pp3345/ykDroid/issues/8)

This commit is contained in:
Philipp Crocoll
2018-12-03 11:37:08 +01:00
parent 836cdfb16c
commit 7f21fa2c40
14 changed files with 22 additions and 17 deletions

View File

@@ -28,7 +28,7 @@ using Object = Java.Lang.Object;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/child_dbs_title", MainLauncher = false, Theme = "@style/MyTheme_Blue", LaunchMode = LaunchMode.SingleInstance)] [Activity(Label = "@string/child_dbs_title", MainLauncher = false, Theme = "@style/MyTheme_Blue", LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
[IntentFilter(new[] { "kp2a.action.ConfigureChildDatabasesActivity" }, Categories = new[] { Intent.CategoryDefault })] [IntentFilter(new[] { "kp2a.action.ConfigureChildDatabasesActivity" }, Categories = new[] { Intent.CategoryDefault })]
public class ConfigureChildDatabasesActivity : LockCloseActivity public class ConfigureChildDatabasesActivity : LockCloseActivity
{ {

View File

@@ -86,7 +86,7 @@ namespace keepass2android
} }
[Activity (Label = "@string/app_name", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden, [Activity (Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden,
Theme = "@style/MyTheme_ActionBar")] Theme = "@style/MyTheme_ActionBar")]
public class EntryActivity : LockCloseActivity public class EntryActivity : LockCloseActivity
{ {

View File

@@ -46,7 +46,7 @@ using Uri = Android.Net.Uri;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")] [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")]
public class EntryEditActivity : LockCloseActivity { public class EntryEditActivity : LockCloseActivity {

View File

@@ -40,7 +40,7 @@ namespace keepass2android
} }
[Activity(Label = "@string/app_name", [Activity(Label = "@string/app_name",
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden,
Theme = "@style/MyTheme_ActionBar")] Theme = "@style/MyTheme_ActionBar")]
[IntentFilter(new[] {"kp2a.action.ExportDatabaseActivity"}, Categories = new[] {Intent.CategoryDefault})] [IntentFilter(new[] {"kp2a.action.ExportDatabaseActivity"}, Categories = new[] {Intent.CategoryDefault})]
public class ExportDatabaseActivity : LockCloseActivity public class ExportDatabaseActivity : LockCloseActivity

View File

@@ -21,7 +21,7 @@ using Exception = System.Exception;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/app_name", [Activity(Label = "@string/app_name",
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden,
Theme = "@style/MyTheme_ActionBar", MainLauncher = false)] Theme = "@style/MyTheme_ActionBar", MainLauncher = false)]
[IntentFilter(new[] { "kp2a.action.FingerprintSetupActivity" }, Categories = new[] { Intent.CategoryDefault })] [IntentFilter(new[] { "kp2a.action.FingerprintSetupActivity" }, Categories = new[] { Intent.CategoryDefault })]
public class FingerprintSetupActivity : LockCloseActivity, IFingerprintAuthCallback public class FingerprintSetupActivity : LockCloseActivity, IFingerprintAuthCallback

View File

@@ -19,6 +19,7 @@ using System;
using System.Globalization; using System.Globalization;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM;
using Android.OS; using Android.OS;
using Android.Preferences; using Android.Preferences;
using Android.Views; using Android.Views;
@@ -26,7 +27,7 @@ using Android.Widget;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", WindowSoftInputMode = SoftInput.StateHidden)] [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", WindowSoftInputMode = SoftInput.StateHidden, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
public class GeneratePasswordActivity : LockCloseActivity { public class GeneratePasswordActivity : LockCloseActivity {
private readonly int[] _buttonIds = new[] {Resource.Id.btn_length6, Resource.Id.btn_length8, Resource.Id.btn_length12, Resource.Id.btn_length16}; private readonly int[] _buttonIds = new[] {Resource.Id.btn_length6, Resource.Id.btn_length8, Resource.Id.btn_length12, Resource.Id.btn_length16};

View File

@@ -42,7 +42,7 @@ using Object = Java.Lang.Object;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")] [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")]
[MetaData("android.app.default_searchable", Value = "keepass2android.search.SearchResults")] [MetaData("android.app.default_searchable", Value = "keepass2android.search.SearchResults")]
#if NoNet #if NoNet
[MetaData("android.app.searchable", Resource = "@xml/searchable_offline")] [MetaData("android.app.searchable", Resource = "@xml/searchable_offline")]

View File

@@ -19,12 +19,14 @@ using System;
using System.IO; using System.IO;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM;
using Android.Graphics; using Android.Graphics;
using Android.Graphics.Drawables; using Android.Graphics.Drawables;
using Android.OS; using Android.OS;
using Android.Preferences; using Android.Preferences;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Java.Lang;
using KeePassLib; using KeePassLib;
using KeePassLib.Utility; using KeePassLib.Utility;
using FileNotFoundException = Java.IO.FileNotFoundException; using FileNotFoundException = Java.IO.FileNotFoundException;
@@ -32,11 +34,11 @@ using IOException = Java.IO.IOException;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar")] [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
public class IconPickerActivity : LockCloseActivity public class IconPickerActivity : LockCloseActivity
{ {
public const String KeyIconId = "icon_id"; public const string KeyIconId = "icon_id";
public const String KeyCustomIconId = "custom_icon_id"; public const string KeyCustomIconId = "custom_icon_id";
public static void Launch(Activity act) public static void Launch(Activity act)
{ {
@@ -120,7 +122,7 @@ namespace keepass2android
{ {
if ((bitmap.Width > maxSize) || (bitmap.Height > maxSize)) if ((bitmap.Width > maxSize) || (bitmap.Height > maxSize))
{ {
float scale = Math.Min(maxSize / bitmap.Width, maxSize / bitmap.Height); float scale = System.Math.Min(maxSize / bitmap.Width, maxSize / bitmap.Height);
var scaleWidth = (int)(bitmap.Width * scale); var scaleWidth = (int)(bitmap.Width * scale);
var scaleHeight = (int)(bitmap.Height * scale); var scaleHeight = (int)(bitmap.Height * scale);
var scaledBitmap = Bitmap.CreateScaledBitmap(bitmap, scaleWidth, scaleHeight, true); var scaledBitmap = Bitmap.CreateScaledBitmap(bitmap, scaleWidth, scaleHeight, true);

View File

@@ -293,7 +293,7 @@ namespace keepass2android
return 0; return 0;
} }
} }
[Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden,
Theme = "@style/MyTheme_ActionBar")] Theme = "@style/MyTheme_ActionBar")]
public class ImageViewActivity : LockCloseActivity public class ImageViewActivity : LockCloseActivity
{ {

View File

@@ -31,7 +31,7 @@ using KeePassLib.Utility;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/kp2a_findUrl", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")] [Activity(Label = "@string/kp2a_findUrl", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")]
#if NoNet #if NoNet
[MetaData("android.app.searchable", Resource = "@xml/searchable_offline")] [MetaData("android.app.searchable", Resource = "@xml/searchable_offline")]
#else #else

View File

@@ -18,6 +18,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll.
using System; using System;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM;
using Android.OS; using Android.OS;
using Android.Widget; using Android.Widget;
using KeePassLib; using KeePassLib;
@@ -28,7 +29,7 @@ namespace keepass2android
/// <summary> /// <summary>
/// Activity to display search options /// Activity to display search options
/// </summary> /// </summary>
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar")] [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
public class SearchActivity : LockCloseActivity public class SearchActivity : LockCloseActivity
{ {
bool GetCheckBoxValue(int resId) bool GetCheckBoxValue(int resId)

View File

@@ -18,6 +18,7 @@ using System;
using System.Linq; using System.Linq;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM;
using Android.OS; using Android.OS;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
@@ -29,7 +30,7 @@ namespace keepass2android.search
/// <summary> /// <summary>
/// Activity to show search results /// Activity to show search results
/// </summary> /// </summary>
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", LaunchMode = Android.Content.PM.LaunchMode.SingleTop, Permission="keepass2android."+AppNames.PackagePart+".permission.KP2aInternalSearch")] [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", LaunchMode = Android.Content.PM.LaunchMode.SingleTop, Permission="keepass2android."+AppNames.PackagePart+".permission.KP2aInternalSearch", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
#if NoNet #if NoNet
[MetaData("android.app.searchable", Resource = "@xml/searchable_offline")] [MetaData("android.app.searchable", Resource = "@xml/searchable_offline")]
#else #else

View File

@@ -87,7 +87,7 @@ namespace keepass2android
/// <summary> /// <summary>
/// Activity to configure the application, without database settings. Does not require an unlocked database, or close when the database is locked /// Activity to configure the application, without database settings. Does not require an unlocked database, or close when the database is locked
/// </summary> /// </summary>
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme")] [Activity(Label = "@string/app_name", Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
public class AppSettingsActivity : LockingActivity public class AppSettingsActivity : LockingActivity
{ {
private ActivityDesign _design; private ActivityDesign _design;

View File

@@ -1026,7 +1026,7 @@ namespace keepass2android
/// <summary> /// <summary>
/// Activity to configure the application and database settings. The database must be unlocked, and this activity will close if it becomes locked. /// Activity to configure the application and database settings. The database must be unlocked, and this activity will close if it becomes locked.
/// </summary> /// </summary>
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme")] [Activity(Label = "@string/app_name", Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
public class DatabaseSettingsActivity : LockCloseActivity public class DatabaseSettingsActivity : LockCloseActivity
{ {