mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-12-23 07:28:48 -05:00
QuickUnlock icon can be hidden in settings
This commit is contained in:
parent
c7107c2673
commit
16a5960f7b
1390
src/keepass2android/Resources/Resource.designer.cs
generated
1390
src/keepass2android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -55,8 +55,6 @@
|
||||
<bool name="ShowUsernameInList_default">true</bool>
|
||||
|
||||
<bool name="RememberRecentFiles_default">true</bool>
|
||||
|
||||
|
||||
|
||||
|
||||
<string name="password_access_prefs_key">password_access_prefs_key</string>
|
||||
@ -68,6 +66,7 @@
|
||||
<string name="QuickUnlockDefaultEnabled_key">Enable_QuickUnlock_by_default</string>
|
||||
<string name="QuickUnlockLength_key">QuickUnlockLength</string>
|
||||
<string name="QuickUnlockLength_default">3</string>
|
||||
<string name="QuickUnlockIconHidden_key">QuickUnlockIconHidden_key</string>
|
||||
|
||||
<string name="UsageCount_key">UsageCount</string>
|
||||
<string name="LastInfoVersionCode_key">LastInfoVersion</string>
|
||||
|
@ -212,6 +212,8 @@
|
||||
<string name="QuickUnlock_lockButton">Close database</string>
|
||||
<string name="QuickUnlockDefaultEnabled_title">Enable QuickUnlock by default</string>
|
||||
<string name="QuickUnlockDefaultEnabled_summary">Defines whether QuickUnlock is enabled by default or not.</string>
|
||||
<string name="QuickUnlockIconHidden_title">Hide QuickUnlock icon</string>
|
||||
<string name="QuickUnlockIconHidden_summary">QuickUnlock unfortunately does not work without displaying a notification icon. Select this option to use a transparent icon.</string>
|
||||
<string name="QuickUnlockLength_title">Length of QuickUnlock key</string>
|
||||
<string name="QuickUnlockLength_summary">Maximum number of characters used as QuickUnlock password.</string>
|
||||
<string name="QuickUnlock_fail">QuickUnlock failed: incorrect password!</string>
|
||||
|
@ -163,6 +163,13 @@
|
||||
android:defaultValue="3"
|
||||
android:title="@string/QuickUnlockLength_title"
|
||||
android:key="@string/QuickUnlockLength_key" />
|
||||
<CheckBoxPreference
|
||||
android:enabled="true"
|
||||
android:persistent="true"
|
||||
android:summary="@string/QuickUnlockIconHidden_summary"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/QuickUnlockIconHidden_title"
|
||||
android:key="@string/QuickUnlockIconHidden_key" />
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen
|
||||
android:key="@string/FileHandling_prefs_key"
|
||||
|
@ -116,7 +116,7 @@ namespace keepass2android
|
||||
UpdateOngoingNotification();
|
||||
}
|
||||
|
||||
private void UpdateOngoingNotification()
|
||||
public void UpdateOngoingNotification()
|
||||
{
|
||||
// Start or update the notification icon service to reflect the current state
|
||||
var ctx = Application.Context;
|
||||
|
@ -744,4 +744,7 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xhdpi-v11\ic_launcher_gray.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\transparent.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -124,9 +124,14 @@ namespace keepass2android
|
||||
|
||||
private Notification GetQuickUnlockNotification()
|
||||
{
|
||||
int grayIconResouceId = Resource.Drawable.ic_launcher_gray;
|
||||
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(GetString(Resource.String.QuickUnlockIconHidden_key), false))
|
||||
{
|
||||
grayIconResouceId = Resource.Drawable.transparent;
|
||||
}
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this)
|
||||
.SetSmallIcon(Resource.Drawable.ic_launcher_gray)
|
||||
.SetSmallIcon(grayIconResouceId)
|
||||
.SetLargeIcon(BitmapFactory.DecodeResource(Resources, AppNames.LauncherIcon))
|
||||
.SetContentTitle(GetString(Resource.String.app_name))
|
||||
.SetContentText(GetString(Resource.String.database_loaded_quickunlock_enabled, GetDatabaseName()));
|
||||
|
@ -58,11 +58,16 @@ namespace keepass2android
|
||||
Kp2aLog.Log(ex.ToString());
|
||||
}
|
||||
#endif
|
||||
|
||||
FindPreference(GetString(Resource.String.QuickUnlockIconHidden_key)).PreferenceChange += OnQuickUnlockHiddenChanged;
|
||||
|
||||
FindPreference(GetString(Resource.String.db_key)).Enabled = false;
|
||||
}
|
||||
|
||||
private void OnQuickUnlockHiddenChanged(object sender, Preference.PreferenceChangeEventArgs e)
|
||||
{
|
||||
App.Kp2a.UpdateOngoingNotification();
|
||||
}
|
||||
|
||||
private void OnUseOfflineCacheChanged(object sender, Preference.PreferenceChangeEventArgs e)
|
||||
{
|
||||
//ensure the user gets a matching database
|
||||
|
Loading…
Reference in New Issue
Block a user