diff --git a/src/keepass2android-app/GeneratePasswordActivity.cs b/src/keepass2android-app/GeneratePasswordActivity.cs
index e187a01e..46f3da0d 100644
--- a/src/keepass2android-app/GeneratePasswordActivity.cs
+++ b/src/keepass2android-app/GeneratePasswordActivity.cs
@@ -145,12 +145,14 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) {
_design.ApplyTheme();
base.OnCreate(savedInstanceState);
-
+
SetContentView(Resource.Layout.generate_password);
SetResult(KeePass.ExitNormal);
-
- var prefs = GetPreferences(FileCreationMode.Private);
+ new Util.InsetListener(FindViewById(Resource.Id.main_container)).Apply();
+
+
+ var prefs = GetPreferences(FileCreationMode.Private);
diff --git a/src/keepass2android-app/PasswordActivity.cs b/src/keepass2android-app/PasswordActivity.cs
index 9cd6d54b..96c6bd1f 100644
--- a/src/keepass2android-app/PasswordActivity.cs
+++ b/src/keepass2android-app/PasswordActivity.cs
@@ -15,6 +15,36 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
along with Keepass2Android. If not, see .
*/
+using Android.App;
+using Android.Content;
+using Android.Content.PM;
+using Android.Database;
+using Android.Graphics;
+using Android.Graphics.Drawables;
+using Android.OS;
+using Android.Preferences;
+using Android.Runtime;
+using Android.Text;
+using Android.Views;
+using Android.Views.InputMethods;
+using Android.Widget;
+using AndroidX.AppCompat.App;
+using AndroidX.CoordinatorLayout.Widget;
+using AndroidX.Core.Content;
+using AndroidX.Core.View;
+using AndroidX.DrawerLayout.Widget;
+using Google.Android.Material.AppBar;
+using Google.Android.Material.Dialog;
+using Java.Lang;
+using Java.Net;
+using KeeChallenge;
+using keepass2android;
+using keepass2android.Io;
+using keepass2android.Utils;
+using Keepass2android.Pluginsdk;
+using KeePassLib.Keys;
+using KeePassLib.Serialization;
+using OtpKeyProv;
using System;
using System.Collections.Generic;
using System.IO;
@@ -23,49 +53,17 @@ using System.Net;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
-using keepass2android;
-using Android.App;
-using Android.Content;
-using Android.Database;
-using Android.Graphics.Drawables;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Views.InputMethods;
-using Android.Widget;
-using Java.Net;
-using Android.Preferences;
-using Android.Text;
-using Android.Content.PM;
-using Android.Graphics;
-using AndroidX.AppCompat.App;
-using AndroidX.CoordinatorLayout.Widget;
-using AndroidX.Core.View;
-using AndroidX.DrawerLayout.Widget;
-using Google.Android.Material.AppBar;
-using Google.Android.Material.Dialog;
-using Java.Lang;
-using KeePassLib.Keys;
-using KeePassLib.Serialization;
-using Keepass2android.Pluginsdk;
-using OtpKeyProv;
-using keepass2android.Io;
-using keepass2android.Utils;
-
-using File = Java.IO.File;
-using FileNotFoundException = Java.IO.FileNotFoundException;
-
-using Object = Java.Lang.Object;
-using Process = Android.OS.Process;
-
-using KeeChallenge;
+using static Android.Locations.GpsStatus;
using AlertDialog = Android.App.AlertDialog;
using ClipboardManager = Android.Content.ClipboardManager;
using Enum = System.Enum;
using Exception = System.Exception;
+using File = Java.IO.File;
+using FileNotFoundException = Java.IO.FileNotFoundException;
+using Object = Java.Lang.Object;
+using Process = Android.OS.Process;
using String = System.String;
using Toolbar = AndroidX.AppCompat.Widget.Toolbar;
-using AndroidX.Core.Content;
namespace keepass2android
{
@@ -651,7 +649,7 @@ namespace keepass2android
_activityDesign.ApplyTheme();
base.OnCreate(savedInstanceState);
- _intentReceiver = new PasswordActivityBroadcastReceiver(this);
+ _intentReceiver = new PasswordActivityBroadcastReceiver(this);
IntentFilter filter = new IntentFilter();
filter.AddAction(Intent.ActionScreenOff);
ContextCompat.RegisterReceiver(this, _intentReceiver, filter, (int)ReceiverFlags.Exported);
@@ -1165,7 +1163,9 @@ namespace keepass2android
changeDbButton.Click += (sender, args) => GoToFileSelectActivity();
Util.MoveBottomBarButtons(Resource.Id.change_db, Resource.Id.pass_ok, Resource.Id.bottom_bar, this);
- }
+ Util.InsetListener.ForBottomElement(FindViewById(Resource.Id.bottom_bar)).Apply();
+ Util.InsetListener.ForTopElement(FindViewById(Resource.Id.appbar)).Apply();
+ }
private void OnOk(bool usedFingerprintUnlock = false)
{
diff --git a/src/keepass2android-app/QuickUnlock.cs b/src/keepass2android-app/QuickUnlock.cs
index 4a8b35fa..d57fd51f 100644
--- a/src/keepass2android-app/QuickUnlock.cs
+++ b/src/keepass2android-app/QuickUnlock.cs
@@ -81,8 +81,11 @@ namespace keepass2android
SetContentView(Resource.Layout.QuickUnlock);
+ Util.InsetListener.ForBottomElement(FindViewById(Resource.Id.bottom_bar)).Apply();
+ Util.InsetListener.ForTopElement(FindViewById(Resource.Id.appbar)).Apply();
- var collapsingToolbar = FindViewById(Resource.Id.collapsing_toolbar);
+
+ var collapsingToolbar = FindViewById(Resource.Id.collapsing_toolbar);
collapsingToolbar.SetTitle(GetString(Resource.String.QuickUnlock_prefs));
SetSupportActionBar(FindViewById(Resource.Id.toolbar));
diff --git a/src/keepass2android-app/Resources/layout/QuickUnlock.xml b/src/keepass2android-app/Resources/layout/QuickUnlock.xml
index 0c4da5c4..70bd4b02 100644
--- a/src/keepass2android-app/Resources/layout/QuickUnlock.xml
+++ b/src/keepass2android-app/Resources/layout/QuickUnlock.xml
@@ -1,11 +1,11 @@
+android:fitsSystemWindows="false">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
- android:fitsSystemWindows="true">
+ android:fitsSystemWindows="false">
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
- android:fitsSystemWindows="true"
+ android:fitsSystemWindows="false"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginEnd="24dp"
app:expandedTitleMarginBottom="20sp">
diff --git a/src/keepass2android-app/Resources/layout/generate_password.xml b/src/keepass2android-app/Resources/layout/generate_password.xml
index 6eca0d7f..351c7bd7 100644
--- a/src/keepass2android-app/Resources/layout/generate_password.xml
+++ b/src/keepass2android-app/Resources/layout/generate_password.xml
@@ -1,5 +1,6 @@
@@ -322,4 +323,3 @@
-
diff --git a/src/keepass2android-app/Resources/layout/password.xml b/src/keepass2android-app/Resources/layout/password.xml
index b21a343f..af9a3745 100644
--- a/src/keepass2android-app/Resources/layout/password.xml
+++ b/src/keepass2android-app/Resources/layout/password.xml
@@ -1,10 +1,10 @@
-
+>
+ android:layout_weight="1">
@@ -446,4 +448,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/keepass2android-app/Resources/values-night-v35/themes.xml b/src/keepass2android-app/Resources/values-night-v35/themes.xml
new file mode 100644
index 00000000..86a3ae7f
--- /dev/null
+++ b/src/keepass2android-app/Resources/values-night-v35/themes.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/keepass2android-app/Resources/values-v35/themes.xml b/src/keepass2android-app/Resources/values-v35/themes.xml
new file mode 100644
index 00000000..3bf426f4
--- /dev/null
+++ b/src/keepass2android-app/Resources/values-v35/themes.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/keepass2android-app/Resources/values/dimens.xml b/src/keepass2android-app/Resources/values/dimens.xml
index dbc57788..982af1db 100644
--- a/src/keepass2android-app/Resources/values/dimens.xml
+++ b/src/keepass2android-app/Resources/values/dimens.xml
@@ -4,7 +4,7 @@
16dp
16dp
- 200dp
+ 250dp
16dp
79dp
diff --git a/src/keepass2android-app/Resources/values/themes.xml b/src/keepass2android-app/Resources/values/themes.xml
index 9635d989..d9b6d6fd 100644
--- a/src/keepass2android-app/Resources/values/themes.xml
+++ b/src/keepass2android-app/Resources/values/themes.xml
@@ -253,12 +253,12 @@
- @color/statusbar_color_green
-
+
+
diff --git a/src/keepass2android-app/Utils/Util.cs b/src/keepass2android-app/Utils/Util.cs
index a26befca..64a2e6a3 100644
--- a/src/keepass2android-app/Utils/Util.cs
+++ b/src/keepass2android-app/Utils/Util.cs
@@ -35,7 +35,9 @@ using Android.Graphics.Drawables;
using Android.Hardware.Display;
using Android.Util;
using Android.Views.InputMethods;
+using AndroidX.Core.View;
using AndroidX.Core.View.InputMethod;
+using AndroidX.ViewPager2.Widget;
using Google.Android.Material.Dialog;
using KeePass.Util;
using keepass2android;
@@ -738,7 +740,73 @@ namespace keepass2android
+ public class InsetListener: Java.Lang.Object, IOnApplyWindowInsetsListener
+ {
+ private View _targetView;
+ private readonly int _insetsType;
+ private int _initialPaddingLeft;
+ private int _initialPaddingTop;
+ private int _initialPaddingRight;
+ private int _initialPaddingBottom;
+
+ public bool EnabledPaddingLeft { get; set; } = true;
+ public bool EnablePaddingTop { get; set; } = true;
+ public bool EnablePaddingRight { get; set; } = true;
+ public bool EnablePaddingBottom { get; set; } = true;
+
+ public InsetListener(View targetView, int insetsType)
+ {
+ _targetView = targetView;
+ _insetsType = insetsType;
+ _initialPaddingLeft = targetView.PaddingLeft;
+ _initialPaddingTop = targetView.PaddingTop;
+ _initialPaddingRight = targetView.PaddingRight;
+ _initialPaddingBottom = targetView.PaddingBottom;
+ }
+
+ public InsetListener(View targetView): this(targetView, WindowInsetsCompat.Type.SystemBars())
+ {
+
+
+ }
+
+ public WindowInsetsCompat OnApplyWindowInsets(View v, WindowInsetsCompat insets)
+ {
+ var systemBarsInsets = insets.GetInsets(_insetsType);
+
+ _targetView.SetPadding(
+ _initialPaddingLeft + (EnabledPaddingLeft ? systemBarsInsets.Left : 0),
+ _initialPaddingTop + (EnablePaddingTop ? systemBarsInsets.Top : 0),
+ _initialPaddingRight + (EnablePaddingRight ? systemBarsInsets.Right : 0),
+ _initialPaddingBottom + (EnablePaddingBottom ? systemBarsInsets.Bottom : 0)
+ );
+
+
+ return insets;
+ }
+
+ public static InsetListener ForBottomElement(View view)
+ {
+ return new InsetListener(view, WindowInsetsCompat.Type.Ime() | WindowInsetsCompat.Type.SystemBars() | WindowInsetsCompat.Type.DisplayCutout())
+ {
+ EnablePaddingTop = false
+ };
+ }
+ public static InsetListener ForTopElement(View view)
+ {
+ return new InsetListener(view, WindowInsetsCompat.Type.SystemBars() | WindowInsetsCompat.Type.DisplayCutout())
+ {
+ EnablePaddingBottom = false
+ };
+ }
+
+ public void Apply()
+ {
+ ViewCompat.SetOnApplyWindowInsetsListener(_targetView, this);
+
+ }
+ }
public static void MoveBottomBarButtons(int btn1Id, int btn2Id, int bottomBarId, Activity context)
{
diff --git a/src/keepass2android-app/settings/AppSettingsActivity.cs b/src/keepass2android-app/settings/AppSettingsActivity.cs
index b41c14b6..a4bf5204 100644
--- a/src/keepass2android-app/settings/AppSettingsActivity.cs
+++ b/src/keepass2android-app/settings/AppSettingsActivity.cs
@@ -1217,7 +1217,7 @@ namespace keepass2android
{
_design.ApplyTheme();
base.OnCreate(savedInstanceState);
-
+ new Util.InsetListener(FindViewById(Resource.Id.settings)).Apply();
}
diff --git a/src/keepass2android-app/settings/DatabaseSettingsActivity.cs b/src/keepass2android-app/settings/DatabaseSettingsActivity.cs
index 7ad6f3fe..7c95bbe6 100644
--- a/src/keepass2android-app/settings/DatabaseSettingsActivity.cs
+++ b/src/keepass2android-app/settings/DatabaseSettingsActivity.cs
@@ -163,6 +163,7 @@ namespace keepass2android
{
_design.ApplyTheme();
base.OnCreate(savedInstanceState);
+ new Util.InsetListener(FindViewById(Resource.Id.settings)).Apply();
}