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/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>
<Optimize>False</Optimize>
<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>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>

View File

@ -20,7 +20,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<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>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@ -112,18 +112,10 @@
<Compile Include="Utils\Spr\SprEngine.PickChars.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj">
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
<Name>JavaFileStorageBindings</Name>
</ProjectReference>
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
<Project>{545b4a6b-8bba-4fbe-92fc-4ac060122a54}</Project>
<Name>KeePassLib2Android</Name>
</ProjectReference>
<ProjectReference Include="..\KP2AKdbLibraryBinding\KP2AKdbLibraryBinding.csproj">
<Project>{70d3844a-d9fa-4a64-b205-a84c6a822196}</Project>
<Name>KP2AKdbLibraryBinding</Name>
</ProjectReference>
</ItemGroup>
<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.

View File

@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
#if !EXCLUDE_KEYTRANSFORM
using Com.Keepassdroid.Database;
using Com.Keepassdroid.Database.Exception;
#endif
using KeePassLib;
using KeePassLib.Cryptography;
using KeePassLib.Interfaces;
@ -21,6 +23,7 @@ namespace keepass2android
public void PopulateDatabaseFromStream(PwDatabase db, CompositeKey key, Stream s, IStatusLogger slLogger)
{
#if !EXCLUDE_KEYTRANSFORM
var importer = new Com.Keepassdroid.Database.Load.ImporterV3();
var hashingStream = new HashingStreamEx(s, false, new SHA256Managed());
@ -67,8 +70,13 @@ namespace keepass2android
HashOfLastStream = hashingStream.Hash;
if (HashOfLastStream == null)
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)
{
PwGroup pwGroup = new PwGroup(true, false);
@ -153,11 +161,12 @@ namespace keepass2android
return new DateTime(1970, 1, 1).AddMilliseconds(javatime);
}
#endif
public byte[] HashOfLastStream { get; private set; }
public bool CanWrite { get { return false; } }
}
internal class AdditionalGroupData
{
public int Id { get; set; }

View File

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

View File

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

View File

@ -77,7 +77,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
if (LastNonConfigurationInstance != null)
{
//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.SetSingleChoiceItems(Resource.Array.export_fileformat_options, _fileFormatIndex,
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.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")]
public class FileStorageSelectionActivity : ListActivity
{
private ActivityDesign _design;
private FileStorageAdapter _fileStorageAdapter;
public FileStorageSelectionActivity()
{
_design = new ActivityDesign(this);
}
public const string AllowThirdPartyAppGet = "AllowThirdPartyAppGet";
public const string AllowThirdPartyAppSend = "AllowThirdPartyAppSend";
@ -117,7 +124,7 @@ namespace keepass2android
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
_design.ApplyTheme();
SetContentView(Resource.Layout.filestorage_selection);
@ -130,6 +137,10 @@ namespace keepass2android
//listView.ItemsCanFocus = true;
}
protected override void OnResume()
{
base.OnResume();
_design.ReapplyTheme();
}
}
}

View File

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

View File

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

View File

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

View File

@ -49,10 +49,12 @@ namespace keepass2android
public const Result ResultOkPasswordGenerator = Result.FirstUser + 9;
AppTask _appTask;
private ActivityDesign _design;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
_design.ApplyTheme();
_appTask = AppTask.GetTaskInOnCreate(bundle, Intent);
Kp2aLog.Log("KeePass.OnCreate");
}
@ -61,6 +63,8 @@ namespace keepass2android
{
base.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_D = "libartd.so";
public KeePass()
{
_design = new ActivityDesign(this);
}
private String GetCurrentRuntimeValue()
{
try

View File

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

View File

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

View File

@ -1,86 +1,98 @@
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.OS;
using Android.Widget;
using Java.Util.Regex;
namespace keepass2android
{
[Activity(Label = "@string/app_name",
ConfigurationChanges = ConfigChanges.Orientation |
ConfigChanges.KeyboardHidden,
NoHistory = true,
ExcludeFromRecents = true,
Theme = "@android:style/Theme.Dialog")]
[IntentFilter(new[] { "android.nfc.action.NDEF_DISCOVERED" },
Label = "@string/app_name",
Categories = new[] { Intent.CategoryDefault },
DataHost = "my.yubico.com",
DataPathPrefix = "/neo",
DataScheme = "https")]
public class NfcOtpActivity : Activity
{
private String GetOtpFromIntent(Intent intent)
{
String data = intent.DataString;
Matcher matcher = OtpPattern.Matcher(data);
if (matcher.Matches())
{
String otp = matcher.Group(1);
return otp;
}
return null;
}
private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/(.+)$");
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Intent i = new Intent(this, typeof (PasswordActivity));
i.SetAction(Intents.StartWithOtp);
//things to consider:
// PasswordActivity should be resumed if currently active -> this is why single top is used and why PasswordActivity is started
// 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)
// FileSelectActivity is not on the back stack, it finishes itself.
// -> PasswordActivity needs to handle this and return to FSA.
i.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
try
{
string otp = GetOtpFromIntent(Intent);
if (otp == null)
throw new Exception("Otp must not be null!");
i.PutExtra(Intents.OtpExtraKey, otp);
}
catch (Exception e)
{
Kp2aLog.Log(e.ToString());
Toast.MakeText(this, "No Yubikey OTP found!", ToastLength.Long).Show();
Finish();
return;
}
if (App.Kp2a.GetDb().Loaded)
{
Toast.MakeText(this, GetString(Resource.String.otp_discarded_because_db_open), ToastLength.Long).Show();
}
else
{
StartActivity(i);
}
Finish();
}
}
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.OS;
using Android.Widget;
using Java.Util.Regex;
namespace keepass2android
{
[Activity(Label = "@string/app_name",
ConfigurationChanges = ConfigChanges.Orientation |
ConfigChanges.KeyboardHidden,
NoHistory = true,
ExcludeFromRecents = true,
Theme = "@android:style/Theme.Dialog")]
[IntentFilter(new[] { "android.nfc.action.NDEF_DISCOVERED" },
Label = "@string/app_name",
Categories = new[] { Intent.CategoryDefault },
DataHost = "my.yubico.com",
DataPathPrefix = "/neo",
DataScheme = "https")]
public class NfcOtpActivity : Activity
{
private String GetOtpFromIntent(Intent intent)
{
String data = intent.DataString;
Matcher matcher = OtpPattern.Matcher(data);
if (matcher.Matches())
{
String otp = matcher.Group(1);
return otp;
}
return null;
}
private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/(.+)$");
private ActivityDesign _design;
public NfcOtpActivity()
{
_design = new ActivityDesign(this);
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
_design.ApplyTheme();
Intent i = new Intent(this, typeof (PasswordActivity));
i.SetAction(Intents.StartWithOtp);
//things to consider:
// PasswordActivity should be resumed if currently active -> this is why single top is used and why PasswordActivity is started
// 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)
// FileSelectActivity is not on the back stack, it finishes itself.
// -> PasswordActivity needs to handle this and return to FSA.
i.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
try
{
string otp = GetOtpFromIntent(Intent);
if (otp == null)
throw new Exception("Otp must not be null!");
i.PutExtra(Intents.OtpExtraKey, otp);
}
catch (Exception e)
{
Kp2aLog.Log(e.ToString());
Toast.MakeText(this, "No Yubikey OTP found!", ToastLength.Long).Show();
Finish();
return;
}
if (App.Kp2a.GetDb().Loaded)
{
Toast.MakeText(this, GetString(Resource.String.otp_discarded_because_db_open), ToastLength.Long).Show();
}
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 KeyFileOrProviderKey = "KeyFileOrProviderKey";
private ActivityDesign _design;
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
_design = new ActivityDesign(this);
}
public PasswordActivity()
{
_design = new ActivityDesign(this);
}
@ -333,6 +335,7 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
_design.ApplyTheme();
Intent i = Intent;
@ -961,6 +964,8 @@ namespace keepass2android
{
base.OnResume();
_design.ReapplyTheme();
View killButton = FindViewById(Resource.Id.kill_app);
if (PreferenceManager.GetDefaultSharedPreferences(this)
.GetBoolean(GetString(Resource.String.show_kill_app_key), false))

View File

@ -36,9 +36,17 @@ namespace keepass2android
private IOConnectionInfo _ioc;
private QuickUnlockBroadcastReceiver _intentReceiver;
private ActivityDesign _design;
public QuickUnlock()
{
_design = new ActivityDesign(this);
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
_design.ApplyTheme();
_ioc = App.Kp2a.GetDb().Ioc;
@ -124,6 +132,8 @@ namespace keepass2android
{
base.OnResume();
_design.ReapplyTheme();
CheckIfUnloaded();
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_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_accept"
android:drawableLeft="?attr/NavigationAcceptDrawable"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/entry_save" />

View File

@ -123,7 +123,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
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" />
<!-- file attachments -->
<TextView

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
android:id="@+id/browse_button"
android:layout_width="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_below="@id/label_open_by_filename" />
<EditText

View File

@ -11,7 +11,7 @@
android:id="@+id/search_button"
android:layout_width="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_alignParentRight="true" />
<EditText

View File

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

View File

@ -17,15 +17,15 @@
-->
<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>
</style>
<style name="GroupText" parent="@attr/TextViewParentStyle">
<style name="GroupText">
<item name="@android:textColor">?TextColorGroup</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="GroupTextLarge" parent="@attr/TextViewParentStyle">
<style name="GroupTextLarge">
<item name="@android:textColor">?TextColorGroup</item>
<item name="@android:textSize">28sp</item>
</style>

View File

@ -17,8 +17,6 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<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="TextColorHeader">?android:attr/textColorPrimary</item>
<item name="TextColorItem">?android:attr/textColorSecondary</item>
@ -29,11 +27,19 @@
<item name="OpenFileDrawable">@drawable/collections_collection_holodark</item>
<item name="CreateDbDrawable">@drawable/collections_new_label_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 name="TextViewParent" parent="@style/small"></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>

View File

@ -17,10 +17,7 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="BaseLight" parent="android:Theme.Holo.Light">
<!-- <item name="TextViewParentStyle">@android:style/Widget.Holo.Light.TextView</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="TextColorGroup">@color/dark_gray</item>
<item name="TextColorHeader">@color/light_gray</item>
<item name="TextColorItem">@color/dark_gray</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="CreateDbDrawable">@drawable/collections_new_label</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 name="TextViewParent" parent="@style/BIG"></style>
<style name="NoTitleBarLight" parent="BaseLight">
</style>
<style name="DialogLight" parent="BaseLight"></style>
<style name="BIG">
<item name="android:textSize">50sp</item>
</style>
<style name="small">
<item name="android:textSize">7sp</item>
</style>
<style name="ThemeLight" parent="BaseLight"></style>
<!-- "default" for Preference activity etc.:-->
<style name="NoTitleBar" parent="BaseLight"></style>
</resources>

View File

@ -54,7 +54,8 @@
<string name="maskpass_key">maskpass</string>
<string name="omitbackup_key">omitbackup</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="ShowUsernameInList_key">ShowUsernameInList_key</string>
<string name="RememberRecentFiles_key">RememberRecentFiles_key</string>
@ -124,6 +125,12 @@
<item>28</item>
</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-array name="AcceptAllServerCertificates_values">
<item>IGNORE</item>

View File

@ -537,7 +537,15 @@ Initial public release
<item>Medium</item>
<item>Large</item>
</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>Remember username only</item>
<item>Remember username and password</item>

View File

@ -18,7 +18,12 @@
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
-->
<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="Dialog" parent="android:Theme.Dialog"></style>
<style name="GroupTextSmall" parent="android:Theme">

View File

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

View File

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

View File

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

View File

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

View File

@ -23,14 +23,14 @@
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<JavaOptions />
<AndroidUseLatestPlatformSdk />
<AndroidSupportedAbis>armeabi,armeabi-v7a</AndroidSupportedAbis>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<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>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
@ -119,6 +119,7 @@
<Compile Include="GroupBaseActivity.cs" />
<Compile Include="LockCloseListActivity.cs" />
<Compile Include="LockingListActivity.cs" />
<Compile Include="Utils\ActivityDesign.cs" />
<Compile Include="Utils\LoadingDialog.cs" />
<Compile Include="Utils\Util.cs" />
<Compile Include="views\ClickView.cs" />
@ -179,6 +180,7 @@
<Link>libs\armeabi\libfinal-key.so</Link>
</AndroidNativeLibrary>
<None Include="Resources\AboutResources.txt" />
<AndroidResource Include="Resources\drawable-hdpi\Thumbs.db" />
<None Include="Resources\drawable\Thumbs.db">
<Visible>False</Visible>
</None>
@ -665,14 +667,6 @@
<Folder Include="SupportLib\" />
</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">
<Project>{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}</Project>
<Name>KeePassLib2Android</Name>
@ -681,18 +675,6 @@
<Project>{53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}</Project>
<Name>Kp2aBusinessLogic</Name>
</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>
<ProjectExtensions>
<MonoDevelop>
@ -875,4 +857,54 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\device_access_new_account.png" />
</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>

View File

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

View File

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

View File

@ -31,6 +31,13 @@ namespace keepass2android
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")]
public class AppSettingsActivity : LockingPreferenceActivity
{
private ActivityDesign _design;
public AppSettingsActivity()
{
_design = new ActivityDesign(this);
}
public static void Launch(Context ctx)
{
ctx.StartActivity(new Intent(ctx, typeof(AppSettingsActivity)));
@ -38,12 +45,32 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState)
{
_design.ApplyTheme();
base.OnCreate(savedInstanceState);
AddPreferencesFromResource(Resource.Xml.preferences);
FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += OnRememberKeyFileHistoryChanged;
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));
cachingPreference.PreferenceChange += OnUseOfflineCacheChanged;
@ -63,6 +90,11 @@ namespace keepass2android
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)
{
App.Kp2a.UpdateOngoingNotification();

View File

@ -32,6 +32,13 @@ namespace keepass2android
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")]
public class DatabaseSettingsActivity : LockingClosePreferenceActivity
{
private ActivityDesign _design;
public DatabaseSettingsActivity()
{
_design = new ActivityDesign(this);
}
public static void Launch(Context ctx)
{
ctx.StartActivity(new Intent(ctx, typeof(DatabaseSettingsActivity)));
@ -39,6 +46,8 @@ namespace keepass2android
protected override void OnCreate(Bundle savedInstanceState)
{
_design.ApplyTheme();
base.OnCreate(savedInstanceState);
AddPreferencesFromResource(Resource.Xml.preferences);
@ -46,6 +55,24 @@ namespace keepass2android
// Re-use the change handlers for the application settings
FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += AppSettingsActivity.OnRememberKeyFileHistoryChanged;
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();