mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-22 01:02:16 -05:00
added missing files
This commit is contained in:
parent
2baf93eb3d
commit
057adadfb3
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 672 B |
Binary file not shown.
After Width: | Height: | Size: 672 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
22
src/keepass2android/Resources/values/attrs.xml
Normal file
22
src/keepass2android/Resources/values/attrs.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<attr name="TextViewParentStyle" format="reference"/>
|
||||||
|
<attr name="ActionBarButtonParentStyle" format="reference" />
|
||||||
|
<attr name="TextColorGroup" format="reference"></attr>
|
||||||
|
<attr name="TextColorHeader" format="reference"></attr>
|
||||||
|
<attr name="TextColorItem" format="reference"></attr>
|
||||||
|
<attr name="CancelDrawable" format="reference"></attr>
|
||||||
|
<attr name="NewGroupDrawable" format="reference"></attr>
|
||||||
|
<attr name="AddFieldDrawable" format="reference"></attr>
|
||||||
|
<attr name="NewEntryDrawable" format="reference"></attr>
|
||||||
|
<attr name="OpenFileDrawable" format="reference"></attr>
|
||||||
|
<attr name="OpenUrlDrawable" format="reference"></attr>
|
||||||
|
<attr name="CreateDbDrawable" format="reference"></attr>
|
||||||
|
<attr name="ic_menu_add_field" format="reference"></attr>
|
||||||
|
|
||||||
|
<attr name="ic_launcher_folder_small" format="reference"></attr>
|
||||||
|
<attr name="ic_action_search_drawable" format="reference"></attr>
|
||||||
|
<attr name="NavigationAcceptDrawable" format="reference"></attr>
|
||||||
|
|
||||||
|
|
||||||
|
</resources>
|
66
src/keepass2android/Utils/ActivityDesign.cs
Normal file
66
src/keepass2android/Utils/ActivityDesign.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using Android.App;
|
||||||
|
using Android.Preferences;
|
||||||
|
|
||||||
|
namespace keepass2android
|
||||||
|
{
|
||||||
|
class ActivityDesign
|
||||||
|
{
|
||||||
|
private readonly Activity _activity;
|
||||||
|
|
||||||
|
private int? _currentThemeId;
|
||||||
|
|
||||||
|
public ActivityDesign(Activity activity)
|
||||||
|
{
|
||||||
|
_activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyTheme()
|
||||||
|
{
|
||||||
|
if (HasThemes())
|
||||||
|
{
|
||||||
|
var dark = UseDarkTheme;
|
||||||
|
int newTheme = dark ? Resource.Style.ThemeDark : Resource.Style.ThemeLight;
|
||||||
|
_activity.SetTheme(newTheme);
|
||||||
|
_currentThemeId = newTheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReapplyTheme()
|
||||||
|
{
|
||||||
|
int newTheme = UseDarkTheme ? Resource.Style.ThemeDark : Resource.Style.ThemeLight;
|
||||||
|
if (newTheme != _currentThemeId)
|
||||||
|
{
|
||||||
|
Kp2aLog.Log("recreating due to theme change.");
|
||||||
|
_activity.Recreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool UseDarkTheme
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var prefs = PreferenceManager.GetDefaultSharedPreferences(_activity);
|
||||||
|
string design = prefs.GetString(_activity.GetString(Resource.String.design_key), _activity.GetString(Resource.String.design_default));
|
||||||
|
bool dark = (design == "Dark");
|
||||||
|
return dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyDialogTheme()
|
||||||
|
{
|
||||||
|
if (HasThemes())
|
||||||
|
{
|
||||||
|
bool dark = UseDarkTheme;
|
||||||
|
_activity.SetTheme(dark ? Resource.Style.DialogDark : Resource.Style.DialogLight);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasThemes()
|
||||||
|
{
|
||||||
|
return ((int)Android.OS.Build.VERSION.SdkInt >= 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user