fixed a few theme issues

implemented selection in preferences and recreation of activities
This commit is contained in:
Philipp Crocoll 2014-02-02 07:03:40 +01:00
parent 7312823eee
commit a765bd125e
44 changed files with 2136 additions and 6001 deletions

17
.gitignore vendored
View File

@ -180,3 +180,20 @@ Thumbs.db
/src/AppCompatV7Binding/bin/ReleaseNoNet /src/AppCompatV7Binding/bin/ReleaseNoNet
/src/java/KP2ASoftKeyboard2/java/projectzip /src/java/KP2ASoftKeyboard2/java/projectzip
/src/JavaFileStorageBindings/bin/ReleaseNoNet
/src/KP2AKdbLibraryBinding/bin/Debug
/src/KP2AKdbLibraryBinding/bin/Release
/src/KP2AKdbLibraryBinding/obj/Debug
/src/KP2AKdbLibraryBinding/obj/Release
/src/java/.metadata
/src/java/JavaFileStorage/.google_apis/drive-v2/drive
/src/java/JavaFileStorage/.google_apis/drive-v2r102lv1.16.0-rc/drive
/src/java/JavaFileStorage/libs

View File

@ -20,7 +20,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>False</Optimize> <Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath> <OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants> <DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause> <ConsolePause>False</ConsolePause>

View File

@ -20,7 +20,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants> <DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
@ -112,18 +112,10 @@
<Compile Include="Utils\Spr\SprEngine.PickChars.cs" /> <Compile Include="Utils\Spr\SprEngine.PickChars.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj">
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
<Name>JavaFileStorageBindings</Name>
</ProjectReference>
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj"> <ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
<Project>{545b4a6b-8bba-4fbe-92fc-4ac060122a54}</Project> <Project>{545b4a6b-8bba-4fbe-92fc-4ac060122a54}</Project>
<Name>KeePassLib2Android</Name> <Name>KeePassLib2Android</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\KP2AKdbLibraryBinding\KP2AKdbLibraryBinding.csproj">
<Project>{70d3844a-d9fa-4a64-b205-a84c6a822196}</Project>
<Name>KP2AKdbLibraryBinding</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
#if !EXCLUDE_KEYTRANSFORM
using Com.Keepassdroid.Database; using Com.Keepassdroid.Database;
using Com.Keepassdroid.Database.Exception; using Com.Keepassdroid.Database.Exception;
#endif
using KeePassLib; using KeePassLib;
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
using KeePassLib.Interfaces; using KeePassLib.Interfaces;
@ -21,6 +23,7 @@ namespace keepass2android
public void PopulateDatabaseFromStream(PwDatabase db, CompositeKey key, Stream s, IStatusLogger slLogger) public void PopulateDatabaseFromStream(PwDatabase db, CompositeKey key, Stream s, IStatusLogger slLogger)
{ {
#if !EXCLUDE_KEYTRANSFORM
var importer = new Com.Keepassdroid.Database.Load.ImporterV3(); var importer = new Com.Keepassdroid.Database.Load.ImporterV3();
var hashingStream = new HashingStreamEx(s, false, new SHA256Managed()); var hashingStream = new HashingStreamEx(s, false, new SHA256Managed());
@ -67,8 +70,13 @@ namespace keepass2android
HashOfLastStream = hashingStream.Hash; HashOfLastStream = hashingStream.Hash;
if (HashOfLastStream == null) if (HashOfLastStream == null)
throw new Exception("hashing didn't work"); //todo remove throw new Exception("hashing didn't work"); //todo remove
#else
throw new Exception("Kdb is excluded with Key transform!");
#endif
} }
#if !EXCLUDE_KEYTRANSFORM
private PwGroup ConvertGroup(PwGroupV3 groupV3) private PwGroup ConvertGroup(PwGroupV3 groupV3)
{ {
PwGroup pwGroup = new PwGroup(true, false); PwGroup pwGroup = new PwGroup(true, false);
@ -153,11 +161,12 @@ namespace keepass2android
return new DateTime(1970, 1, 1).AddMilliseconds(javatime); return new DateTime(1970, 1, 1).AddMilliseconds(javatime);
} }
#endif
public byte[] HashOfLastStream { get; private set; } public byte[] HashOfLastStream { get; private set; }
public bool CanWrite { get { return false; } } public bool CanWrite { get { return false; } }
} }
internal class AdditionalGroupData internal class AdditionalGroupData
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@ -27,6 +27,13 @@ namespace keepass2android
private bool _restoringInstanceState; private bool _restoringInstanceState;
private bool _showPassword; private bool _showPassword;
private ActivityDesign _design;
public CreateDatabaseActivity()
{
_design = new ActivityDesign(this);
}
private const int RequestCodeKeyFile = 0; private const int RequestCodeKeyFile = 0;
private const int RequestCodeDbFilename = 1; private const int RequestCodeDbFilename = 1;
@ -47,6 +54,7 @@ namespace keepass2android
protected override void OnCreate(Bundle bundle) protected override void OnCreate(Bundle bundle)
{ {
base.OnCreate(bundle); base.OnCreate(bundle);
_design.ApplyTheme();
SetContentView(Resource.Layout.create_database); SetContentView(Resource.Layout.create_database);
@ -214,6 +222,12 @@ namespace keepass2android
return true; return true;
} }
protected override void OnResume()
{
base.OnResume();
_design.ReapplyTheme();
}
protected override void OnRestoreInstanceState(Bundle savedInstanceState) protected override void OnRestoreInstanceState(Bundle savedInstanceState)
{ {
_restoringInstanceState = true; _restoringInstanceState = true;

View File

@ -91,6 +91,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
long usageCount = prefs.GetLong(GetString(Resource.String.UsageCount_key), 0); long usageCount = prefs.GetLong(GetString(Resource.String.UsageCount_key), 0);

View File

@ -77,7 +77,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
if (LastNonConfigurationInstance != null) if (LastNonConfigurationInstance != null)
{ {
//bug in Mono for Android or whatever: after config change the extra fields are wrong //bug in Mono for Android or whatever: after config change the extra fields are wrong

View File

@ -36,7 +36,7 @@ namespace keepass2android
builder.SetTitle(Resource.String.export_fileformats_title); builder.SetTitle(Resource.String.export_fileformats_title);
builder.SetSingleChoiceItems(Resource.Array.export_fileformat_options, _fileFormatIndex, builder.SetSingleChoiceItems(Resource.Array.export_fileformat_options, _fileFormatIndex,
delegate(object sender, DialogClickEventArgs args) { _fileFormatIndex = args.Which; }); delegate(object sender, DialogClickEventArgs args) { _fileFormatIndex = args.Which; });
builder.SetPositiveButton(Resource.String.ok, delegate builder.SetPositiveButton(Android.Resource.String.Ok, delegate
{ {
Intent intent = new Intent(this, typeof(FileStorageSelectionActivity)); Intent intent = new Intent(this, typeof(FileStorageSelectionActivity));
//intent.PutExtra(FileStorageSelectionActivity.AllowThirdPartyAppSend, true); //intent.PutExtra(FileStorageSelectionActivity.AllowThirdPartyAppSend, true);

View File

@ -14,8 +14,15 @@ namespace keepass2android
[Activity (Label = "@string/app_name", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden , Theme="@style/NoTitleBar")] [Activity (Label = "@string/app_name", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden , Theme="@style/NoTitleBar")]
public class FileStorageSelectionActivity : ListActivity public class FileStorageSelectionActivity : ListActivity
{ {
private ActivityDesign _design;
private FileStorageAdapter _fileStorageAdapter; private FileStorageAdapter _fileStorageAdapter;
public FileStorageSelectionActivity()
{
_design = new ActivityDesign(this);
}
public const string AllowThirdPartyAppGet = "AllowThirdPartyAppGet"; public const string AllowThirdPartyAppGet = "AllowThirdPartyAppGet";
public const string AllowThirdPartyAppSend = "AllowThirdPartyAppSend"; public const string AllowThirdPartyAppSend = "AllowThirdPartyAppSend";
@ -117,7 +124,7 @@ namespace keepass2android
protected override void OnCreate(Bundle bundle) protected override void OnCreate(Bundle bundle)
{ {
base.OnCreate(bundle); base.OnCreate(bundle);
_design.ApplyTheme();
SetContentView(Resource.Layout.filestorage_selection); SetContentView(Resource.Layout.filestorage_selection);
@ -130,6 +137,10 @@ namespace keepass2android
//listView.ItemsCanFocus = true; //listView.ItemsCanFocus = true;
} }
protected override void OnResume()
{
base.OnResume();
_design.ReapplyTheme();
}
} }
} }

View File

@ -93,6 +93,7 @@ namespace keepass2android
{ {
base.OnCreate (savedInstanceState); base.OnCreate (savedInstanceState);
if (IsFinishing) { if (IsFinishing) {
return; return;
} }

View File

@ -146,7 +146,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) { protected override void OnCreate(Bundle savedInstanceState) {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
AppTask = AppTask.GetTaskInOnCreate(savedInstanceState, Intent); AppTask = AppTask.GetTaskInOnCreate(savedInstanceState, Intent);
// Likely the app has been killed exit the activity // Likely the app has been killed exit the activity

View File

@ -33,11 +33,18 @@ namespace keepass2android
public const String KeyIconId = "icon_id"; public const String KeyIconId = "icon_id";
public const String KeyCustomIconId = "custom_icon_id"; public const String KeyCustomIconId = "custom_icon_id";
public const string KeyGroupUuid = "group_uuid"; public const string KeyGroupUuid = "group_uuid";
private ActivityDesign _design;
private int _selectedIconId; private int _selectedIconId;
private PwUuid _selectedCustomIconId = PwUuid.Zero; private PwUuid _selectedCustomIconId = PwUuid.Zero;
private PwGroup _groupToEdit; private PwGroup _groupToEdit;
public GroupEditActivity()
{
_design = new ActivityDesign(this);
}
public static void Launch(Activity act, PwGroup parentGroup) public static void Launch(Activity act, PwGroup parentGroup)
{ {
Intent i = new Intent(act, typeof(GroupEditActivity)); Intent i = new Intent(act, typeof(GroupEditActivity));
@ -62,6 +69,7 @@ namespace keepass2android
protected override void OnCreate (Bundle savedInstanceState) protected override void OnCreate (Bundle savedInstanceState)
{ {
base.OnCreate (savedInstanceState); base.OnCreate (savedInstanceState);
_design.ApplyDialogTheme();
SetContentView (Resource.Layout.group_edit); SetContentView (Resource.Layout.group_edit);
ImageButton iconButton = (ImageButton)FindViewById (Resource.Id.icon_button); ImageButton iconButton = (ImageButton)FindViewById (Resource.Id.icon_button);
@ -133,6 +141,12 @@ namespace keepass2android
break; break;
} }
} }
protected override void OnResume()
{
base.OnResume();
_design.ReapplyTheme();
}
} }
} }

View File

@ -39,6 +39,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.icon_picker); SetContentView(Resource.Layout.icon_picker);
GridView currIconGridView = (GridView)FindViewById(Resource.Id.IconGridView); GridView currIconGridView = (GridView)FindViewById(Resource.Id.IconGridView);

View File

@ -49,10 +49,12 @@ namespace keepass2android
public const Result ResultOkPasswordGenerator = Result.FirstUser + 9; public const Result ResultOkPasswordGenerator = Result.FirstUser + 9;
AppTask _appTask; AppTask _appTask;
private ActivityDesign _design;
protected override void OnCreate (Bundle bundle) protected override void OnCreate (Bundle bundle)
{ {
base.OnCreate (bundle); base.OnCreate (bundle);
_design.ApplyTheme();
_appTask = AppTask.GetTaskInOnCreate(bundle, Intent); _appTask = AppTask.GetTaskInOnCreate(bundle, Intent);
Kp2aLog.Log("KeePass.OnCreate"); Kp2aLog.Log("KeePass.OnCreate");
} }
@ -61,6 +63,8 @@ namespace keepass2android
{ {
base.OnResume(); base.OnResume();
Kp2aLog.Log("KeePass.OnResume"); Kp2aLog.Log("KeePass.OnResume");
_design.ReapplyTheme();
} }
@ -124,6 +128,11 @@ namespace keepass2android
private static String LIB_ART = "libart.so"; private static String LIB_ART = "libart.so";
private static String LIB_ART_D = "libartd.so"; private static String LIB_ART_D = "libartd.so";
public KeePass()
{
_design = new ActivityDesign(this);
}
private String GetCurrentRuntimeValue() private String GetCurrentRuntimeValue()
{ {
try try

View File

@ -33,10 +33,17 @@ namespace keepass2android
protected IOConnectionInfo _ioc; protected IOConnectionInfo _ioc;
private BroadcastReceiver _intentReceiver; private BroadcastReceiver _intentReceiver;
private ActivityDesign _design;
public LockCloseActivity()
{
_design = new ActivityDesign(this);
}
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
_design.ApplyTheme();
_ioc = App.Kp2a.GetDb().Ioc; _ioc = App.Kp2a.GetDb().Ioc;
if (Intent.GetBooleanExtra(NoLockCheck, false)) if (Intent.GetBooleanExtra(NoLockCheck, false))
@ -67,6 +74,8 @@ namespace keepass2android
{ {
base.OnResume(); base.OnResume();
_design.ReapplyTheme();
if (Intent.GetBooleanExtra(NoLockCheck, false)) if (Intent.GetBooleanExtra(NoLockCheck, false))
return; return;

View File

@ -31,15 +31,17 @@ namespace keepass2android
public class LockCloseListActivity : LockingListActivity { public class LockCloseListActivity : LockingListActivity {
public LockCloseListActivity() public LockCloseListActivity()
{ {
_design = new ActivityDesign(this);
} }
IOConnectionInfo _ioc; IOConnectionInfo _ioc;
private BroadcastReceiver _intentReceiver; private BroadcastReceiver _intentReceiver;
private ActivityDesign _design;
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
_design.ApplyTheme();
_ioc = App.Kp2a.GetDb().Ioc; _ioc = App.Kp2a.GetDb().Ioc;
_intentReceiver = new LockCloseListActivityBroadcastReceiver(this); _intentReceiver = new LockCloseListActivityBroadcastReceiver(this);
@ -54,12 +56,13 @@ namespace keepass2android
public LockCloseListActivity (IntPtr javaReference, JniHandleOwnership transfer) public LockCloseListActivity (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer) : base(javaReference, transfer)
{ {
_design = new ActivityDesign(this);
} }
protected override void OnResume() protected override void OnResume()
{ {
base.OnResume(); base.OnResume();
_design.ReapplyTheme();
if (TimeoutHelper.CheckShutdown(this, _ioc)) if (TimeoutHelper.CheckShutdown(this, _ioc))
return; return;

View File

@ -1,86 +1,98 @@
using System; using System;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM; using Android.Content.PM;
using Android.OS; using Android.OS;
using Android.Widget; using Android.Widget;
using Java.Util.Regex; using Java.Util.Regex;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = "@string/app_name", [Activity(Label = "@string/app_name",
ConfigurationChanges = ConfigChanges.Orientation | ConfigurationChanges = ConfigChanges.Orientation |
ConfigChanges.KeyboardHidden, ConfigChanges.KeyboardHidden,
NoHistory = true, NoHistory = true,
ExcludeFromRecents = true, ExcludeFromRecents = true,
Theme = "@android:style/Theme.Dialog")] Theme = "@android:style/Theme.Dialog")]
[IntentFilter(new[] { "android.nfc.action.NDEF_DISCOVERED" }, [IntentFilter(new[] { "android.nfc.action.NDEF_DISCOVERED" },
Label = "@string/app_name", Label = "@string/app_name",
Categories = new[] { Intent.CategoryDefault }, Categories = new[] { Intent.CategoryDefault },
DataHost = "my.yubico.com", DataHost = "my.yubico.com",
DataPathPrefix = "/neo", DataPathPrefix = "/neo",
DataScheme = "https")] DataScheme = "https")]
public class NfcOtpActivity : Activity public class NfcOtpActivity : Activity
{ {
private String GetOtpFromIntent(Intent intent) private String GetOtpFromIntent(Intent intent)
{ {
String data = intent.DataString; String data = intent.DataString;
Matcher matcher = OtpPattern.Matcher(data); Matcher matcher = OtpPattern.Matcher(data);
if (matcher.Matches()) if (matcher.Matches())
{ {
String otp = matcher.Group(1); String otp = matcher.Group(1);
return otp; return otp;
} }
return null; return null;
} }
private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/(.+)$"); private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/(.+)$");
private ActivityDesign _design;
protected override void OnCreate(Bundle bundle) public NfcOtpActivity()
{ {
base.OnCreate(bundle); _design = new ActivityDesign(this);
}
Intent i = new Intent(this, typeof (PasswordActivity));
i.SetAction(Intents.StartWithOtp); protected override void OnCreate(Bundle bundle)
{
//things to consider: base.OnCreate(bundle);
// PasswordActivity should be resumed if currently active -> this is why single top is used and why PasswordActivity is started _design.ApplyTheme();
// If PasswordActivity is not open already, it may be the wrong place to send our OTP to because maybe the user first needs to select
// a file (which might require UI action like entering credentials, all of which is handled in FileSelectActivity) Intent i = new Intent(this, typeof (PasswordActivity));
// FileSelectActivity is not on the back stack, it finishes itself. i.SetAction(Intents.StartWithOtp);
// -> PasswordActivity needs to handle this and return to FSA.
//things to consider:
// PasswordActivity should be resumed if currently active -> this is why single top is used and why PasswordActivity is started
i.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop); // If PasswordActivity is not open already, it may be the wrong place to send our OTP to because maybe the user first needs to select
try // a file (which might require UI action like entering credentials, all of which is handled in FileSelectActivity)
{ // FileSelectActivity is not on the back stack, it finishes itself.
string otp = GetOtpFromIntent(Intent); // -> PasswordActivity needs to handle this and return to FSA.
if (otp == null)
throw new Exception("Otp must not be null!");
i.PutExtra(Intents.OtpExtraKey, otp); i.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
} try
catch (Exception e) {
{ string otp = GetOtpFromIntent(Intent);
Kp2aLog.Log(e.ToString()); if (otp == null)
Toast.MakeText(this, "No Yubikey OTP found!", ToastLength.Long).Show(); throw new Exception("Otp must not be null!");
Finish(); i.PutExtra(Intents.OtpExtraKey, otp);
return; }
} catch (Exception e)
{
if (App.Kp2a.GetDb().Loaded) Kp2aLog.Log(e.ToString());
{ Toast.MakeText(this, "No Yubikey OTP found!", ToastLength.Long).Show();
Toast.MakeText(this, GetString(Resource.String.otp_discarded_because_db_open), ToastLength.Long).Show(); Finish();
} return;
else }
{
StartActivity(i); if (App.Kp2a.GetDb().Loaded)
} {
Toast.MakeText(this, GetString(Resource.String.otp_discarded_because_db_open), ToastLength.Long).Show();
Finish(); }
else
} {
} StartActivity(i);
}
Finish();
}
protected override void OnResume()
{
base.OnResume();
_design.ReapplyTheme();
}
}
} }

View File

@ -120,15 +120,17 @@ namespace keepass2android
private const string PasswordKey = "PasswordKey"; private const string PasswordKey = "PasswordKey";
private const string KeyFileOrProviderKey = "KeyFileOrProviderKey"; private const string KeyFileOrProviderKey = "KeyFileOrProviderKey";
private ActivityDesign _design;
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer) public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer) : base(javaReference, transfer)
{ {
_design = new ActivityDesign(this);
} }
public PasswordActivity() public PasswordActivity()
{ {
_design = new ActivityDesign(this);
} }
@ -333,6 +335,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
_design.ApplyTheme();
Intent i = Intent; Intent i = Intent;
@ -961,6 +964,8 @@ namespace keepass2android
{ {
base.OnResume(); base.OnResume();
_design.ReapplyTheme();
View killButton = FindViewById(Resource.Id.kill_app); View killButton = FindViewById(Resource.Id.kill_app);
if (PreferenceManager.GetDefaultSharedPreferences(this) if (PreferenceManager.GetDefaultSharedPreferences(this)
.GetBoolean(GetString(Resource.String.show_kill_app_key), false)) .GetBoolean(GetString(Resource.String.show_kill_app_key), false))

View File

@ -36,9 +36,17 @@ namespace keepass2android
private IOConnectionInfo _ioc; private IOConnectionInfo _ioc;
private QuickUnlockBroadcastReceiver _intentReceiver; private QuickUnlockBroadcastReceiver _intentReceiver;
private ActivityDesign _design;
public QuickUnlock()
{
_design = new ActivityDesign(this);
}
protected override void OnCreate(Bundle bundle) protected override void OnCreate(Bundle bundle)
{ {
base.OnCreate(bundle); base.OnCreate(bundle);
_design.ApplyTheme();
_ioc = App.Kp2a.GetDb().Ioc; _ioc = App.Kp2a.GetDb().Ioc;
@ -124,6 +132,8 @@ namespace keepass2android
{ {
base.OnResume(); base.OnResume();
_design.ReapplyTheme();
CheckIfUnloaded(); CheckIfUnloaded();
EditText pwd = (EditText) FindViewById(Resource.Id.QuickUnlock_password); EditText pwd = (EditText) FindViewById(Resource.Id.QuickUnlock_password);

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -11,7 +11,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:paddingRight="20dp" android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_accept" android:drawableLeft="?attr/NavigationAcceptDrawable"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/entry_save" /> android:text="@string/entry_save" />

View File

@ -123,7 +123,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/advanced_container" android:layout_below="@id/advanced_container"
android:drawableLeft="@drawable/ic_menu_add_field_holo_light" android:drawableLeft="?attr/ic_menu_add_field"
android:text="@string/add_extra_string" /> android:text="@string/add_extra_string" />
<!-- file attachments --> <!-- file attachments -->
<TextView <TextView

View File

@ -24,7 +24,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:paddingRight="20dp" android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_accept" android:drawableLeft="?attr/NavigationAcceptDrawable"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/accept" /> android:text="@string/accept" />
@ -41,7 +41,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:paddingRight="20dp" android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_cancel" android:drawableLeft="?attr/CancelDrawable"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@android:string/cancel" /> android:text="@android:string/cancel" />

View File

@ -29,7 +29,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:paddingRight="20dp" android:paddingRight="20dp"
android:drawableLeft="@drawable/btn_new_group" android:drawableLeft="?attr/NewGroupDrawable"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/add_group" /> android:text="@string/add_group" />
@ -48,7 +48,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:paddingRight="20dp" android:paddingRight="20dp"
android:drawableLeft="@drawable/device_access_new_account" android:drawableLeft="?attr/NewEntryDrawable"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/add_entry" /> android:text="@string/add_entry" />
@ -65,7 +65,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:paddingRight="20dp" android:paddingRight="20dp"
android:drawableLeft="@drawable/btn_new_group" android:drawableLeft="?attr/NewGroupDrawable"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/insert_element_here" /> android:text="@string/insert_element_here" />

View File

@ -16,19 +16,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/start_open_file" android:id="@+id/start_open_file"
android:minHeight="45dp" android:minHeight="45dp"
android:drawableTop="@drawable/collections_collection" /> android:drawableTop="?attr/OpenFileDrawable" />
<Button <Button
android:text="@string/start_open_url" android:text="@string/start_open_url"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/start_open_url" android:id="@+id/start_open_url"
android:minHeight="45dp" android:minHeight="45dp"
android:drawableTop="@drawable/location_web_site" /> android:drawableTop="?attr/OpenUrlDrawable" />
<Button <Button
android:text="@string/start_create" android:text="@string/start_create"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/start_create" android:id="@+id/start_create"
android:minHeight="45dp" android:minHeight="45dp"
android:drawableTop="@drawable/collections_new_label" /> android:drawableTop="?attr/CreateDbDrawable" />
</LinearLayout> </LinearLayout>

View File

@ -17,7 +17,7 @@
android:id="@+id/browse_button" android:id="@+id/browse_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_folder_small" android:src="?attr/ic_launcher_folder_small"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/label_open_by_filename" /> android:layout_below="@id/label_open_by_filename" />
<EditText <EditText

View File

@ -11,7 +11,7 @@
android:id="@+id/search_button" android:id="@+id/search_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_action_search" android:src="?attr/ic_action_search_drawable"
android:layout_below="@id/search_label" android:layout_below="@id/search_label"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
<EditText <EditText

View File

@ -22,7 +22,7 @@
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/menu_change_db" <item android:id="@+id/menu_change_db"
android:icon="@drawable/collections_collection" android:icon="?attr/OpenFileDrawable"
android:title="@string/menu_change_db" android:title="@string/menu_change_db"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />

View File

@ -17,15 +17,15 @@
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="GroupTextSmall" parent="attr/TextViewParentStyle"> <style name="GroupTextSmall">
<item name="@android:textColor">?TextColorGroup</item> <item name="@android:textColor">?TextColorGroup</item>
</style> </style>
<style name="GroupText" parent="@attr/TextViewParentStyle"> <style name="GroupText">
<item name="@android:textColor">?TextColorGroup</item> <item name="@android:textColor">?TextColorGroup</item>
<item name="@android:textSize">20sp</item> <item name="@android:textSize">20sp</item>
</style> </style>
<style name="GroupTextLarge" parent="@attr/TextViewParentStyle"> <style name="GroupTextLarge">
<item name="@android:textColor">?TextColorGroup</item> <item name="@android:textColor">?TextColorGroup</item>
<item name="@android:textSize">28sp</item> <item name="@android:textSize">28sp</item>
</style> </style>

View File

@ -17,8 +17,6 @@
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="BaseDark" parent="android:Theme.Holo"> <style name="BaseDark" parent="android:Theme.Holo">
<item name="TextViewParentStyle">@style/small</item>
<item name="ActionBarButtonParentStyle">@android:style/Widget.Holo.Light.ActionButton</item>
<item name="TextColorGroup">?android:attr/textColorPrimary</item> <item name="TextColorGroup">?android:attr/textColorPrimary</item>
<item name="TextColorHeader">?android:attr/textColorPrimary</item> <item name="TextColorHeader">?android:attr/textColorPrimary</item>
<item name="TextColorItem">?android:attr/textColorSecondary</item> <item name="TextColorItem">?android:attr/textColorSecondary</item>
@ -29,11 +27,19 @@
<item name="OpenFileDrawable">@drawable/collections_collection_holodark</item> <item name="OpenFileDrawable">@drawable/collections_collection_holodark</item>
<item name="CreateDbDrawable">@drawable/collections_new_label_holodark</item> <item name="CreateDbDrawable">@drawable/collections_new_label_holodark</item>
<item name="OpenUrlDrawable">@drawable/location_web_site_holodark</item> <item name="OpenUrlDrawable">@drawable/location_web_site_holodark</item>
<item name="ic_menu_add_field">@drawable/ic_menu_add_field_holodark</item>
<item name="ic_launcher_folder_small">@drawable/ic_launcher_folder_small</item>
<item name="ic_action_search_drawable">@drawable/ic_action_search_holodark</item>
<item name="NavigationAcceptDrawable">@drawable/navigation_accept_dark</item>
</style> </style>
<style name="TextViewParent" parent="@style/small"></style>
<style name="NoTitleBarDark" parent="BaseDark"></style> <style name="NoTitleBarDark" parent="BaseDark"></style>
<style name="DialogDark" parent="BaseDark"></style> <style name="BaseDark_Dialog" parent="android:Theme.Holo.Dialog" />
<style name="DialogDark" parent="BaseDark_Dialog"></style>
<style name="ThemeDark" parent="BaseDark"></style>
</resources> </resources>

View File

@ -17,10 +17,7 @@
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="BaseLight" parent="android:Theme.Holo.Light"> <style name="BaseLight" parent="android:Theme.Holo.Light">
<!-- <item name="TextViewParentStyle">@android:style/Widget.Holo.Light.TextView</item> --> <item name="TextColorGroup">@color/dark_gray</item>
<item name="TextViewParentStyle">@style/BIG</item>
<item name="ActionBarButtonParentStyle">@android:style/Widget.Holo.Light.ActionButton</item>
<item name="TextColorGroup">@color/blue_highlight</item>
<item name="TextColorHeader">@color/light_gray</item> <item name="TextColorHeader">@color/light_gray</item>
<item name="TextColorItem">@color/dark_gray</item> <item name="TextColorItem">@color/dark_gray</item>
<item name="CancelDrawable">@android:drawable/ic_menu_close_clear_cancel</item> <item name="CancelDrawable">@android:drawable/ic_menu_close_clear_cancel</item>
@ -30,15 +27,17 @@
<item name="OpenFileDrawable">@drawable/collections_collection</item> <item name="OpenFileDrawable">@drawable/collections_collection</item>
<item name="CreateDbDrawable">@drawable/collections_new_label</item> <item name="CreateDbDrawable">@drawable/collections_new_label</item>
<item name="OpenUrlDrawable">@drawable/location_web_site</item> <item name="OpenUrlDrawable">@drawable/location_web_site</item>
<item name="ic_menu_add_field">@drawable/ic_menu_add_field_holo_light</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> <!--Holo Dark: ..dark.png -->
</style> </style>
<style name="TextViewParent" parent="@style/BIG"></style>
<style name="NoTitleBarLight" parent="BaseLight"> <style name="NoTitleBarLight" parent="BaseLight">
</style> </style>
<style name="DialogLight" parent="BaseLight"></style> <style name="DialogLight" parent="BaseLight"></style>
<style name="BIG"> <style name="ThemeLight" parent="BaseLight"></style>
<item name="android:textSize">50sp</item>
</style> <!-- "default" for Preference activity etc.:-->
<style name="small"> <style name="NoTitleBar" parent="BaseLight"></style>
<item name="android:textSize">7sp</item>
</style>
</resources> </resources>

View File

@ -54,7 +54,8 @@
<string name="maskpass_key">maskpass</string> <string name="maskpass_key">maskpass</string>
<string name="omitbackup_key">omitbackup</string> <string name="omitbackup_key">omitbackup</string>
<string name="list_size_key">list_size</string> <string name="list_size_key">list_size</string>
<string name="sort_key">sort_key</string> <string name="design_key">design_key</string>
<string name="sort_key">sort_key</string>
<string name="TanExpiresOnUse_key">TanExpiresOnUse_key</string> <string name="TanExpiresOnUse_key">TanExpiresOnUse_key</string>
<string name="ShowUsernameInList_key">ShowUsernameInList_key</string> <string name="ShowUsernameInList_key">ShowUsernameInList_key</string>
<string name="RememberRecentFiles_key">RememberRecentFiles_key</string> <string name="RememberRecentFiles_key">RememberRecentFiles_key</string>
@ -124,6 +125,12 @@
<item>28</item> <item>28</item>
</string-array> </string-array>
<string name="design_default">Light</string>
<string-array name="design_values">
<item>Light</item>
<item>Dark</item>
</string-array>
<string name="AcceptAllServerCertificates_default">WARN</string> <string name="AcceptAllServerCertificates_default">WARN</string>
<string-array name="AcceptAllServerCertificates_values"> <string-array name="AcceptAllServerCertificates_values">
<item>IGNORE</item> <item>IGNORE</item>

View File

@ -537,7 +537,15 @@ Initial public release
<item>Medium</item> <item>Medium</item>
<item>Large</item> <item>Large</item>
</string-array> </string-array>
<string-array name="cred_remember_modes">
<string-array name="design_options">
<item>Holo Light</item>
<item>Holo Dark</item>
</string-array>
<string name="design_title">Design</string>
<string-array name="cred_remember_modes">
<item>Do not remember username and password</item> <item>Do not remember username and password</item>
<item>Remember username only</item> <item>Remember username only</item>
<item>Remember username and password</item> <item>Remember username and password</item>

View File

@ -18,7 +18,12 @@
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>. along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
--> -->
<resources> <resources>
<style name="Base"></style> <style name="Base">
<item name="OpenFileDrawable">@drawable/collections_collection</item>
<item name="CreateDbDrawable">@drawable/collections_new_label</item>
<item name="OpenUrlDrawable">@drawable/location_web_site</item>
</style>
<style name="NoTitleBar"></style> <style name="NoTitleBar"></style>
<style name="Dialog" parent="android:Theme.Dialog"></style> <style name="Dialog" parent="android:Theme.Dialog"></style>
<style name="GroupTextSmall" parent="android:Theme"> <style name="GroupTextSmall" parent="android:Theme">

View File

@ -138,6 +138,14 @@
android:entryValues="@array/list_size_values" android:entryValues="@array/list_size_values"
android:dialogTitle="@string/list_size_summary" android:dialogTitle="@string/list_size_summary"
android:defaultValue="@string/list_size_default"/> android:defaultValue="@string/list_size_default"/>
<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"/>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen <PreferenceScreen

View File

@ -321,6 +321,8 @@ namespace keepass2android
((EditText)dialog.FindViewById(Resource.Id.cred_password)).Text = ioc.Password; ((EditText)dialog.FindViewById(Resource.Id.cred_password)).Text = ioc.Password;
((Spinner)dialog.FindViewById(Resource.Id.cred_remember_mode)).SetSelection((int)ioc.CredSaveMode); ((Spinner)dialog.FindViewById(Resource.Id.cred_remember_mode)).SetSelection((int)ioc.CredSaveMode);
} }
} }
} }

View File

@ -44,14 +44,16 @@ namespace keepass2android
DataMimeType="text/plain")] DataMimeType="text/plain")]
public class FileSelectActivity : ListActivity public class FileSelectActivity : ListActivity
{ {
private ActivityDesign _design;
public FileSelectActivity (IntPtr javaReference, JniHandleOwnership transfer) public FileSelectActivity (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer) : base(javaReference, transfer)
{ {
_design = new ActivityDesign(this);
} }
public FileSelectActivity() public FileSelectActivity()
{ {
_design = new ActivityDesign(this);
} }
private const int CmenuClear = Menu.First; private const int CmenuClear = Menu.First;
@ -70,6 +72,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
_design.ApplyTheme();
Kp2aLog.Log("FileSelect.OnCreate"); Kp2aLog.Log("FileSelect.OnCreate");
Kp2aLog.Log("FileSelect:apptask="+Intent.GetStringExtra("KP2A_APPTASK")); Kp2aLog.Log("FileSelect:apptask="+Intent.GetStringExtra("KP2A_APPTASK"));
@ -412,6 +415,8 @@ namespace keepass2android
base.OnResume(); base.OnResume();
Kp2aLog.Log("FileSelect.OnResume"); Kp2aLog.Log("FileSelect.OnResume");
_design.ReapplyTheme();
// Check to see if we need to change modes // Check to see if we need to change modes
if (ShowRecentFiles() != _recentMode) if (ShowRecentFiles() != _recentMode)
{ {

View File

@ -24,9 +24,17 @@ namespace keepass2android.fileselect
{ {
private bool _isRecreated = false; private bool _isRecreated = false;
private ActivityDesign _design;
public FileStorageSetupActivity()
{
_design = new ActivityDesign(this);
}
protected override void OnCreate(Bundle bundle) protected override void OnCreate(Bundle bundle)
{ {
base.OnCreate(bundle); base.OnCreate(bundle);
_design.ApplyTheme();
SetContentView(Resource.Layout.file_storage_setup); SetContentView(Resource.Layout.file_storage_setup);
@ -60,6 +68,7 @@ namespace keepass2android.fileselect
protected override void OnResume() protected override void OnResume()
{ {
base.OnResume(); base.OnResume();
_design.ReapplyTheme();
App.Kp2a.GetFileStorage(Ioc).OnResume(this); App.Kp2a.GetFileStorage(Ioc).OnResume(this);
} }

View File

@ -23,14 +23,14 @@
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize> <JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<JavaOptions /> <JavaOptions />
<AndroidUseLatestPlatformSdk /> <AndroidUseLatestPlatformSdk />
<AndroidSupportedAbis>armeabi,armeabi-v7a</AndroidSupportedAbis> <AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath> <OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants> <DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause> <ConsolePause>False</ConsolePause>
@ -119,6 +119,7 @@
<Compile Include="GroupBaseActivity.cs" /> <Compile Include="GroupBaseActivity.cs" />
<Compile Include="LockCloseListActivity.cs" /> <Compile Include="LockCloseListActivity.cs" />
<Compile Include="LockingListActivity.cs" /> <Compile Include="LockingListActivity.cs" />
<Compile Include="Utils\ActivityDesign.cs" />
<Compile Include="Utils\LoadingDialog.cs" /> <Compile Include="Utils\LoadingDialog.cs" />
<Compile Include="Utils\Util.cs" /> <Compile Include="Utils\Util.cs" />
<Compile Include="views\ClickView.cs" /> <Compile Include="views\ClickView.cs" />
@ -179,6 +180,7 @@
<Link>libs\armeabi\libfinal-key.so</Link> <Link>libs\armeabi\libfinal-key.so</Link>
</AndroidNativeLibrary> </AndroidNativeLibrary>
<None Include="Resources\AboutResources.txt" /> <None Include="Resources\AboutResources.txt" />
<AndroidResource Include="Resources\drawable-hdpi\Thumbs.db" />
<None Include="Resources\drawable\Thumbs.db"> <None Include="Resources\drawable\Thumbs.db">
<Visible>False</Visible> <Visible>False</Visible>
</None> </None>
@ -665,14 +667,6 @@
<Folder Include="SupportLib\" /> <Folder Include="SupportLib\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AndroidFileChooserBinding\AndroidFileChooserBinding.csproj">
<Project>{3c0f7fe5-639f-4422-a087-8b26cf862d1b}</Project>
<Name>AndroidFileChooserBinding</Name>
</ProjectReference>
<ProjectReference Include="..\AppCompatV7Binding\AppCompatV7Binding.csproj">
<Project>{23233a28-d74f-4bf8-b4d8-834060840bd7}</Project>
<Name>AppCompatV7Binding</Name>
</ProjectReference>
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj"> <ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
<Project>{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}</Project> <Project>{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}</Project>
<Name>KeePassLib2Android</Name> <Name>KeePassLib2Android</Name>
@ -681,18 +675,6 @@
<Project>{53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}</Project> <Project>{53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}</Project>
<Name>Kp2aBusinessLogic</Name> <Name>Kp2aBusinessLogic</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\KP2AKdbLibraryBinding\KP2AKdbLibraryBinding.csproj">
<Project>{70d3844a-d9fa-4a64-b205-a84c6a822196}</Project>
<Name>KP2AKdbLibraryBinding</Name>
</ProjectReference>
<ProjectReference Include="..\Kp2aKeyboardBinding\Kp2aKeyboardBinding.csproj">
<Project>{a8779d4d-7c49-4c2f-82bd-2cdc448391da}</Project>
<Name>Kp2aKeyboardBinding</Name>
</ProjectReference>
<ProjectReference Include="..\TwofishCipher\TwofishCipher.csproj" Condition="!$(DefineConstants.Contains('EXCLUDE_TWOFISH'))">
<Project>{5CF675A5-9BEE-4720-BED9-D5BF14A2EBF9}</Project>
<Name>TwofishCipher</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ProjectExtensions> <ProjectExtensions>
<MonoDevelop> <MonoDevelop>
@ -875,4 +857,54 @@
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\device_access_new_account.png" /> <AndroidResource Include="Resources\drawable-hdpi\device_access_new_account.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\btn_new_group_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_menu_add_field_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_menu_remove_field_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\btn_new_group.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\btn_new_group_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\collections_collection_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\collections_new_label_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\device_access_new_account_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\ic_menu_remove_field_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\location_web_site_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values-v14\styles_dark.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values-v14\styles_light.xml">
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\attrs.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\navigation_cancel_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_action_search_holodark.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\ic_action_search_holodark.png" />
</ItemGroup>
</Project> </Project>

View File

@ -29,7 +29,7 @@ namespace keepass2android
/// Activity to display search options /// Activity to display search options
/// </summary> /// </summary>
[Activity (Label = "@string/app_name", Theme="@style/Base")] [Activity (Label = "@string/app_name", Theme="@style/Base")]
public class SearchActivity : LifecycleDebugActivity public class SearchActivity : LockCloseActivity
{ {
bool GetCheckBoxValue(int resId) bool GetCheckBoxValue(int resId)
{ {

View File

@ -37,7 +37,7 @@ namespace keepass2android.search
protected override void OnCreate (Bundle bundle) protected override void OnCreate (Bundle bundle)
{ {
base.OnCreate (bundle); base.OnCreate (bundle);
if ( IsFinishing ) { if ( IsFinishing ) {
return; return;
} }

View File

@ -31,6 +31,13 @@ namespace keepass2android
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")] [Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")]
public class AppSettingsActivity : LockingPreferenceActivity public class AppSettingsActivity : LockingPreferenceActivity
{ {
private ActivityDesign _design;
public AppSettingsActivity()
{
_design = new ActivityDesign(this);
}
public static void Launch(Context ctx) public static void Launch(Context ctx)
{ {
ctx.StartActivity(new Intent(ctx, typeof(AppSettingsActivity))); ctx.StartActivity(new Intent(ctx, typeof(AppSettingsActivity)));
@ -38,12 +45,32 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
_design.ApplyTheme();
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
AddPreferencesFromResource(Resource.Xml.preferences); AddPreferencesFromResource(Resource.Xml.preferences);
FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += OnRememberKeyFileHistoryChanged; FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += OnRememberKeyFileHistoryChanged;
FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)).PreferenceChange += OnShowUnlockedNotificationChanged;; FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)).PreferenceChange += OnShowUnlockedNotificationChanged;;
Preference designPref = FindPreference(GetString(Resource.String.design_key));
if (!_design.HasThemes())
{
try
{
((PreferenceScreen)FindPreference(GetString(Resource.String.display_prefs_key))).RemovePreference(designPref);
}
catch (Exception ex)
{
Kp2aLog.Log(ex.ToString());
throw;
}
}
else
{
designPref.PreferenceChange += (sender, args) => Recreate();
}
Preference cachingPreference = FindPreference(GetString(Resource.String.UseOfflineCache_key)); Preference cachingPreference = FindPreference(GetString(Resource.String.UseOfflineCache_key));
cachingPreference.PreferenceChange += OnUseOfflineCacheChanged; cachingPreference.PreferenceChange += OnUseOfflineCacheChanged;
@ -63,6 +90,11 @@ namespace keepass2android
FindPreference(GetString(Resource.String.db_key)).Enabled = false; FindPreference(GetString(Resource.String.db_key)).Enabled = false;
} }
private void OnDesignChange(object sender, Preference.PreferenceChangeEventArgs preferenceChangeEventArgs)
{
Recreate();
}
private void OnQuickUnlockHiddenChanged(object sender, Preference.PreferenceChangeEventArgs e) private void OnQuickUnlockHiddenChanged(object sender, Preference.PreferenceChangeEventArgs e)
{ {
App.Kp2a.UpdateOngoingNotification(); App.Kp2a.UpdateOngoingNotification();

View File

@ -32,6 +32,13 @@ namespace keepass2android
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")] [Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")]
public class DatabaseSettingsActivity : LockingClosePreferenceActivity public class DatabaseSettingsActivity : LockingClosePreferenceActivity
{ {
private ActivityDesign _design;
public DatabaseSettingsActivity()
{
_design = new ActivityDesign(this);
}
public static void Launch(Context ctx) public static void Launch(Context ctx)
{ {
ctx.StartActivity(new Intent(ctx, typeof(DatabaseSettingsActivity))); ctx.StartActivity(new Intent(ctx, typeof(DatabaseSettingsActivity)));
@ -39,6 +46,8 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
_design.ApplyTheme();
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
AddPreferencesFromResource(Resource.Xml.preferences); AddPreferencesFromResource(Resource.Xml.preferences);
@ -46,6 +55,24 @@ namespace keepass2android
// Re-use the change handlers for the application settings // Re-use the change handlers for the application settings
FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += AppSettingsActivity.OnRememberKeyFileHistoryChanged; FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += AppSettingsActivity.OnRememberKeyFileHistoryChanged;
FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)).PreferenceChange += AppSettingsActivity.OnShowUnlockedNotificationChanged; FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)).PreferenceChange += AppSettingsActivity.OnShowUnlockedNotificationChanged;
Preference designPref = FindPreference(GetString(Resource.String.design_key));
if (!_design.HasThemes())
{
try
{
((PreferenceScreen)FindPreference(GetString(Resource.String.display_prefs_key))).RemovePreference(designPref);
}
catch (Exception ex)
{
Kp2aLog.Log(ex.ToString());
throw;
}
}
else
{
designPref.PreferenceChange += (sender, args) => Recreate();
}
Database db = App.Kp2a.GetDb(); Database db = App.Kp2a.GetDb();