added missing files

This commit is contained in:
Philipp Crocoll 2014-02-05 07:03:22 +01:00
parent 2baf93eb3d
commit 057adadfb3
6 changed files with 88 additions and 0 deletions

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

View 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>

View 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);
}
}
}