Compare commits

..

2 Commits

Author SHA1 Message Date
Philipp Crocoll
319d197d79 manifest for 1.12-r5-test2848 2025-04-15 18:20:14 +02:00
Philipp Crocoll
b459e9f9a5 add logging and improve permissions checking for issues with showing the Activate Keyboard screen. 2025-04-15 17:57:51 +02:00
18 changed files with 123 additions and 471 deletions

View File

@@ -56,6 +56,8 @@ using Android.Util;
using AndroidX.Core.Content;
using Google.Android.Material.Dialog;
using keepass2android;
using AndroidX.Core.App;
using Google.Android.Material.Snackbar;
namespace keepass2android
{
@@ -571,13 +573,41 @@ namespace keepass2android
if (permissions.Length == 1 && permissions.First() == Android.Manifest.Permission.PostNotifications &&
grantResults.First() == Permission.Granted)
{
StartNotificationsServiceAfterPermissionsCheck(requestCode == 1 /*requestCode is used to transfer this flag*/);
if (!CopyToClipboardService.HasEntryNotificationPermissions(this, false))
{
Intent intent = new Intent();
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
{
intent.SetAction(Android.Provider.Settings.ActionAppNotificationSettings);
intent.PutExtra(Android.Provider.Settings.ExtraAppPackage, PackageName);
}
else if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
intent.SetAction(Android.Provider.Settings.ActionAppNotificationSettings);
intent.PutExtra("app_package", PackageName);
intent.PutExtra("app_uid", ApplicationInfo.Uid);
}
else
{
intent.SetAction(Android.Provider.Settings.ActionApplicationDetailsSettings);
intent.AddCategory(Intent.CategoryDefault);
intent.SetData(Uri.Parse("package:" + PackageName));
}
StartActivity(intent);
}
else
{
Kp2aLog.Log($"StartNotificationsServiceAfterPermissionsCheck(activateKeyboard: requestCode == {requestCode}");
StartNotificationsServiceAfterPermissionsCheck(requestCode == 1 /*requestCode is used to transfer this flag*/);
}
}
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
internal void StartNotificationsService(bool activateKeyboard)
{
Kp2aLog.Log($"StartNotificationsService. ActivateKeyboard={activateKeyboard}");
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
GetString(Resource.String.CopyToClipboardNotification_key),
Resources.GetBoolean(Resource.Boolean.CopyToClipboardNotification_default)) == false
@@ -585,14 +615,18 @@ namespace keepass2android
GetString(Resource.String.UseKp2aKeyboard_key),
Resources.GetBoolean(Resource.Boolean.UseKp2aKeyboard_default)) == false)
{
//notifications are disabled
//notifications are disabled
Kp2aLog.Log($"StartNotificationsService. Notifications disabled. Returning.");
return;
}
if ((int)Build.VERSION.SdkInt < 33 || CheckSelfPermission(Android.Manifest.Permission.PostNotifications) ==
Permission.Granted)
{
StartNotificationsServiceAfterPermissionsCheck(activateKeyboard);
if ((int)Build.VERSION.SdkInt < 33 || CopyToClipboardService.HasEntryNotificationPermissions(this, activateKeyboard))
{
Kp2aLog.Log($"StartNotificationsService. Permissions ok. activateKeyboard={activateKeyboard}");
StartNotificationsServiceAfterPermissionsCheck(activateKeyboard);
return;
}
@@ -602,16 +636,40 @@ namespace keepass2android
if (!ShouldShowRequestPermissionRationale(Android.Manifest.Permission.PostNotifications) //this menthod returns false if we haven't asked yet or if the user has denied permission too often
&& PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean("RequestedPostNotificationsPermission", false))//use a preference to tell the difference between "haven't asked yet" and "have asked too often"
{
//user has denied permission before. Do not show the dialog. User must give permission in the Android App settings.
Kp2aLog.Log($"StartNotificationsService. Permissions not granted. Showing snackbar.");
//user has denied permission before. Do not show the dialog. User must give permission in the Android App settings.
var snackbar = Snackbar
.Make(SnackbarAnchorView, Resource.String.post_notifications_snackbar,
Snackbar.LengthIndefinite);
snackbar.SetTextMaxLines(10);
if ((int)Build.VERSION.SdkInt >= 23)
{
snackbar.SetBackgroundTint(App.Context.GetColor(Resource.Color.md_theme_inverseSurface));
snackbar.SetTextColor(App.Context.GetColor(Resource.Color.md_theme_inverseOnSurface));
}
snackbar.SetAction(Resource.String.post_notifications_snackbar_config, view => { ShowNotificationPermissionsDialog(activateKeyboard); });
snackbar.Show();
return;
}
ShowNotificationPermissionsDialog(activateKeyboard);
}
private void ShowNotificationPermissionsDialog(bool activateKeyboard)
{
Kp2aLog.Log($"ShowNotificationPermissionsDialog");
new MaterialAlertDialogBuilder(this)
.SetTitle(Resource.String.post_notifications_dialog_title)
.SetMessage(Resource.String.post_notifications_dialog_message)
.SetNegativeButton(Resource.String.post_notifications_dialog_disable, (sender, args) =>
{
//disable this dialog for the future by disabling the notification preferences
//disable this dialog for the future by disabling the notification preferences
var edit= PreferenceManager.GetDefaultSharedPreferences(this).Edit();
edit.PutBoolean(GetString(Resource.String.CopyToClipboardNotification_key), false);
edit.PutBoolean(GetString(Resource.String.UseKp2aKeyboard_key), false);
@@ -632,8 +690,6 @@ namespace keepass2android
})
.SetNeutralButton(Resource.String.post_notifications_dialog_notnow, (sender, args) => { })
.Show();
}
private void StartNotificationsServiceAfterPermissionsCheck(bool activateKeyboard)

View File

@@ -331,18 +331,14 @@ namespace keepass2android
}
private bool hasRequestedKeyboardActivation = false;
protected override void OnStart()
protected override void OnStart()
{
base.OnStart();
if (PreferenceManager.GetDefaultSharedPreferences(this)
.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)
&& (!hasRequestedKeyboardActivation))
.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false))
{
//only try this once. if the user clicks cancel, we don't want to ask again
// (it may happen that the activity is restarted because of the NewTask flag immediately after the dialog)
hasRequestedKeyboardActivation = true;
CopyToClipboardService.ActivateKeyboard(this);
Kp2aLog.Log("Activating keyboard in EntryEditActivity due to UseKp2aKeyboardInKp2a");
CopyToClipboardService.ActivateKeyboard(this);
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="206"
android:versionName="1.12-r5"
android:versionCode="207"
android:versionName="1.12-r5-test2848"
package="keepass2android.keepass2android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">

View File

@@ -1570,18 +1570,15 @@ namespace keepass2android
base.OnPause();
}
private bool hasRequestedKeyboardActivation = false;
protected override void OnStart()
{
base.OnStart();
_starting = true;
if (PreferenceManager.GetDefaultSharedPreferences(this)
.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)
&& !hasRequestedKeyboardActivation)
{
hasRequestedKeyboardActivation = true;
.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false))
{
Kp2aLog.Log("Activating keyboard in PasswordActivity due to UseKp2aKeyboardInKp2a");
CopyToClipboardService.ActivateKeyboard(this);
}

View File

@@ -1,9 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
@@ -19,7 +14,6 @@
android:text="@string/switch_ime_text" />
<Button
android:id="@+id/btn_reopen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -31,51 +25,4 @@
android:layout_height="wrap_content"
android:text="@string/cancel" />
<LinearLayout android:orientation="vertical"
android:paddingTop="64dp"
android:id="@+id/settings_notes_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:paddingTop="12dp"
android:id="@+id/note_kp2a_switch_rooted"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/autoswitch_enabled_but_not_setup"
/>
<TextView
android:paddingTop="12dp"
android:id="@+id/note_AutoFillTotp_prefs_ActivateKeyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/switch_keyboard_for_totp_enabled"
/>
<TextView
android:paddingTop="12dp"
android:id="@+id/note_UseKp2aKeyboardInKp2a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/switch_keyboard_inside_kp2a_enabled"
/>
<TextView
android:id="@+id/note_OpenKp2aKeyboardAutomatically"
android:paddingTop="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/switch_keyboard_on_search_enabled"
/>
<Button
style="?attr/materialButtonOutlinedStyle"
android:id="@+id/btn_open_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/IconVisibilityInfo_Android8_btnSettings" />
</LinearLayout>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -142,146 +142,4 @@
<color name="md_theme_surfaceContainer_highContrast">#1D2118</color>
<color name="md_theme_surfaceContainerHigh_highContrast">#282B22</color>
<color name="md_theme_surfaceContainerHighest_highContrast">#32362C</color>
<color name="md_theme_lowstim_primary">#91C456</color>
<color name="md_theme_lowstim_onPrimary">#192E00</color>
<color name="md_theme_lowstim_primaryContainer">#719E3A</color>
<color name="md_theme_lowstim_onPrimaryContainer">#112200</color>
<color name="md_theme_lowstim_secondary">#84ACD9</color>
<color name="md_theme_lowstim_onSecondary">#002947</color>
<color name="md_theme_lowstim_secondaryContainer">#005D94</color>
<color name="md_theme_lowstim_onSecondaryContainer">#DEDEDE</color>
<color name="md_theme_lowstim_tertiary">#40B385</color>
<color name="md_theme_lowstim_onTertiary">#002F1E</color>
<color name="md_theme_lowstim_tertiaryContainer">#00A676</color>
<color name="md_theme_lowstim_onTertiaryContainer">#002216</color>
<color name="md_theme_lowstim_error">#D49B94</color>
<color name="md_theme_lowstim_onError">#590004</color>
<color name="md_theme_lowstim_errorContainer">#7D0008</color>
<color name="md_theme_lowstim_onErrorContainer">#D4B9B3</color>
<color name="md_theme_lowstim_background">#0F130A</color>
<color name="md_theme_lowstim_onBackground">#BEE0C4</color>
<color name="md_theme_lowstim_surface">#0F130A</color>
<color name="md_theme_lowstim_onSurface">#BEE0C4</color>
<color name="md_theme_lowstim_surfaceVariant">#383E30</color>
<color name="md_theme_lowstim_onSurfaceVariant">#A6AD99</color>
<color name="md_theme_lowstim_outline">#757B68</color>
<color name="md_theme_lowstim_outlineVariant">#383E30</color>
<color name="md_theme_lowstim_scrim">#000000</color>
<color name="md_theme_lowstim_inverseSurface">#BEE0C4</color>
<color name="md_theme_lowstim_inverseOnSurface">#272B22</color>
<color name="md_theme_lowstim_inversePrimary">#345800</color>
<color name="md_theme_lowstim_primaryFixed">#9ED75B</color>
<color name="md_theme_lowstim_onPrimaryFixed">#0C1B00</color>
<color name="md_theme_lowstim_primaryFixedDim">#82B750</color>
<color name="md_theme_lowstim_onPrimaryFixedVariant">#264200</color>
<color name="md_theme_lowstim_secondaryFixed">#B2D1E5</color>
<color name="md_theme_lowstim_onSecondaryFixed">#00192E</color>
<color name="md_theme_lowstim_secondaryFixedDim">#84ACD9</color>
<color name="md_theme_lowstim_onSecondaryFixedVariant">#003E66</color>
<color name="md_theme_lowstim_tertiaryFixed">#4EC79E</color>
<color name="md_theme_lowstim_onTertiaryFixed">#001D11</color>
<color name="md_theme_lowstim_tertiaryFixedDim">#2EBDA1</color>
<color name="md_theme_lowstim_onTertiaryFixedVariant">#004530</color>
<color name="md_theme_lowstim_surfaceDim">#0F130A</color>
<color name="md_theme_lowstim_surfaceBright">#2E3229</color>
<color name="md_theme_lowstim_surfaceContainerLowest">#0A0D07</color>
<color name="md_theme_lowstim_surfaceContainerLow">#161A11</color>
<color name="md_theme_lowstim_surfaceContainer">#191D14</color>
<color name="md_theme_lowstim_surfaceContainerHigh">#23271E</color>
<color name="md_theme_lowstim_surfaceContainerHighest">#2B2F26</color>
<color name="md_theme_lowstim_primary_mediumContrast">#91C456</color>
<color name="md_theme_lowstim_onPrimary_mediumContrast">#101E00</color>
<color name="md_theme_lowstim_primaryContainer_mediumContrast">#719E3A</color>
<color name="md_theme_lowstim_onPrimaryContainer_mediumContrast">#000000</color>
<color name="md_theme_lowstim_secondary_mediumContrast">#88B3D6</color>
<color name="md_theme_lowstim_onSecondary_mediumContrast">#001524</color>
<color name="md_theme_lowstim_secondaryContainer_mediumContrast">#3481B7</color>
<color name="md_theme_lowstim_onSecondaryContainer_mediumContrast">#000000</color>
<color name="md_theme_lowstim_tertiary_mediumContrast">#40B385</color>
<color name="md_theme_lowstim_onTertiary_mediumContrast">#002216</color>
<color name="md_theme_lowstim_tertiaryContainer_mediumContrast">#00A676</color>
<color name="md_theme_lowstim_onTertiaryContainer_mediumContrast">#000000</color>
<color name="md_theme_lowstim_error_mediumContrast">#D4A29A</color>
<color name="md_theme_lowstim_onError_mediumContrast">#2F0001</color>
<color name="md_theme_lowstim_errorContainer_mediumContrast">#D4463B</color>
<color name="md_theme_lowstim_onErrorContainer_mediumContrast">#000000</color>
<color name="md_theme_lowstim_background_mediumContrast">#0F130A</color>
<color name="md_theme_lowstim_onBackground_mediumContrast">#BEE0C4</color>
<color name="md_theme_lowstim_surface_mediumContrast">#0F130A</color>
<color name="md_theme_lowstim_onSurface_mediumContrast">#D6E6CD</color>
<color name="md_theme_lowstim_surfaceVariant_mediumContrast">#383E30</color>
<color name="md_theme_lowstim_onSurfaceVariant_mediumContrast">#AAB1A0</color>
<color name="md_theme_lowstim_outline_mediumContrast">#888E7B</color>
<color name="md_theme_lowstim_outlineVariant_mediumContrast">#6B7163</color>
<color name="md_theme_lowstim_scrim_mediumContrast">#000000</color>
<color name="md_theme_lowstim_inverseSurface_mediumContrast">#BEE0C4</color>
<color name="md_theme_lowstim_inverseOnSurface_mediumContrast">#23261E</color>
<color name="md_theme_lowstim_inversePrimary_mediumContrast">#294500</color>
<color name="md_theme_lowstim_primaryFixed_mediumContrast">#9ED75B</color>
<color name="md_theme_lowstim_onPrimaryFixed_mediumContrast">#071000</color>
<color name="md_theme_lowstim_primaryFixedDim_mediumContrast">#82B750</color>
<color name="md_theme_lowstim_onPrimaryFixedVariant_mediumContrast">#1D3300</color>
<color name="md_theme_lowstim_secondaryFixed_mediumContrast">#B2D1E5</color>
<color name="md_theme_lowstim_onSecondaryFixed_mediumContrast">#00101D</color>
<color name="md_theme_lowstim_secondaryFixedDim_mediumContrast">#84ACD9</color>
<color name="md_theme_lowstim_onSecondaryFixedVariant_mediumContrast">#003151</color>
<color name="md_theme_lowstim_tertiaryFixed_mediumContrast">#4EC79E</color>
<color name="md_theme_lowstim_onTertiaryFixed_mediumContrast">#001109</color>
<color name="md_theme_lowstim_tertiaryFixedDim_mediumContrast">#2EBDA1</color>
<color name="md_theme_lowstim_onTertiaryFixedVariant_mediumContrast">#003523</color>
<color name="md_theme_lowstim_surfaceDim_mediumContrast">#0F130A</color>
<color name="md_theme_lowstim_surfaceBright_mediumContrast">#2E3229</color>
<color name="md_theme_lowstim_surfaceContainerLowest_mediumContrast">#0A0D07</color>
<color name="md_theme_lowstim_surfaceContainerLow_mediumContrast">#161A11</color>
<color name="md_theme_lowstim_surfaceContainer_mediumContrast">#191D14</color>
<color name="md_theme_lowstim_surfaceContainerHigh_mediumContrast">#23271E</color>
<color name="md_theme_lowstim_surfaceContainerHighest_mediumContrast">#2B2F26</color>
<color name="md_theme_lowstim_primary_highContrast">#D6FF99</color>
<color name="md_theme_lowstim_onPrimary_highContrast">#000000</color>
<color name="md_theme_lowstim_primaryContainer_highContrast">#8AC757</color>
<color name="md_theme_lowstim_onPrimaryContainer_highContrast">#000000</color>
<color name="md_theme_lowstim_secondary_highContrast">#D1D1FF</color>
<color name="md_theme_lowstim_onSecondary_highContrast">#000000</color>
<color name="md_theme_lowstim_secondaryContainer_highContrast">#88B3D6</color>
<color name="md_theme_lowstim_onSecondaryContainer_highContrast">#000000</color>
<color name="md_theme_lowstim_tertiary_highContrast">#B0FFD1</color>
<color name="md_theme_lowstim_onTertiary_highContrast">#000000</color>
<color name="md_theme_lowstim_tertiaryContainer_highContrast">#34B780</color>
<color name="md_theme_lowstim_onTertiaryContainer_highContrast">#000000</color>
<color name="md_theme_lowstim_error_highContrast">#eFDADA</color>
<color name="md_theme_lowstim_onError_highContrast">#000000</color>
<color name="md_theme_lowstim_errorContainer_highContrast">#D4A29A</color>
<color name="md_theme_lowstim_onErrorContainer_highContrast">#000000</color>
<color name="md_theme_lowstim_background_highContrast">#0F130A</color>
<color name="md_theme_lowstim_onBackground_highContrast">#BEE0C4</color>
<color name="md_theme_lowstim_surface_highContrast">#0F130A</color>
<color name="md_theme_lowstim_onSurface_highContrast">#eFeFeF</color>
<color name="md_theme_lowstim_surfaceVariant_highContrast">#383E30</color>
<color name="md_theme_lowstim_onSurfaceVariant_highContrast">#D4E4C6</color>
<color name="md_theme_lowstim_outline_highContrast">#AAB1A0</color>
<color name="md_theme_lowstim_outlineVariant_highContrast">#AAB1A0</color>
<color name="md_theme_lowstim_scrim_highContrast">#000000</color>
<color name="md_theme_lowstim_inverseSurface_highContrast">#BEE0C4</color>
<color name="md_theme_lowstim_inverseOnSurface_highContrast">#000000</color>
<color name="md_theme_lowstim_inversePrimary_highContrast">#152900</color>
<color name="md_theme_lowstim_primaryFixed_highContrast">#C2FF80</color>
<color name="md_theme_lowstim_onPrimaryFixed_highContrast">#000000</color>
<color name="md_theme_lowstim_primaryFixedDim_highContrast">#8AC757</color>
<color name="md_theme_lowstim_onPrimaryFixedVariant_highContrast">#0A1500</color>
<color name="md_theme_lowstim_secondaryFixed_highContrast">#DEDEFF</color>
<color name="md_theme_lowstim_onSecondaryFixed_highContrast">#000000</color>
<color name="md_theme_lowstim_secondaryFixedDim_highContrast">#88B3D6</color>
<color name="md_theme_lowstim_onSecondaryFixedVariant_highContrast">#001524</color>
<color name="md_theme_lowstim_tertiaryFixed_highContrast">#95FFB7</color>
<color name="md_theme_lowstim_onTertiaryFixed_highContrast">#000000</color>
<color name="md_theme_lowstim_tertiaryFixedDim_highContrast">#34B780</color>
<color name="md_theme_lowstim_onTertiaryFixedVariant_highContrast">#00180D</color>
<color name="md_theme_lowstim_surfaceDim_highContrast">#0F130A</color>
<color name="md_theme_lowstim_surfaceBright_highContrast">#2E3229</color>
<color name="md_theme_lowstim_surfaceContainerLowest_highContrast">#0A0D07</color>
<color name="md_theme_lowstim_surfaceContainerLow_highContrast">#161A11</color>
<color name="md_theme_lowstim_surfaceContainer_highContrast">#191D14</color>
<color name="md_theme_lowstim_surfaceContainerHigh_highContrast">#23271E</color>
<color name="md_theme_lowstim_surfaceContainerHighest_highContrast">#2B2F26</color>
</resources>

View File

@@ -142,146 +142,4 @@
<color name="md_theme_surfaceContainer_highContrast">#E9EFF0</color>
<color name="md_theme_surfaceContainerHigh_highContrast">#E3E9EA</color>
<color name="md_theme_surfaceContainerHighest_highContrast">#DEE3E5</color>
<color name="md_theme_lowstim_primary">#3F5625</color>
<color name="md_theme_lowstim_onPrimary">#DEDEDE</color>
<color name="md_theme_lowstim_primaryContainer">#A8C288</color>
<color name="md_theme_lowstim_onPrimaryContainer">#0C1B00</color>
<color name="md_theme_lowstim_secondary">#295377</color>
<color name="md_theme_lowstim_onSecondary">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryContainer">#B2D1E5</color>
<color name="md_theme_lowstim_onSecondaryContainer">#00192E</color>
<color name="md_theme_lowstim_tertiary">#325653</color>
<color name="md_theme_lowstim_onTertiary">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryContainer">#98B2B0</color>
<color name="md_theme_lowstim_onTertiaryContainer">#001B1A</color>
<color name="md_theme_lowstim_error">#9F1717</color>
<color name="md_theme_lowstim_onError">#DEDEDE</color>
<color name="md_theme_lowstim_errorContainer">#D4B9B3</color>
<color name="md_theme_lowstim_onErrorContainer">#370002</color>
<color name="md_theme_lowstim_background">#D6D6D6</color>
<color name="md_theme_lowstim_onBackground">#171913</color>
<color name="md_theme_lowstim_surface">#D2D9DA</color>
<color name="md_theme_lowstim_onSurface">#141819</color>
<color name="md_theme_lowstim_surfaceVariant">#B9BDB6</color>
<color name="md_theme_lowstim_onSurfaceVariant">#3B4034</color>
<color name="md_theme_lowstim_outline">#64675B</color>
<color name="md_theme_lowstim_outlineVariant">#A8ABA2</color>
<color name="md_theme_lowstim_scrim">#000000</color>
<color name="md_theme_lowstim_inverseSurface">#252A2B</color>
<color name="md_theme_lowstim_inverseOnSurface">#C7CFCF</color>
<color name="md_theme_lowstim_inversePrimary">#94B173</color>
<color name="md_theme_lowstim_primaryFixed">#A8C288</color>
<color name="md_theme_lowstim_onPrimaryFixed">#0C1B00</color>
<color name="md_theme_lowstim_primaryFixedDim">#94B173</color>
<color name="md_theme_lowstim_onPrimaryFixedVariant">#2E4114</color>
<color name="md_theme_lowstim_secondaryFixed">#B2D1E5</color>
<color name="md_theme_lowstim_onSecondaryFixed">#00192E</color>
<color name="md_theme_lowstim_secondaryFixedDim">#84ACD9</color>
<color name="md_theme_lowstim_onSecondaryFixedVariant">#104064</color>
<color name="md_theme_lowstim_tertiaryFixed">#98B2B0</color>
<color name="md_theme_lowstim_onTertiaryFixed">#001B1A</color>
<color name="md_theme_lowstim_tertiaryFixedDim">#88B2AF</color>
<color name="md_theme_lowstim_onTertiaryFixedVariant">#1A423F</color>
<color name="md_theme_lowstim_surfaceDim">#B6BEC0</color>
<color name="md_theme_lowstim_surfaceBright">#D2D9DA</color>
<color name="md_theme_lowstim_surfaceContainerLowest">#DEDEDE</color>
<color name="md_theme_lowstim_surfaceContainerLow">#CEDAEC</color>
<color name="md_theme_lowstim_surfaceContainer">#CAD0D1</color>
<color name="md_theme_lowstim_surfaceContainerHigh">#C9D1D2</color>
<color name="md_theme_lowstim_surfaceContainerHighest">#C0C9C7</color>
<color name="md_theme_lowstim_primary_mediumContrast">#2A3F0E</color>
<color name="md_theme_lowstim_onPrimary_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_primaryContainer_mediumContrast">#526B36</color>
<color name="md_theme_lowstim_onPrimaryContainer_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondary_mediumContrast">#0A3E5F</color>
<color name="md_theme_lowstim_onSecondary_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryContainer_mediumContrast">#3E698D</color>
<color name="md_theme_lowstim_onSecondaryContainer_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiary_mediumContrast">#173F3D</color>
<color name="md_theme_lowstim_onTertiary_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryContainer_mediumContrast">#426A66</color>
<color name="md_theme_lowstim_onTertiaryContainer_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_error_mediumContrast">#750008</color>
<color name="md_theme_lowstim_onError_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_errorContainer_mediumContrast">#B92F28</color>
<color name="md_theme_lowstim_onErrorContainer_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_background_mediumContrast">#D6D7D0</color>
<color name="md_theme_lowstim_onBackground_mediumContrast">#171913</color>
<color name="md_theme_lowstim_surface_mediumContrast">#D2D9DA</color>
<color name="md_theme_lowstim_onSurface_mediumContrast">#141819</color>
<color name="md_theme_lowstim_surfaceVariant_mediumContrast">#B9BDB6</color>
<color name="md_theme_lowstim_onSurfaceVariant_mediumContrast">#363B30</color>
<color name="md_theme_lowstim_outline_mediumContrast">#4F5347</color>
<color name="md_theme_lowstim_outlineVariant_mediumContrast">#696D61</color>
<color name="md_theme_lowstim_scrim_mediumContrast">#000000</color>
<color name="md_theme_lowstim_inverseSurface_mediumContrast">#252A2B</color>
<color name="md_theme_lowstim_inverseOnSurface_mediumContrast">#C7CFCF</color>
<color name="md_theme_lowstim_inversePrimary_mediumContrast">#94B173</color>
<color name="md_theme_lowstim_primaryFixed_mediumContrast">#526B36</color>
<color name="md_theme_lowstim_onPrimaryFixed_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_primaryFixedDim_mediumContrast">#3B531F</color>
<color name="md_theme_lowstim_onPrimaryFixedVariant_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryFixed_mediumContrast">#3E698D</color>
<color name="md_theme_lowstim_onSecondaryFixed_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryFixedDim_mediumContrast">#295377</color>
<color name="md_theme_lowstim_onSecondaryFixedVariant_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryFixed_mediumContrast">#426A66</color>
<color name="md_theme_lowstim_onTertiaryFixed_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryFixedDim_mediumContrast">#2E5350</color>
<color name="md_theme_lowstim_onTertiaryFixedVariant_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_surfaceDim_mediumContrast">#B6BEC0</color>
<color name="md_theme_lowstim_surfaceBright_mediumContrast">#D2D9DA</color>
<color name="md_theme_lowstim_surfaceContainerLowest_mediumContrast">#DEDEDE</color>
<color name="md_theme_lowstim_surfaceContainerLow_mediumContrast">#CEDAEC</color>
<color name="md_theme_lowstim_surfaceContainer_mediumContrast">#CAD0D1</color>
<color name="md_theme_lowstim_surfaceContainerHigh_mediumContrast">#C9D1D2</color>
<color name="md_theme_lowstim_surfaceContainerHighest_mediumContrast">#C0C9C7</color>
<color name="md_theme_lowstim_primary_highContrast">#051400</color>
<color name="md_theme_lowstim_onPrimary_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_primaryContainer_highContrast">#0F2000</color>
<color name="md_theme_lowstim_onPrimaryContainer_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondary_highContrast">#000F1D</color>
<color name="md_theme_lowstim_onSecondary_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryContainer_highContrast">#0B466F</color>
<color name="md_theme_lowstim_onSecondaryContainer_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiary_highContrast">#001312</color>
<color name="md_theme_lowstim_onTertiary_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryContainer_highContrast">#1A4A47</color>
<color name="md_theme_lowstim_onTertiaryContainer_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_error_highContrast">#170001</color>
<color name="md_theme_lowstim_onError_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_errorContainer_highContrast">#2A0004</color>
<color name="md_theme_lowstim_onErrorContainer_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_background_highContrast">#D6D7D0</color>
<color name="md_theme_lowstim_onBackground_highContrast">#171913</color>
<color name="md_theme_lowstim_surface_highContrast">#D2D9DA</color>
<color name="md_theme_lowstim_onSurface_highContrast">#000000</color>
<color name="md_theme_lowstim_surfaceVariant_highContrast">#B9BDB6</color>
<color name="md_theme_lowstim_onSurfaceVariant_highContrast">#1B1E17</color>
<color name="md_theme_lowstim_outline_highContrast">#363B30</color>
<color name="md_theme_lowstim_outlineVariant_highContrast">#363B30</color>
<color name="md_theme_lowstim_scrim_highContrast">#000000</color>
<color name="md_theme_lowstim_inverseSurface_highContrast">#252A2B</color>
<color name="md_theme_lowstim_inverseOnSurface_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_inversePrimary_highContrast">#B1D18A</color>
<color name="md_theme_lowstim_primaryFixed_highContrast">#0F2000</color>
<color name="md_theme_lowstim_onPrimaryFixed_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_primaryFixedDim_highContrast">#071700</color>
<color name="md_theme_lowstim_onPrimaryFixedVariant_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryFixed_highContrast">#0B466F</color>
<color name="md_theme_lowstim_onSecondaryFixed_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_secondaryFixedDim_highContrast">#002643</color>
<color name="md_theme_lowstim_onSecondaryFixedVariant_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryFixed_highContrast">#1A4A47</color>
<color name="md_theme_lowstim_onTertiaryFixed_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_tertiaryFixedDim_highContrast">#001D1B</color>
<color name="md_theme_lowstim_onTertiaryFixedVariant_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_surfaceDim_highContrast">#B6BEC0</color>
<color name="md_theme_lowstim_surfaceBright_highContrast">#D2D9DA</color>
<color name="md_theme_lowstim_surfaceContainerLowest_highContrast">#DEDEDE</color>
<color name="md_theme_lowstim_surfaceContainerLow_highContrast">#CEDAEC</color>
<color name="md_theme_lowstim_surfaceContainer_highContrast">#CAD0D1</color>
<color name="md_theme_lowstim_surfaceContainerHigh_highContrast">#C9D1D2</color>
<color name="md_theme_lowstim_surfaceContainerHighest_highContrast">#C0C9C7</color>
</resources>

View File

@@ -73,8 +73,6 @@
<string name="omitbackup_key">omitbackup</string>
<string name="list_size_key">list_size</string>
<string name="design_key">design_key</string>
<string name="LowStimulus_key">LowStimulus_key</string>
<string name="app_language_pref_key">app_language_pref_key</string>
<string name="sort_key_old">sort_key</string>
<string name="sort_key">sort_key_new</string>
@@ -202,7 +200,7 @@
<item>System</item>
</string-array>
<string name="AcceptAllServerCertificates_default">ERROR</string>
<string name="AcceptAllServerCertificates_default">WARN</string>
<string-array name="AcceptAllServerCertificates_values">
<item>IGNORE</item>
<item>WARN</item>

View File

@@ -1224,6 +1224,9 @@
<string name="enable_fingerprint_hint">Keepass2Android has detected biometric hardware. Do you want to enable Biometric Unlock for this database?</string>
<string name="post_notifications_dialog_title">Allow notifications</string>
<string name="post_notifications_dialog_message">Keepass2Android can show notifications with buttons to copy values like passwords and TOTPs to clipboard, or to bring up the built-in keyboard. This is useful to transfer values into other apps without switching to Keepass2Android repeatedly. Do you want to enable such notifications?</string>
<string name="post_notifications_snackbar">Cannot make entry available through notification. No permission granted.</string>
<string name="post_notifications_snackbar_config">Configure</string>
<string name="post_notifications_dialog_allow">Allow notifications</string>
<string name="post_notifications_dialog_disable">Disable this feature</string>
<string name="post_notifications_dialog_notnow">Not now</string>
@@ -1249,11 +1252,5 @@
<string name="kp2a_switch_on_sendgodone_summary">Switch back when pressing send/go/done</string>
<string name="qr_scanning_error_no_google_play_services">QR code scanning requires Google Play Services. Please install or update Google Play Services on your device.</string>
<string name="english_ime_settings">Android keyboard settings</string>
<string name="autoswitch_enabled_but_not_setup">Note: You have enabled App - Settings - Password access - Keyboard switching - Auto-switch keyboard, but it doesn\'t seem to be configured correctly.</string>
<string name="switch_keyboard_for_totp_enabled">Note: You have enabled App - Password access - Autofill-Service - Autofill for TOTP entries. This can cause this window to show when you open an entry with a TOTP.</string>
<string name="switch_keyboard_inside_kp2a_enabled">Note: You have enabled App - Security - Use built-in keyboard inside Keepass2Android. This can cause this window to show when you open the app or edit an entry.</string>
<string name="switch_keyboard_on_search_enabled">Note: You have enabled App - Security - Password access - Keyboard switching - Switch keyboard. This can cause this window to show when you search for an entry from the browser.</string>
<string name="LowStimulus_title">Low stimulus mode</string>
<string name="LowStimulus_summary">Enable low stimulus mode</string>
</resources>
</resources>

View File

@@ -261,56 +261,6 @@
</style>
<style name="OverlayLowStimulation" parent="">
<item name="colorPrimary">@color/md_theme_lowstim_primary</item>
<item name="colorOnPrimary">@color/md_theme_lowstim_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_lowstim_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/md_theme_lowstim_onPrimaryContainer</item>
<item name="colorSecondary">@color/md_theme_lowstim_secondary</item>
<item name="colorOnSecondary">@color/md_theme_lowstim_onSecondary</item>
<item name="colorSecondaryContainer">@color/md_theme_lowstim_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/md_theme_lowstim_onSecondaryContainer</item>
<item name="colorTertiary">@color/md_theme_lowstim_tertiary</item>
<item name="colorOnTertiary">@color/md_theme_lowstim_onTertiary</item>
<item name="colorTertiaryContainer">@color/md_theme_lowstim_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/md_theme_lowstim_onTertiaryContainer</item>
<item name="colorError">@color/md_theme_lowstim_error</item>
<item name="colorOnError">@color/md_theme_lowstim_onError</item>
<item name="colorErrorContainer">@color/md_theme_lowstim_errorContainer</item>
<item name="colorOnErrorContainer">@color/md_theme_lowstim_onErrorContainer</item>
<item name="android:colorBackground">@color/md_theme_lowstim_background</item>
<item name="colorOnBackground">@color/md_theme_lowstim_onBackground</item>
<item name="colorSurface">@color/md_theme_lowstim_surface</item>
<item name="colorOnSurface">@color/md_theme_lowstim_onSurface</item>
<item name="colorSurfaceVariant">@color/md_theme_lowstim_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_lowstim_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_lowstim_outline</item>
<item name="colorOutlineVariant">@color/md_theme_lowstim_outlineVariant</item>
<item name="colorSurfaceInverse">@color/md_theme_lowstim_inverseSurface</item>
<item name="colorOnSurfaceInverse">@color/md_theme_lowstim_inverseOnSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_lowstim_inversePrimary</item>
<item name="colorPrimaryFixed">@color/md_theme_lowstim_primaryFixed</item>
<item name="colorOnPrimaryFixed">@color/md_theme_lowstim_onPrimaryFixed</item>
<item name="colorPrimaryFixedDim">@color/md_theme_lowstim_primaryFixedDim</item>
<item name="colorOnPrimaryFixedVariant">@color/md_theme_lowstim_onPrimaryFixedVariant</item>
<item name="colorSecondaryFixed">@color/md_theme_lowstim_secondaryFixed</item>
<item name="colorOnSecondaryFixed">@color/md_theme_lowstim_onSecondaryFixed</item>
<item name="colorSecondaryFixedDim">@color/md_theme_lowstim_secondaryFixedDim</item>
<item name="colorOnSecondaryFixedVariant">@color/md_theme_lowstim_onSecondaryFixedVariant</item>
<item name="colorTertiaryFixed">@color/md_theme_lowstim_tertiaryFixed</item>
<item name="colorOnTertiaryFixed">@color/md_theme_lowstim_onTertiaryFixed</item>
<item name="colorTertiaryFixedDim">@color/md_theme_lowstim_tertiaryFixedDim</item>
<item name="colorOnTertiaryFixedVariant">@color/md_theme_lowstim_onTertiaryFixedVariant</item>
<item name="colorSurfaceDim">@color/md_theme_lowstim_surfaceDim</item>
<item name="colorSurfaceBright">@color/md_theme_lowstim_surfaceBright</item>
<item name="colorSurfaceContainerLowest">@color/md_theme_lowstim_surfaceContainerLowest</item>
<item name="colorSurfaceContainerLow">@color/md_theme_lowstim_surfaceContainerLow</item>
<item name="colorSurfaceContainer">@color/md_theme_lowstim_surfaceContainer</item>
<item name="colorSurfaceContainerHigh">@color/md_theme_lowstim_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_lowstim_surfaceContainerHighest</item>
</style>
<style name="Widget.Kp2a.Toolbar" parent="Widget.Material3.Toolbar.OnSurface" />
<style name="Widget.Kp2a.Toolbar.WithCloseButton">

View File

@@ -60,15 +60,6 @@
android:dialogTitle="@string/design_title"
android:defaultValue="@string/design_default" />
<CheckBoxPreference
android:enabled="true"
android:persistent="true"
android:summary="@string/LowStimulus_summary"
android:defaultValue="false"
android:title="@string/LowStimulus_title"
android:key="@string/LowStimulus_key" />
<ListPreference
android:key="@string/app_language_pref_key"
android:title="@string/app_language_pref_title"

View File

@@ -328,6 +328,7 @@ namespace keepass2android
if (prefs.GetBoolean("kp2a_switch_rooted", false))
{
activationCondition = ActivationCondition.Always;
Kp2aLog.Log("Will activate keyboard because SearchUrlTask opened with ActionSend and kp2a_switch_rooted");
}
else
{
@@ -336,6 +337,7 @@ namespace keepass2android
if (prefs.GetBoolean(this.GetString(Resource.String.OpenKp2aKeyboardAutomatically_key), this.Resources.GetBoolean(Resource.Boolean.OpenKp2aKeyboardAutomatically_default)))
{
activationCondition = ActivationCondition.Always;
Kp2aLog.Log("Will activate keyboard because SearchUrlTask opened with ActionSend and OpenKp2aKeyboardAutomatically");
}
}

View File

@@ -6,7 +6,6 @@ using System.Threading;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Preferences;
using Android.Runtime;
using Android.Util;
using Android.Views;
@@ -16,8 +15,8 @@ using keepass2android;
namespace keepass2android
{
[Activity(Label = AppNames.AppName, Theme = "@style/Kp2aTheme_BlueActionBar")]
public class SwitchImeActivity : AndroidX.AppCompat.App.AppCompatActivity
[Activity(Label = AppNames.AppName, TaskAffinity = "", NoHistory = true)]
public class SwitchImeActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
@@ -25,26 +24,7 @@ namespace keepass2android
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();
FindViewById<Button>(Resource.Id.btn_open_settings).Click += (sender, args) => AppSettingsActivity.Launch(this);
var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext);
bool useKp2aKeyboardInKp2a = prefs.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false);
bool kp2a_switch_rooted = prefs.GetBoolean("kp2a_switch_rooted", false);
bool AutoFillTotp_prefs_ActivateKeyboard = prefs.GetBoolean("AutoFillTotp_prefs_ActivateKeyboard_key", false);
bool OpenKp2aKeyboardAutomatically = prefs.GetBoolean(GetString(Resource.String.OpenKp2aKeyboardAutomatically_key), Resources.GetBoolean(Resource.Boolean.OpenKp2aKeyboardAutomatically_default));
FindViewById(Resource.Id.note_UseKp2aKeyboardInKp2a).Visibility = useKp2aKeyboardInKp2a ? ViewStates.Visible : ViewStates.Gone;
FindViewById(Resource.Id.note_kp2a_switch_rooted).Visibility = kp2a_switch_rooted ? ViewStates.Visible : ViewStates.Gone;
FindViewById(Resource.Id.note_AutoFillTotp_prefs_ActivateKeyboard).Visibility = AutoFillTotp_prefs_ActivateKeyboard ? ViewStates.Visible : ViewStates.Gone;
FindViewById(Resource.Id.note_OpenKp2aKeyboardAutomatically).Visibility = OpenKp2aKeyboardAutomatically ? ViewStates.Visible : ViewStates.Gone;
bool hasNote = useKp2aKeyboardInKp2a || kp2a_switch_rooted || AutoFillTotp_prefs_ActivateKeyboard || OpenKp2aKeyboardAutomatically;
((LinearLayout)FindViewById(Resource.Id.settings_notes_container)).Visibility = hasNote ? ViewStates.Visible : ViewStates.Gone;
}
private string Kp2aInputMethodName
{
get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; }

View File

@@ -1,7 +1,6 @@
using System;
using System.Linq;
using Android.App;
using Android.Content;
using Android.Content.Res;
using Android.OS;
using Android.Preferences;
@@ -50,11 +49,6 @@ namespace keepass2android
{
_currentThemeId = NightModePreference;
AppCompatDelegate.DefaultNightMode = _currentThemeId.Value;
if (PreferenceManager.GetDefaultSharedPreferences(_activity).GetBoolean(_activity.GetString(Resource.String.LowStimulus_key), false))
{
_activity.SetTheme(Resource.Style.OverlayLowStimulation);
}
_secureWindow = SecureWindowPref();
_currentIconSet = PreferenceManager.GetDefaultSharedPreferences(_activity)

View File

@@ -918,16 +918,14 @@ namespace keepass2android
{
var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext);
ValidationMode validationMode = ValidationMode.Error;
ValidationMode validationMode = ValidationMode.Warn;
string strValMode = prefs.GetString(LocaleManager.LocalizedAppContext.Resources.GetString(Resource.String.AcceptAllServerCertificates_key),
LocaleManager.LocalizedAppContext.Resources.GetString(Resource.String.AcceptAllServerCertificates_default));
if (strValMode == "IGNORE")
validationMode = ValidationMode.Ignore;
else if (strValMode == "WARN")
validationMode = ValidationMode.Warn;
else if (strValMode == "ERROR")
else if (strValMode == "ERROR")
validationMode = ValidationMode.Error;
return validationMode;
}

View File

@@ -355,6 +355,10 @@ namespace keepass2android
activity.GetString(Resource.String
.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key), false);
Kp2aLog.Log($"AppTask.CompleteOnCreateEntryActivity. ActivateKeyboard={activateKeyboard}, kp2a_switch_rooted={prefs.GetBoolean("kp2a_switch_rooted", false)}, OpenKp2aKeyboardAutomaticallyOnlyAfterSearch={prefs.GetBoolean(
activity.GetString(Resource.String
.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key), false)}");
activity.StartNotificationsService(activateKeyboard);
}
@@ -622,6 +626,7 @@ namespace keepass2android
bool isTotpEntry = totpPluginAdapter != null;
bool activateKeyboard = ActivateKeyboard == ActivationCondition.Always || (ActivateKeyboard == ActivationCondition.WhenTotp && isTotpEntry);
Kp2aLog.Log($"activateKeyboard == {activateKeyboard}. Task.Activate=={ActivateKeyboard}, isTotpEntry={isTotpEntry}");
if ((ShowUserNotifications == ActivationCondition.Always)
|| ((ShowUserNotifications == ActivationCondition.WhenTotp) && isTotpEntry)

View File

@@ -57,12 +57,6 @@ private static Drawable _blank;
if (draw != null)
{
draw = draw.Mutate();
if (PreferenceManager.GetDefaultSharedPreferences(context).GetBoolean(context.GetString(Resource.String.LowStimulus_key), false))
{
Android.Graphics.PorterDuff.Mode mMode = Android.Graphics.PorterDuff.Mode.Multiply;
Color color = new Color(220, 220, 220);
draw.SetColorFilter(color, mMode);
}
iv.SetImageDrawable(draw);
}

View File

@@ -878,6 +878,37 @@ namespace keepass2android
{
get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; }
}
private static bool IsChannelPermissionGranted(Context context, string channelId)
{
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
{
if (!string.IsNullOrEmpty(channelId))
{
NotificationManager? manager =
(NotificationManager?)context.GetSystemService(Context.NotificationService)!;
NotificationChannel? channel = manager?.GetNotificationChannel(channelId);
return channel?.Importance != Android.App.NotificationImportance.None;
}
return false;
}
return true;
}
public static bool HasEntryNotificationPermissions(Context context, bool activateKeyboard)
{
if (!NotificationManagerCompat.From(context).AreNotificationsEnabled())
{
return false;
}
return IsChannelPermissionGranted(context, App.NotificationChannelIdEntry);
}
}
[BroadcastReceiver(Permission = "keepass2android." + AppNames.PackagePart + ".permission.CopyToClipboard")]