re-introduce (simplified) dark theme
ask confirmation message before permanently deleting entries (when no recycle bin is present)
This commit is contained in:
parent
169994eb06
commit
c048399c63
|
@ -9,8 +9,10 @@ namespace keepass2android
|
|||
public enum UiStringKey
|
||||
{
|
||||
AskDeletePermanentlyGroup,
|
||||
AskDeletePermanentlyGroupNoRecycle,
|
||||
progress_title,
|
||||
AskDeletePermanentlyEntry,
|
||||
AskDeletePermanentlyEntryNoRecycle,
|
||||
search_results,
|
||||
AskDeletePermanently_title,
|
||||
saving_database,
|
||||
|
@ -58,6 +60,7 @@ namespace keepass2android
|
|||
DuplicateUuidsError,
|
||||
DuplicateUuidsErrorAdditional,
|
||||
DeletingItems,
|
||||
AskDeletePermanentlyItems
|
||||
AskDeletePermanentlyItems,
|
||||
AskDeletePermanentlyItemsNoRecycle
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace keepass2android
|
|||
}
|
||||
}
|
||||
|
||||
protected override UiStringKey QuestionsResourceId
|
||||
protected override UiStringKey QuestionRecycleResourceId
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -51,6 +51,14 @@ namespace keepass2android
|
|||
}
|
||||
}
|
||||
|
||||
protected override UiStringKey QuestionNoRecycleResourceId
|
||||
{
|
||||
get
|
||||
{
|
||||
return UiStringKey.AskDeletePermanentlyEntryNoRecycle;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PerformDelete(List<PwGroup> touchedGroups, List<PwGroup> permanentlyDeletedGroups)
|
||||
{
|
||||
DoDeleteEntry(_entry, touchedGroups);
|
||||
|
|
|
@ -61,14 +61,19 @@ namespace keepass2android
|
|||
}
|
||||
}
|
||||
|
||||
protected override UiStringKey QuestionsResourceId
|
||||
protected override UiStringKey QuestionRecycleResourceId
|
||||
{
|
||||
get
|
||||
{
|
||||
return UiStringKey.AskDeletePermanentlyGroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override UiStringKey QuestionNoRecycleResourceId
|
||||
{
|
||||
get { return UiStringKey.AskDeletePermanentlyGroupNoRecycle; }
|
||||
}
|
||||
|
||||
protected override void PerformDelete(List<PwGroup> touchedGroups, List<PwGroup> permanentlyDeletedGroups)
|
||||
{
|
||||
DoDeleteGroup(_group, touchedGroups, permanentlyDeletedGroups);
|
||||
|
|
|
@ -50,11 +50,16 @@ namespace keepass2android
|
|||
get { return _canRecycle; }
|
||||
}
|
||||
|
||||
protected override UiStringKey QuestionsResourceId
|
||||
protected override UiStringKey QuestionRecycleResourceId
|
||||
{
|
||||
get { return UiStringKey.AskDeletePermanentlyItems; }
|
||||
}
|
||||
|
||||
protected override UiStringKey QuestionNoRecycleResourceId
|
||||
{
|
||||
get { return UiStringKey.AskDeletePermanentlyItemsNoRecycle; }
|
||||
}
|
||||
|
||||
protected override void PerformDelete(List<PwGroup> touchedGroups, List<PwGroup> permanentlyDeletedGroups)
|
||||
{
|
||||
foreach (var g in _elementsToDelete.OfType<PwGroup>())
|
||||
|
|
|
@ -107,17 +107,23 @@ namespace keepass2android
|
|||
else { System.Diagnostics.Debug.Assert(pgRecycleBin.Uuid.Equals(Db.KpDatabase.RecycleBinUuid)); }
|
||||
}
|
||||
|
||||
protected abstract UiStringKey QuestionsResourceId
|
||||
protected abstract UiStringKey QuestionRecycleResourceId
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
protected abstract UiStringKey QuestionNoRecycleResourceId
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (CanRecycle)
|
||||
{
|
||||
App.AskYesNoCancel(UiStringKey.AskDeletePermanently_title,
|
||||
QuestionsResourceId,
|
||||
QuestionRecycleResourceId,
|
||||
(dlgSender, dlgEvt) =>
|
||||
{
|
||||
DeletePermanently = true;
|
||||
|
@ -138,11 +144,22 @@ namespace keepass2android
|
|||
}
|
||||
else
|
||||
{
|
||||
ProgressTask pt = new ProgressTask(App, Ctx, this);
|
||||
pt.Run();
|
||||
App.AskYesNoCancel(UiStringKey.AskDeletePermanently_title,
|
||||
QuestionNoRecycleResourceId,
|
||||
(dlgSender, dlgEvt) =>
|
||||
{
|
||||
ProgressTask pt = new ProgressTask(App, Ctx, this);
|
||||
pt.Run();
|
||||
},
|
||||
null,
|
||||
(dlgSender, dlgEvt) => { },
|
||||
Ctx);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void DoDeleteEntry(PwEntry pe, List<PwGroup> touchedGroups)
|
||||
{
|
||||
PwDatabase pd = Db.KpDatabase;
|
||||
|
|
|
@ -29,7 +29,13 @@ namespace keepass2android
|
|||
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", WindowSoftInputMode = SoftInput.StateHidden)]
|
||||
public class GeneratePasswordActivity : LockCloseActivity {
|
||||
private readonly int[] _buttonIds = new[] {Resource.Id.btn_length6, Resource.Id.btn_length8, Resource.Id.btn_length12, Resource.Id.btn_length16};
|
||||
|
||||
|
||||
private ActivityDesign _design;
|
||||
public GeneratePasswordActivity()
|
||||
{
|
||||
_design = new ActivityDesign(this);
|
||||
}
|
||||
|
||||
public static void Launch(Activity act) {
|
||||
Intent i = new Intent(act, typeof(GeneratePasswordActivity));
|
||||
|
||||
|
@ -48,6 +54,7 @@ namespace keepass2android
|
|||
|
||||
protected override void OnCreate(Bundle savedInstanceState) {
|
||||
base.OnCreate(savedInstanceState);
|
||||
_design.ApplyTheme();
|
||||
SetContentView(Resource.Layout.generate_password);
|
||||
SetResult(KeePass.ExitNormal);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ using System.IO;
|
|||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Android.Graphics.Drawables;
|
||||
using Android.OS;
|
||||
using Android.Preferences;
|
||||
using Android.Views;
|
||||
|
@ -178,6 +179,32 @@ namespace keepass2android
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Bitmap DrawableToBitmap (Drawable drawable) {
|
||||
Bitmap bitmap = null;
|
||||
|
||||
if (drawable is BitmapDrawable) {
|
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
|
||||
if(bitmapDrawable.Bitmap != null) {
|
||||
return bitmapDrawable.Bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
if(drawable.IntrinsicWidth <= 0 || drawable.IntrinsicHeight <= 0) {
|
||||
bitmap = Bitmap.CreateBitmap(1, 1, Bitmap.Config.Argb8888); // Single color bitmap will be created of 1x1 pixel
|
||||
} else {
|
||||
bitmap = Bitmap.CreateBitmap(drawable.IntrinsicWidth, drawable.IntrinsicHeight, Bitmap.Config.Argb8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.SetBounds(0, 0, canvas.Width, canvas.Height);
|
||||
drawable.Draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override View GetView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
|
@ -197,8 +224,11 @@ namespace keepass2android
|
|||
if (position < (int)PwIcon.Count)
|
||||
{
|
||||
tv.Text = "" + position;
|
||||
App.Kp2a.GetDb()
|
||||
.DrawableFactory.AssignDrawableTo(iv, _act, App.Kp2a.GetDb().KpDatabase, (KeePassLib.PwIcon) position, null, false);
|
||||
var drawable = App.Kp2a.GetDb()
|
||||
.DrawableFactory.GetIconDrawable(_act, App.Kp2a.GetDb().KpDatabase, (KeePassLib.PwIcon) position, null, false);
|
||||
drawable = new BitmapDrawable(DrawableToBitmap(drawable));
|
||||
iv.SetImageDrawable(drawable);
|
||||
//App.Kp2a.GetDb().DrawableFactory.AssignDrawableTo(iv, _act, App.Kp2a.GetDb().KpDatabase, (KeePassLib.PwIcon) position, null, false);
|
||||
|
||||
if (
|
||||
PreferenceManager.GetDefaultSharedPreferences(currView.Context)
|
||||
|
@ -206,7 +236,6 @@ namespace keepass2android
|
|||
{
|
||||
Android.Graphics.PorterDuff.Mode mMode = Android.Graphics.PorterDuff.Mode.SrcAtop;
|
||||
Color color = new Color(189, 189, 189);
|
||||
iv.SetImageDrawable(iv.Drawable.Mutate());
|
||||
iv.SetColorFilter(color, mMode);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,13 +159,13 @@ namespace keepass2android
|
|||
|
||||
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
||||
: base(javaReference, transfer)
|
||||
{
|
||||
|
||||
}
|
||||
{
|
||||
_activityDesign = new ActivityDesign(this);
|
||||
}
|
||||
|
||||
public PasswordActivity()
|
||||
{
|
||||
|
||||
_activityDesign = new ActivityDesign(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -686,6 +686,8 @@ namespace keepass2android
|
|||
|
||||
private string mDrawerTitle;
|
||||
private MeasuringRelativeLayout.MeasureArgs _measureArgs;
|
||||
private ActivityDesign _activityDesign;
|
||||
|
||||
internal class MyActionBarDrawerToggle : ActionBarDrawerToggle
|
||||
{
|
||||
PasswordActivity owner;
|
||||
|
@ -739,7 +741,7 @@ namespace keepass2android
|
|||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
_activityDesign.ApplyTheme();
|
||||
|
||||
//use FlagSecure to make sure the last (revealed) character of the master password is not visible in recent apps
|
||||
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
|
||||
|
@ -1572,6 +1574,7 @@ namespace keepass2android
|
|||
protected override void OnResume()
|
||||
{
|
||||
base.OnResume();
|
||||
_activityDesign.ReapplyTheme();
|
||||
|
||||
EditText pwd = FindViewById<EditText>(Resource.Id.password_edit);
|
||||
pwd.PostDelayed(() =>
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
<item android:state_focused="true">
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="2dip" />
|
||||
<solid android:color="#fff"/>
|
||||
<solid android:color="?activityBackgroundColor"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="2dip" />
|
||||
<solid android:color="#fff" />
|
||||
<solid android:color="?activityBackgroundColor" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -3,7 +3,7 @@
|
|||
<item >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="6dip" />
|
||||
<solid android:color="#fff" />
|
||||
<solid android:color="?activityBackgroundColor" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/entry_scroll"
|
||||
android:background="#ffffffff"
|
||||
android:background="?activityBackgroundColor"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
|
@ -23,7 +23,8 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/ic00" />
|
||||
<android.support.design.widget.TextInputLayout
|
||||
style="@style/EntryEditSingleLine_TextInputLayout">
|
||||
style="@style/EntryEditSingleLine_TextInputLayout"
|
||||
android:layout_toLeftOf="@id/icon_button">
|
||||
<EditText
|
||||
android:id="@+id/entry_title"
|
||||
style="@style/EntryEditSingleLine_EditText"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true"
|
||||
android:background="#ffffffff"
|
||||
android:background="?activityBackgroundColor"
|
||||
android:scrollbarStyle="insideOverlay">
|
||||
<keepass2android.view.EntryContentsView
|
||||
android:id="@+id/entry_contents"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:background="?activityBackgroundColor"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:fitsSystemWindows="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#fff">
|
||||
android:background="?activityBackgroundColor">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
<TextView android:id="@+id/group_text"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="#000"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"/>
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
android:id="@+id/IconGridView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@android:color/background_light"
|
||||
android:verticalSpacing="5dp"
|
||||
android:background="?activityBackgroundColor"
|
||||
android:horizontalSpacing="5dp"
|
||||
android:columnWidth="60dp"
|
||||
android:numColumns="auto_fit"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/relative_layout"
|
||||
android:background="#ffffffff">
|
||||
android:background="?activityBackgroundColor">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?activityBackgroundColor"
|
||||
android:orientation="vertical">
|
||||
<include
|
||||
android:id="@+id/mytoolbar"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:fitsSystemWindows="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#fff">
|
||||
android:background="?activityBackgroundColor">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
android:fitsSystemWindows="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#fff">
|
||||
android:background="?activityBackgroundColor">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -17,6 +17,19 @@
|
|||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme_Dark" parent="MyTheme_Dark.Base">
|
||||
<item name="android:windowContentTransitions">true</item>
|
||||
<item name="android:windowAllowEnterTransitionOverlap">true</item>
|
||||
<item name="android:windowAllowReturnTransitionOverlap">true</item>
|
||||
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
|
||||
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
|
||||
<item name="android:actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
<style name="MyTheme_ActionBar_Dark" parent="MyTheme_ActionBar_Dark.Base">
|
||||
<item name="android:actionModeBackground">@color/appAccentColor</item>
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="EntryFieldHeader">
|
||||
<item name="android:drawablePadding">2dp</item>
|
||||
<item name="android:layout_marginLeft">0dip</item>
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
<attr name="ic_launcher_folder_small" format="reference"></attr>
|
||||
<attr name="ic_action_search_drawable" format="reference"></attr>
|
||||
<attr name="NavigationAcceptDrawable" format="reference"></attr>
|
||||
|
||||
<attr name="activityBackgroundColor" format="reference|color" />
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
-->
|
||||
<resources>
|
||||
|
||||
<color name="bgColorLight">#fff</color>
|
||||
<color name="bgColorDark">#000</color>
|
||||
<color name="bgColor">#000</color>
|
||||
|
||||
<color name="appPrimaryColor">#8bc34a</color>
|
||||
<color name="appPrimaryDarkColor">#548a2e</color>
|
||||
<color name="appAccentColor">#0277bd</color>
|
||||
|
|
|
@ -357,6 +357,11 @@
|
|||
<string name="AskDeletePermanentlyEntry">Do you want to delete this entry permanently? Press No to recycle.</string>
|
||||
<string name="AskDeletePermanentlyGroup">Do you want to delete this group permanently? Press No to recycle.</string>
|
||||
<string name="AskDeletePermanentlyItems">Do you want to delete the selected elements permanently? Press No to recycle.</string>
|
||||
|
||||
<string name="AskDeletePermanentlyEntryNoRecycle">Do you want to delete this entry permanently?</string>
|
||||
<string name="AskDeletePermanentlyGroupNoRecycle">Do you want to delete this group permanently?</string>
|
||||
<string name="AskDeletePermanentlyItemsNoRecycle">Do you want to delete the selected elements permanently?</string>
|
||||
|
||||
<string name="AskDeletePermanently_title">Delete permanently?</string>
|
||||
<string name="AskReloadFile_title">Reload file?</string>
|
||||
<string name="AskReloadFile">The file which is currently open was changed by another program. Do you want to reload it?</string>
|
||||
|
@ -780,8 +785,8 @@ Initial public release
|
|||
</string-array>
|
||||
|
||||
<string-array name="design_options">
|
||||
<item>Holo Light</item>
|
||||
<item>Holo Dark</item>
|
||||
<item>Light</item>
|
||||
<item>Dark</item>
|
||||
</string-array>
|
||||
|
||||
<string name="design_title">Design</string>
|
||||
|
|
|
@ -17,6 +17,136 @@
|
|||
-->
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<style name="MyTheme_ActionBar.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="windowActionBar">true</item>
|
||||
<item name="colorPrimary">@color/appPrimaryColor</item>
|
||||
<item name="colorPrimaryDark">@color/appPrimaryDarkColor</item>
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
<item name="activityBackgroundColor">@color/bgColorLight</item>
|
||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||
|
||||
<item name="actionModeBackground">@color/appPrimaryDarkColor</item>
|
||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MyTheme_ActionBar" parent="MyTheme_ActionBar.Base">
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
||||
<item name="activityBackgroundColor">@color/bgColorLight</item>
|
||||
<item name="CancelDrawable">@drawable/ic_menu_close</item>
|
||||
|
||||
<item name="ic_launcher_folder_small">@drawable/ic_launcher_folder_small</item>
|
||||
<item name="ic_action_search_drawable">@drawable/ic_action_search</item>
|
||||
<item name="NavigationAcceptDrawable">@drawable/navigation_accept</item>
|
||||
|
||||
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">@color/appPrimaryColor</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">@color/appPrimaryDarkColor</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||
|
||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MyTheme" parent="MyTheme.Base">
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme_Blue" parent="MyTheme">
|
||||
<item name="colorPrimary">@color/appAccentColor</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">@color/appAccentColorDark</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="Base_Dialog" parent="Theme.AppCompat.Light.Dialog" />
|
||||
|
||||
<!-- dark themes -->
|
||||
|
||||
|
||||
<style name="MyTheme_ActionBar_Dark.Base" parent="Theme.AppCompat">
|
||||
<item name="activityBackgroundColor">@color/bgColorDark</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="windowActionBar">true</item>
|
||||
<item name="colorPrimary">@color/appPrimaryColor</item>
|
||||
<item name="colorPrimaryDark">@color/appPrimaryDarkColor</item>
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||
|
||||
<item name="actionModeBackground">@color/appPrimaryDarkColor</item>
|
||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MyTheme_ActionBar_Dark" parent="MyTheme_ActionBar_Dark.Base">
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
<!-- Base theme applied no matter what API -->
|
||||
|
||||
<style name="MyTheme_Dark.Base" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="activityBackgroundColor">@color/bgColorDark</item>
|
||||
<item name="CancelDrawable">@drawable/ic_menu_close</item>
|
||||
|
||||
<item name="ic_launcher_folder_small">@drawable/ic_launcher_folder_small</item>
|
||||
<item name="ic_action_search_drawable">@drawable/ic_action_search</item>
|
||||
<item name="NavigationAcceptDrawable">@drawable/navigation_accept</item>
|
||||
|
||||
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">@color/appPrimaryColor</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">@color/appPrimaryDarkColor</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||
|
||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MyTheme_Dark" parent="MyTheme_Dark.Base">
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme_Blue_Dark" parent="MyTheme_Dark">
|
||||
<item name="colorPrimary">@color/appAccentColor</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">@color/appAccentColorDark</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="Base_Dialog_Dark" parent="Theme.AppCompat.Dialog" />
|
||||
|
||||
<!-- end dark themen -->
|
||||
|
||||
|
||||
<style name="BottomBarButton" parent="@style/Widget.AppCompat.Button.Borderless">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:layout_margin">6dp</item>
|
||||
|
@ -89,56 +219,7 @@
|
|||
<item name="android:gravity">center_vertical</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme" parent="MyTheme.Base">
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme_Blue" parent="MyTheme">
|
||||
<item name="colorPrimary">@color/appAccentColor</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">@color/appAccentColorDark</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!--style name="MyTheme.ActionMode" parent="@style/Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="actionModeBackground">#FFFFFF</item>
|
||||
</style-->
|
||||
|
||||
|
||||
<style name="MyTheme_ActionBar" parent="MyTheme_ActionBar.Base">
|
||||
<item name="actionModeBackground">@color/appAccentColor</item>
|
||||
</style>
|
||||
<!-- Base theme applied no matter what API -->
|
||||
|
||||
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
||||
<item name="CancelDrawable">@drawable/ic_menu_close</item>
|
||||
|
||||
<item name="ic_launcher_folder_small">@drawable/ic_launcher_folder_small</item>
|
||||
<item name="ic_action_search_drawable">@drawable/ic_action_search</item>
|
||||
<item name="NavigationAcceptDrawable">@drawable/navigation_accept</item>
|
||||
|
||||
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">@color/appPrimaryColor</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">@color/appPrimaryDarkColor</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||
|
||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar.Solid">
|
||||
<item name="titleTextStyle">@style/MyTitleTextStyle</item>
|
||||
|
@ -150,19 +231,7 @@
|
|||
</style>
|
||||
|
||||
|
||||
<style name="MyTheme_ActionBar.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="windowActionBar">true</item>
|
||||
<item name="colorPrimary">@color/appPrimaryColor</item>
|
||||
<item name="colorPrimaryDark">@color/appPrimaryDarkColor</item>
|
||||
<item name="colorAccent">@color/appAccentColor</item>
|
||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
|
||||
|
||||
<item name="actionModeBackground">@color/appPrimaryDarkColor</item>
|
||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
|
||||
<item name="spinBars">true</item>
|
||||
<item name="color">@android:color/white</item>
|
||||
|
@ -172,7 +241,7 @@
|
|||
<item name="@android:textStyle">italic</item>
|
||||
</style>
|
||||
|
||||
<style name="Base_Dialog" parent="Theme.AppCompat.Light.Dialog" />
|
||||
|
||||
<style name="Dialog" parent="Base_Dialog"></style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -196,7 +196,16 @@
|
|||
android:persistent="false"
|
||||
android:key="IconSetKey"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
<ListPreference
|
||||
android:key="@string/design_key"
|
||||
android:title="@string/design_title"
|
||||
android:entries="@array/design_options"
|
||||
android:entryValues="@array/design_values"
|
||||
android:dialogTitle="@string/design_title"
|
||||
android:defaultValue="@string/design_default"/>
|
||||
|
||||
|
||||
<CheckBoxPreference
|
||||
android:enabled="true"
|
||||
android:persistent="true"
|
||||
android:summary="@string/ViewDatabaseSecure_summary"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Android.App;
|
||||
using Android.Preferences;
|
||||
|
||||
|
@ -11,31 +13,73 @@ namespace keepass2android
|
|||
|
||||
private string _currentIconSet;
|
||||
|
||||
private readonly string _attributeTheme;
|
||||
|
||||
public ActivityDesign(Activity activity)
|
||||
{
|
||||
_activity = activity;
|
||||
try
|
||||
{
|
||||
var activityAttr = activity.GetType().GetCustomAttributes(false).Where(
|
||||
x => x is Android.App.ActivityAttribute
|
||||
).Cast<ActivityAttribute>().First();
|
||||
_attributeTheme = activityAttr.Theme;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Kp2aLog.Log(e.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ApplyTheme()
|
||||
{
|
||||
/*if (HasThemes())
|
||||
if (HasThemes())
|
||||
{
|
||||
var dark = UseDarkTheme;
|
||||
//int newTheme = dark ? Resource.Style.ThemeDark : Resource.Style.ThemeLight;
|
||||
int newTheme = Resource.Style.ThemeMaterial;
|
||||
int newTheme = dark ? DarkTheme : LightTheme;
|
||||
_activity.SetTheme(newTheme);
|
||||
_currentThemeId = newTheme;
|
||||
}*/
|
||||
}
|
||||
_currentIconSet = PreferenceManager.GetDefaultSharedPreferences(_activity)
|
||||
.GetString("IconSetKey", _activity.PackageName);
|
||||
}
|
||||
|
||||
public int DarkTheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_attributeTheme))
|
||||
return Resource.Style.MyTheme_Dark;
|
||||
if (_attributeTheme.Contains("MyTheme_Blue"))
|
||||
return Resource.Style.MyTheme_Blue_Dark;
|
||||
if (_attributeTheme.Contains("MyTheme_ActionBar"))
|
||||
return Resource.Style.MyTheme_ActionBar_Dark;
|
||||
return Resource.Style.MyTheme_Dark;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int LightTheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_attributeTheme))
|
||||
return Resource.Style.MyTheme;
|
||||
if (_attributeTheme.Contains("MyTheme_Blue"))
|
||||
return Resource.Style.MyTheme_Blue;
|
||||
if (_attributeTheme.Contains("MyTheme_ActionBar"))
|
||||
return Resource.Style.MyTheme_ActionBar;
|
||||
return Resource.Style.MyTheme;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ReapplyTheme()
|
||||
{
|
||||
/*if (HasThemes())
|
||||
if (HasThemes())
|
||||
{
|
||||
//int newTheme = UseDarkTheme ? Resource.Style.ThemeDark : Resource.Style.ThemeLight;
|
||||
int newTheme = Resource.Style.ThemeMaterial;
|
||||
int newTheme = UseDarkTheme ? DarkTheme : LightTheme;
|
||||
if (newTheme != _currentThemeId)
|
||||
{
|
||||
Kp2aLog.Log("recreating due to theme change.");
|
||||
|
@ -43,7 +87,7 @@ namespace keepass2android
|
|||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (PreferenceManager.GetDefaultSharedPreferences(_activity)
|
||||
.GetString("IconSetKey", _activity.PackageName) != _currentIconSet)
|
||||
{
|
||||
|
@ -69,7 +113,7 @@ namespace keepass2android
|
|||
if (HasThemes())
|
||||
{
|
||||
bool dark = UseDarkTheme;
|
||||
//_activity.SetTheme(dark ? Resource.Style.DialogDark : Resource.Style.DialogLight);
|
||||
_activity.SetTheme(dark ? Resource.Style.Base_Dialog : Resource.Style.Base_Dialog_Dark);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -337,8 +337,8 @@ namespace keepass2android
|
|||
builder.SetMessage(GetResourceString(messageKey));
|
||||
|
||||
builder.SetPositiveButton(GetResourceString(yesString), yesHandler);
|
||||
|
||||
builder.SetNegativeButton(GetResourceString(noString), noHandler);
|
||||
if (noHandler != null)
|
||||
builder.SetNegativeButton(GetResourceString(noString), noHandler);
|
||||
|
||||
if (cancelHandler != null)
|
||||
{
|
||||
|
|
|
@ -48,12 +48,16 @@ private static Drawable _blank;
|
|||
* Keys: Integer, Values: Drawables
|
||||
*/
|
||||
private readonly Dictionary<int/*icon key*/, Drawable> _standardIconMap = new Dictionary<int, Drawable>();
|
||||
|
||||
public void AssignDrawableTo (ImageView iv, Context context, PwDatabase db, PwIcon icon, PwUuid customIconId, bool forGroup)
|
||||
|
||||
public void AssignDrawableTo(ImageView iv, Context context, PwDatabase db, PwIcon icon, PwUuid customIconId, bool forGroup)
|
||||
{
|
||||
Drawable draw = GetIconDrawable (context, db, icon, customIconId, forGroup);
|
||||
if (draw != null)
|
||||
{
|
||||
draw = draw.Mutate();
|
||||
iv.SetImageDrawable(draw);
|
||||
}
|
||||
|
||||
else
|
||||
Kp2aLog.Log("icon not found : " + icon);
|
||||
}
|
||||
|
@ -172,6 +176,7 @@ private static Drawable _blank;
|
|||
_customIconMap.Clear ();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,10 @@ namespace keepass2android
|
|||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
_design.ApplyTheme();
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
|
||||
SetContentView(Resource.Layout.preference);
|
||||
|
||||
SetSupportActionBar(FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.mytoolbar));
|
||||
|
|
|
@ -337,6 +337,8 @@ namespace keepass2android
|
|||
FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += OnRememberKeyFileHistoryChanged;
|
||||
FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)).PreferenceChange += OnShowUnlockedNotificationChanged;
|
||||
PrepareNoDonatePreference(Activity, FindPreference(GetString(Resource.String.NoDonateOption_key)));
|
||||
|
||||
FindPreference(GetString(Resource.String.design_key)).PreferenceChange += (sender, args) => Activity.Recreate();
|
||||
|
||||
Database db = App.Kp2a.GetDb();
|
||||
if (db.Loaded)
|
||||
|
|
Loading…
Reference in New Issue