Merge branch 'UITesting'

Conflicts:
	.gitignore
	src/KeePass.sln
	src/keepass2android/EntryActivity.cs
	src/keepass2android/Resources/Resource.designer.cs
	src/keepass2android/keepass2android.csproj
This commit is contained in:
Philipp Crocoll 2013-04-26 12:08:50 +02:00
commit fa4cd5bf46
93 changed files with 3613 additions and 1899 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@
/src/java/KP2ASoftKeyboard/gen
/src/java/KP2ASoftKeyboard/projectzip
/src/java/KP2ASoftKeyboard/createProjectZip.bat
Thumbs.db

View File

@ -0,0 +1,95 @@
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace KeyValueTest
{
[Activity (Label = "KeyValueTest", MainLauncher = true)]
public class Activity1 : Activity
{
string className = null;
string ClassName
{
get {
if (className == null)
className = this.GetType().Name;
return className;
}
}
protected override void OnResume()
{
base.OnResume();
Android.Util.Log.Debug("DEBUG",ClassName+".OnResume");
}
protected override void OnStart()
{
base.OnStart();
Android.Util.Log.Debug("DEBUG",ClassName+".OnStart");
}
protected override void OnDestroy()
{
base.OnDestroy();
Android.Util.Log.Debug("DEBUG",ClassName+".OnDestroy"+IsFinishing.ToString());
}
protected override void OnPause()
{
base.OnPause();
Android.Util.Log.Debug("DEBUG",ClassName+".OnPause");
}
protected override void OnStop()
{
base.OnStop();
Android.Util.Log.Debug("DEBUG",ClassName+".OnStop");
}
View CreateView(string key, string value)
{
LinearLayout layout = new LinearLayout(this, null);
layout.Orientation = Orientation.Vertical;
layout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
TextView keyView = new TextView(this);
if (key != null)
keyView.Text = key;
layout.AddView(keyView);
TextView valueView = new TextView(this);
if (value != null)
valueView.Text = value;
valueView.SetTextIsSelectable(true);
layout.AddView(valueView);
return layout;
}
protected override void OnCreate(Bundle bundle)
{
Android.Util.Log.Debug("DEBUG", ClassName + ".OnCreate");
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
FindViewById<LinearLayout>(Resource.Id.extra_strings).AddView(CreateView("key1","value1"));
FindViewById<LinearLayout>(Resource.Id.extra_strings).AddView(CreateView("key2","value2"));
FindViewById<LinearLayout>(Resource.Id.extra_strings).AddView(CreateView("key3","value3"));
}
}
}

View File

@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with you package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Additionally, some Android functions will automatically load asset files:
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

View File

@ -0,0 +1,75 @@
/*
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Util;
namespace KeyValueTest
{
public class EntrySection : LinearLayout {
public EntrySection(Context context): base(context, null) {
inflate (context,null, null);
}
public EntrySection(Context context, IAttributeSet attrs): base(context, attrs) {
inflate (context,null, null);
}
public EntrySection(Context context, IAttributeSet attrs, String title, String value): base(context, attrs) {
inflate(context, title, value);
}
public EntrySection (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}
private void inflate(Context context, String title, String value) {
LayoutInflater inflater = (LayoutInflater) Context.GetSystemService(Context.LayoutInflaterService);
inflater.Inflate(Resource.Layout.entry_section, this);
setText(Resource.Id.title, title);
setText(Resource.Id.value, value);
}
private void setText(int resId, String str) {
if (str != null) {
TextView tvTitle = (TextView) FindViewById(resId);
tvTitle.Text = str;
Android.Util.Log.Debug("DEBUG", "Setting " + resId+"=" + str);
}
}
}
}

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{70F00DF9-6CC8-40A7-BF27-A7B8D724891E}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>KeyValueTest</RootNamespace>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AssemblyName>KeyValueTest</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<ConsolePause>False</ConsolePause>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
</ItemGroup>
<ItemGroup>
<Compile Include="Activity1.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="EntrySection.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Main.axml" />
<AndroidResource Include="Resources\values\Strings.xml" />
<AndroidResource Include="Resources\drawable\Icon.png" />
<AndroidResource Include="Resources\layout\entry_section.xml" />
<AndroidResource Include="Resources\layout-v14\Main.axml" />
<AndroidResource Include="Resources\layout-v14\entry_section.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<ItemGroup>
<Folder Include="Resources\layout-v14\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("KeyValueTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("crocoll")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.axml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.axml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

View File

@ -0,0 +1,109 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.296
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: Android.Runtime.ResourceDesignerAttribute("KeyValueTest.Resource", IsApplication=true)]
namespace KeyValueTest
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Novell.MonoDroid.Build.Tasks", "1.0.0.0")]
public partial class Resource
{
public static void UpdateIdValues()
{
}
public partial class Attribute
{
private Attribute()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int Icon = 2130837504;
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f050003
public const int bottom_bar = 2131034115;
// aapt resource value: 0x7f050007
public const int entry_contents = 2131034119;
// aapt resource value: 0x7f050005
public const int entry_divider2 = 2131034117;
// aapt resource value: 0x7f050004
public const int entry_edit = 2131034116;
// aapt resource value: 0x7f050006
public const int entry_scroll = 2131034118;
// aapt resource value: 0x7f050008
public const int extra_strings = 2131034120;
// aapt resource value: 0x7f050000
public const int title = 2131034112;
// aapt resource value: 0x7f050002
public const int top = 2131034114;
// aapt resource value: 0x7f050001
public const int value = 2131034113;
private Id()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int entry_section = 2130903040;
// aapt resource value: 0x7f030001
public const int Main = 2130903041;
private Layout()
{
}
}
public partial class String
{
// aapt resource value: 0x7f040001
public const int app_name = 2130968577;
// aapt resource value: 0x7f040000
public const int hello = 2130968576;
private String()
{
}
}
}
}
#pragma warning restore 1591

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<!-- Extra strings -->
<LinearLayout
android:id="@+id/extra_strings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title" />
<TextView
android:id="@+id/value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:text="Value" />
</LinearLayout>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal" />
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<FrameLayout
android:id="@+id/entry_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="uia" />
</FrameLayout>
</LinearLayout>
<ImageView
android:id="@+id/entry_divider2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom_bar"
android:scaleType="fitXY" />
<ScrollView
android:id="@+id/entry_scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/entry_divider2"
android:fillViewport="true"
android:scrollbarStyle="insideOverlay">
<keepass2android.view.EntryContentsView
android:id="@+id/entry_contents"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</ScrollView>
</RelativeLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:layout_marginLeft="10dp" />
<TextView
android:id="@+id/value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Value"
/>
</LinearLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Click Me!</string>
<string name="app_name">KeyValueTest</string>
</resources>

View File

@ -38,6 +38,7 @@ using Android.Content.PM;
using KeePassLib.Security;
using keepass2android.view;
using Android.Webkit;
using Android.Graphics;
namespace keepass2android
{
@ -76,7 +77,7 @@ namespace keepass2android
}
protected void setupEditButtons() {
Button edit = (Button) FindViewById(Resource.Id.entry_edit);
View edit = FindViewById(Resource.Id.entry_edit);
edit.Click += (sender, e) => {
EntryEditActivity.Launch(this, mEntry);
};
@ -206,7 +207,8 @@ namespace keepass2android
String key = pair.Key;
if (!PwDefs.IsStandardField(key))
{
View view = new EntrySection(this, null, key, pair.Value.ReadString());
//View view = new EntrySection(this, null, key, pair.Value.ReadString());
View view = CreateEditSection(key, pair.Value.ReadString());
extraGroup.AddView(view);
hasExtraFields = true;
}
@ -214,6 +216,28 @@ namespace keepass2android
FindViewById(Resource.Id.entry_extra_strings_label).Visibility = hasExtraFields ? ViewStates.Visible : ViewStates.Gone;
}
View CreateEditSection(string key, string value)
{
LinearLayout layout = new LinearLayout(this, null);
layout.Orientation = Orientation.Vertical;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
layoutParams.SetMargins(10,0,0,0);
layout.LayoutParameters = layoutParams;
View viewInflated = LayoutInflater.Inflate(Resource.Layout.entry_extrastring_title,null);
TextView keyView = (TextView)viewInflated;
if (key != null)
keyView.Text = key;
layout.AddView(keyView);
TextView valueView = (TextView)LayoutInflater.Inflate(Resource.Layout.entry_extrastring_value, null);
if (value != null)
valueView.Text = value;
valueView.Typeface = Typeface.Monospace;
valueView.SetTextIsSelectable(true);
layout.AddView(valueView);
return layout;
}
string writeBinaryToFile(string key)
{
ProtectedBinary pb = mEntry.Binaries.Get(key);
@ -333,14 +357,24 @@ namespace keepass2android
protected void fillData(bool trimList)
{
ImageView iv = (ImageView)FindViewById(Resource.Id.entry_icon);
if (iv != null)
{
App.getDB().drawFactory.assignDrawableTo(iv, Resources, App.getDB().pm, mEntry.IconId, mEntry.CustomIconUuid);
}
//populateText(Resource.Id.entry_title, mEntry.Strings.ReadSafe(PwDefs.TitleField));
var button = ((Button)FindViewById(Resource.Id.entry_title));
if (button != null)
{
button.Text = mEntry.Strings.ReadSafe(PwDefs.TitleField);
button.Click += (object sender, EventArgs e) => {
Finish(); };
}
if (ActionBar != null)
{
ActionBar.Title = mEntry.Strings.ReadSafe(PwDefs.TitleField);
ActionBar.SetDisplayHomeAsUpEnabled(true);
}
populateText(Resource.Id.entry_user_name, Resource.Id.entry_user_name_label, mEntry.Strings.ReadSafe(PwDefs.UserNameField));
populateText(Resource.Id.entry_url, Resource.Id.entry_url_label, mEntry.Strings.ReadSafe(PwDefs.UrlField));
@ -537,6 +571,12 @@ namespace keepass2android
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
}
return true;
case Android.Resource.Id.Home:
//Currently the action bar only displays the home button when we come from a previous activity.
//So we can simply Finish. See this page for information on how to do this in more general (future?) cases:
//http://developer.android.com/training/implementing-navigation/ancestral.html
Finish();
return true;
}

View File

@ -45,16 +45,14 @@ namespace keepass2android
public const int RESULT_OK_ICON_PICKER = (int)Result.FirstUser + 1000;
public const int RESULT_OK_PASSWORD_GENERATOR = RESULT_OK_ICON_PICKER + 1;
private PwEntry mEntry, mEntryInDatabase;
private bool mShowPassword = false;
private bool mIsNew;
private PwIcon mSelectedIconID;
private PwUuid mSelectedCustomIconID = PwUuid.Zero;
private bool mSelectedIcon = false;
bool mEntryModified;
const string Intent_ContinueWithEditing = "ContinueWithEditing";
EntryEditActivityState State
{
get { return App.entryEditActivityState; }
}
public static void Launch(Activity act, PwEntry pw) {
Intent i = new Intent(act, typeof(EntryEditActivity));
@ -73,41 +71,63 @@ namespace keepass2android
}
private ScrollView scroll;
bool mCloseForReload;
protected override void OnCreate(Bundle savedInstanceState)
protected override void OnCreate(Bundle savedInstanceState)
{
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
mShowPassword = ! prefs.GetBoolean(GetString(Resource.String.maskpass_key), Resources.GetBoolean(Resource.Boolean.maskpass_default));
base.OnCreate(savedInstanceState);
if (this.LastNonConfigurationInstance != null)
{
//bug in Mono for Android or whatever: after config change the extra fields are wrong
// -> reload:
reload();
return;
}
SetContentView(Resource.Layout.entry_edit);
SetResult(KeePass.EXIT_NORMAL);
mCloseForReload = false;
// Likely the app has been killed exit the activity
Database db = App.getDB();
if ( ! db.Open ) {
if (! db.Open)
{
Finish();
return;
}
if (Intent.GetBooleanExtra(Intent_ContinueWithEditing, false))
{
//property "State" will return the state
} else
{
App.entryEditActivityState = new EntryEditActivityState();
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
State.mShowPassword = ! prefs.GetBoolean(GetString(Resource.String.maskpass_key), Resources.GetBoolean(Resource.Boolean.maskpass_default));
Intent i = Intent;
String uuidBytes = i.GetStringExtra(KEY_ENTRY);
PwUuid entryId = PwUuid.Zero;
if (uuidBytes != null)
entryId = new KeePassLib.PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
PwGroup parentGroup = null;
if ( entryId == PwUuid.Zero ) {
String groupId = i.GetStringExtra(KEY_PARENT);
parentGroup = db.groups[new PwUuid(MemUtil.HexStringToByteArray(groupId))];
mEntryInDatabase = new PwEntry(true, true);
mEntryInDatabase.Strings.Set(PwDefs.UserNameField, new ProtectedString(
db.pm.MemoryProtection.ProtectUserName, db.pm.DefaultUserName));
/*KPDesktop
Intent i = Intent;
String uuidBytes = i.GetStringExtra(KEY_ENTRY);
PwUuid entryId = PwUuid.Zero;
if (uuidBytes != null)
entryId = new KeePassLib.PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
State.parentGroup = null;
if (entryId == PwUuid.Zero)
{
String groupId = i.GetStringExtra(KEY_PARENT);
State.parentGroup = db.groups [new PwUuid(MemUtil.HexStringToByteArray(groupId))];
State.mEntryInDatabase = new PwEntry(true, true);
State.mEntryInDatabase.Strings.Set(PwDefs.UserNameField, new ProtectedString(
db.pm.MemoryProtection.ProtectUserName, db.pm.DefaultUserName));
/*KPDesktop
* ProtectedString psAutoGen;
PwGenerator.Generate(out psAutoGen, Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile,
null, Program.PwGeneratorPool);
@ -120,15 +140,15 @@ namespace keepass2android
pwe.Expires = true;
pwe.ExpiryTime = DateTime.Now.AddDays(nExpireDays);
}*/
if((parentGroup.IconId != PwIcon.Folder) && (parentGroup.IconId != PwIcon.FolderOpen) &&
(parentGroup.IconId != PwIcon.FolderPackage))
{
mEntryInDatabase.IconId = parentGroup.IconId; // Inherit icon from group
}
mEntryInDatabase.CustomIconUuid = parentGroup.CustomIconUuid;
/*
if ((State.parentGroup.IconId != PwIcon.Folder) && (State.parentGroup.IconId != PwIcon.FolderOpen) &&
(State.parentGroup.IconId != PwIcon.FolderPackage))
{
State.mEntryInDatabase.IconId = State.parentGroup.IconId; // Inherit icon from group
}
State.mEntryInDatabase.CustomIconUuid = State.parentGroup.CustomIconUuid;
/*
* KPDesktop
if(strDefaultSeq.Length == 0)
{
@ -146,35 +166,51 @@ namespace keepass2android
}
}
}*/
mIsNew = true;
mEntryModified = true;
} else {
System.Diagnostics.Debug.Assert(entryId != null);
mEntryInDatabase = db.entries[entryId];
mIsNew = false;
State.mIsNew = true;
State.mEntryModified = true;
} else
{
System.Diagnostics.Debug.Assert(entryId != null);
State.mEntryInDatabase = db.entries [entryId];
State.mIsNew = false;
}
State.mEntry = State.mEntryInDatabase.CloneDeep();
}
}
if (!State.mEntryModified)
SetResult(KeePass.EXIT_NORMAL);
else
SetResult(KeePass.EXIT_REFRESH_TITLE);
mEntry = mEntryInDatabase.CloneDeep();
fillData();
View scrollView = FindViewById(Resource.Id.entry_scroll);
scrollView.ScrollBarStyle = ScrollbarStyles.InsideInset;
ImageButton iconButton = (ImageButton) FindViewById(Resource.Id.icon_button);
ImageButton iconButton = (ImageButton)FindViewById(Resource.Id.icon_button);
if (State.mSelectedIcon)
{
//TODO: custom image
iconButton.SetImageResource(Icons.iconToResId(State.mSelectedIconID));
}
iconButton.Click += (sender, evt) => {
UpdateEntryFromUi(State.mEntry);
IconPickerActivity.Launch(this);
};
// Generate password button
Button generatePassword = (Button) FindViewById(Resource.Id.generate_button);
Button generatePassword = (Button)FindViewById(Resource.Id.generate_button);
generatePassword.Click += (object sender, EventArgs e) => {
UpdateEntryFromUi(State.mEntry);
GeneratePasswordActivity.Launch(this);
};
@ -182,164 +218,30 @@ namespace keepass2android
// Save button
Button save = (Button) FindViewById(Resource.Id.entry_save);
View save = FindViewById(Resource.Id.entry_save);
if (save == null)
{
ActionBar.SetCustomView(Resource.Layout.SaveButton);
ActionBar.SetDisplayShowCustomEnabled(true);
ActionBar.SetDisplayShowTitleEnabled(false);
ActionBar.SetDisplayUseLogoEnabled(false);
ActionBar.SetDisplayShowHomeEnabled(false);
ActionBar.SetDisplayOptions(ActionBarDisplayOptions.ShowCustom,
ActionBarDisplayOptions.ShowCustom);
save = FindViewById(Resource.Id.entry_save);
}
save.Click += (object sender, EventArgs e) =>
{
EntryEditActivity act = this;
if (!validateBeforeSaving())
return;
OnFinish onFinish = new AfterSave(new Handler(), this);
PwEntry initialEntry = mEntryInDatabase.CloneDeep();
SaveEntry(onFinish);
PwEntry newEntry = mEntryInDatabase;
//Clone history and re-assign:
newEntry.History = newEntry.History.CloneDeep();
//Based on KeePass Desktop
bool bCreateBackup = (!mIsNew);
if(bCreateBackup) newEntry.CreateBackup(null);
if (mSelectedIcon == false) {
if (mIsNew) {
newEntry.IconId = PwIcon.Key;
} else {
// Keep previous icon, if no new one was selected
}
}
else {
newEntry.IconId = mSelectedIconID;
newEntry.CustomIconUuid = mSelectedCustomIconID;
}
/* KPDesktop
if(m_cbCustomForegroundColor.Checked)
newEntry.ForegroundColor = m_clrForeground;
else newEntry.ForegroundColor = Color.Empty;
if(m_cbCustomBackgroundColor.Checked)
newEntry.BackgroundColor = m_clrBackground;
else newEntry.BackgroundColor = Color.Empty;
*/
newEntry.Strings.Set(PwDefs.TitleField, new ProtectedString(db.pm.MemoryProtection.ProtectTitle,
Util.getEditText(act, Resource.Id.entry_title)));
newEntry.Strings.Set(PwDefs.UserNameField, new ProtectedString(db.pm.MemoryProtection.ProtectUserName,
Util.getEditText(act, Resource.Id.entry_user_name)));
String pass = Util.getEditText(act, Resource.Id.entry_password);
byte[] password = StrUtil.Utf8.GetBytes(pass);
newEntry.Strings.Set(PwDefs.PasswordField, new ProtectedString(db.pm.MemoryProtection.ProtectPassword,
password));
MemUtil.ZeroByteArray(password);
newEntry.Strings.Set(PwDefs.UrlField, new ProtectedString(db.pm.MemoryProtection.ProtectUrl,
Util.getEditText(act, Resource.Id.entry_url)));
newEntry.Strings.Set(PwDefs.NotesField, new ProtectedString(db.pm.MemoryProtection.ProtectNotes,
Util.getEditText(act, Resource.Id.entry_comment)));
// Delete all non standard strings
var keys = newEntry.Strings.GetKeys();
foreach (String key in keys)
if (PwDefs.IsStandardField(key) == false)
newEntry.Strings.Remove(key);
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
for (int index = 0; index < container.ChildCount; index++) {
View view = container.GetChildAt(index);
TextView keyView = (TextView)view.FindViewById(Resource.Id.title);
String key = keyView.Text;
TextView valueView = (TextView)view.FindViewById(Resource.Id.value);
String value = valueView.Text;
CheckBox cb = (CheckBox)view.FindViewById(Resource.Id.protection);
bool protect = cb.Checked;
newEntry.Strings.Set(key, new ProtectedString(protect, value));
}
newEntry.Binaries = mEntry.Binaries;
newEntry.Expires = mEntry.Expires;
if (newEntry.Expires)
{
newEntry.ExpiryTime = mEntry.ExpiryTime;
}
newEntry.OverrideUrl = Util.getEditText(this,Resource.Id.entry_override_url);
List<string> vNewTags = StrUtil.StringToTags(Util.getEditText(this,Resource.Id.entry_tags));
newEntry.Tags.Clear();
foreach(string strTag in vNewTags) newEntry.AddTag(strTag);
/*KPDesktop
m_atConfig.Enabled = m_cbAutoTypeEnabled.Checked;
m_atConfig.ObfuscationOptions = (m_cbAutoTypeObfuscation.Checked ?
AutoTypeObfuscationOptions.UseClipboard :
AutoTypeObfuscationOptions.None);
SaveDefaultSeq();
newEntry.AutoType = m_atConfig;
*/
newEntry.Touch(true, false); // Touch *after* backup
StrUtil.NormalizeNewLines(newEntry.Strings, true);
bool bUndoBackup = false;
PwCompareOptions cmpOpt = (PwCompareOptions.NullEmptyEquivStd |
PwCompareOptions.IgnoreTimes);
if(bCreateBackup) cmpOpt |= PwCompareOptions.IgnoreLastBackup;
if(newEntry.EqualsEntry(initialEntry, cmpOpt, MemProtCmpMode.CustomOnly))
{
// No modifications at all => restore last mod time and undo backup
newEntry.LastModificationTime = initialEntry.LastModificationTime;
bUndoBackup = bCreateBackup;
}
else if(bCreateBackup)
{
// If only history items have been modified (deleted) => undo
// backup, but without restoring the last mod time
PwCompareOptions cmpOptNH = (cmpOpt | PwCompareOptions.IgnoreHistory);
if(newEntry.EqualsEntry(initialEntry, cmpOptNH, MemProtCmpMode.CustomOnly))
bUndoBackup = true;
}
if(bUndoBackup) newEntry.History.RemoveAt(newEntry.History.UCount - 1);
newEntry.MaintainBackups(db.pm);
//if ( newEntry.Strings.ReadSafe (PwDefs.TitleField).Equals(mEntry.Strings.ReadSafe (PwDefs.TitleField)) ) {
// SetResult(KeePass.EXIT_REFRESH);
//} else {
//it's safer to always update the title as we might add further information in the title like expiry etc.
SetResult(KeePass.EXIT_REFRESH_TITLE);
//}
RunnableOnFinish task;
OnFinish onFinish = new AfterSave(new Handler(), act);
if ( mIsNew ) {
task = AddEntry.getInstance(this, App.getDB(), newEntry, parentGroup, onFinish);
} else {
task = new UpdateEntry(this, App.getDB(), initialEntry, newEntry, onFinish);
}
ProgressTask pt = new ProgressTask(act, task, Resource.String.saving_database);
pt.run();
};
// Respect mask password setting
if (mShowPassword) {
if (State.mShowPassword) {
EditText pass = (EditText) FindViewById(Resource.Id.entry_password);
EditText conf = (EditText) FindViewById(Resource.Id.entry_confpassword);
@ -354,41 +256,224 @@ namespace keepass2android
addButton.Click += (object sender, EventArgs e) =>
{
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
EntryEditSection ees = (EntryEditSection) LayoutInflater.Inflate(Resource.Layout.entry_edit_section, null);
ees.setData("", new ProtectedString(false, ""));
ees.getDeleteButton().Click += (senderEes, eEes) => deleteAdvancedString((View)senderEes);
KeyValuePair<string, ProtectedString> pair = new KeyValuePair<string, ProtectedString>("" , new ProtectedString(true, ""));
LinearLayout ees = CreateExtraStringView(pair);
container.AddView(ees);
mEntryModified = true;
State.mEntryModified = true;
// Scroll bottom
scroll.Post(() => {
scroll.FullScroll(FocusSearchDirection.Down);
});
TextView keyView = (TextView) ees.FindViewById(Resource.Id.title);
keyView.RequestFocus();
};
((CheckBox)FindViewById(Resource.Id.entry_expires_checkbox)).CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) =>
{
mEntry.Expires = e.IsChecked;
State.mEntry.Expires = e.IsChecked;
if (e.IsChecked)
{
if (mEntry.ExpiryTime < DateTime.Now)
mEntry.ExpiryTime = DateTime.Now;
if (State.mEntry.ExpiryTime < DateTime.Now)
State.mEntry.ExpiryTime = DateTime.Now;
}
updateExpires();
mEntryModified = true;
State.mEntryModified = true;
};
}
void SaveEntry(OnFinish onFinish)
{
Database db = App.getDB();
EntryEditActivity act = this;
if (!validateBeforeSaving())
return;
PwEntry initialEntry = State.mEntryInDatabase.CloneDeep();
PwEntry newEntry = State.mEntryInDatabase;
//Clone history and re-assign:
newEntry.History = newEntry.History.CloneDeep();
//Based on KeePass Desktop
bool bCreateBackup = (!State.mIsNew);
if(bCreateBackup) newEntry.CreateBackup(null);
if (State.mSelectedIcon == false) {
if (State.mIsNew) {
newEntry.IconId = PwIcon.Key;
} else {
// Keep previous icon, if no new one was selected
}
}
else {
newEntry.IconId = State.mSelectedIconID;
newEntry.CustomIconUuid = State.mSelectedCustomIconID;
}
/* KPDesktop
if(m_cbCustomForegroundColor.Checked)
newEntry.ForegroundColor = m_clrForeground;
else newEntry.ForegroundColor = Color.Empty;
if(m_cbCustomBackgroundColor.Checked)
newEntry.BackgroundColor = m_clrBackground;
else newEntry.BackgroundColor = Color.Empty;
*/
UpdateEntryFromUi(newEntry);
newEntry.Binaries = State.mEntry.Binaries;
newEntry.Expires = State.mEntry.Expires;
if (newEntry.Expires)
{
newEntry.ExpiryTime = State.mEntry.ExpiryTime;
}
newEntry.Touch(true, false); // Touch *after* backup
StrUtil.NormalizeNewLines(newEntry.Strings, true);
bool bUndoBackup = false;
PwCompareOptions cmpOpt = (PwCompareOptions.NullEmptyEquivStd |
PwCompareOptions.IgnoreTimes);
if(bCreateBackup) cmpOpt |= PwCompareOptions.IgnoreLastBackup;
if(newEntry.EqualsEntry(initialEntry, cmpOpt, MemProtCmpMode.CustomOnly))
{
// No modifications at all => restore last mod time and undo backup
newEntry.LastModificationTime = initialEntry.LastModificationTime;
bUndoBackup = bCreateBackup;
}
else if(bCreateBackup)
{
// If only history items have been modified (deleted) => undo
// backup, but without restoring the last mod time
PwCompareOptions cmpOptNH = (cmpOpt | PwCompareOptions.IgnoreHistory);
if(newEntry.EqualsEntry(initialEntry, cmpOptNH, MemProtCmpMode.CustomOnly))
bUndoBackup = true;
}
if(bUndoBackup) newEntry.History.RemoveAt(newEntry.History.UCount - 1);
newEntry.MaintainBackups(db.pm);
//if ( newEntry.Strings.ReadSafe (PwDefs.TitleField).Equals(State.mEntry.Strings.ReadSafe (PwDefs.TitleField)) ) {
// SetResult(KeePass.EXIT_REFRESH);
//} else {
//it's safer to always update the title as we might add further information in the title like expiry etc.
SetResult(KeePass.EXIT_REFRESH_TITLE);
//}
RunnableOnFinish task;
if ( State.mIsNew ) {
task = AddEntry.getInstance(this, App.getDB(), newEntry, State.parentGroup, onFinish);
} else {
task = new UpdateEntry(this, App.getDB(), initialEntry, newEntry, onFinish);
}
ProgressTask pt = new ProgressTask(act, task, Resource.String.saving_database);
pt.run();
}
void UpdateEntryFromUi(PwEntry entry)
{
Database db = App.getDB();
EntryEditActivity act = this;
entry.Strings.Set(PwDefs.TitleField, new ProtectedString(db.pm.MemoryProtection.ProtectTitle,
Util.getEditText(act, Resource.Id.entry_title)));
entry.Strings.Set(PwDefs.UserNameField, new ProtectedString(db.pm.MemoryProtection.ProtectUserName,
Util.getEditText(act, Resource.Id.entry_user_name)));
String pass = Util.getEditText(act, Resource.Id.entry_password);
byte[] password = StrUtil.Utf8.GetBytes(pass);
entry.Strings.Set(PwDefs.PasswordField, new ProtectedString(db.pm.MemoryProtection.ProtectPassword,
password));
MemUtil.ZeroByteArray(password);
entry.Strings.Set(PwDefs.UrlField, new ProtectedString(db.pm.MemoryProtection.ProtectUrl,
Util.getEditText(act, Resource.Id.entry_url)));
entry.Strings.Set(PwDefs.NotesField, new ProtectedString(db.pm.MemoryProtection.ProtectNotes,
Util.getEditText(act, Resource.Id.entry_comment)));
// Validate expiry date
DateTime newExpiry = new DateTime();
if ((State.mEntry.Expires) && (!DateTime.TryParse( Util.getEditText(this,Resource.Id.entry_expires), out newExpiry)))
{
//ignore here
}
else
{
State.mEntry.ExpiryTime = newExpiry;
}
// Delete all non standard strings
var keys = entry.Strings.GetKeys();
foreach (String key in keys)
if (PwDefs.IsStandardField(key) == false)
entry.Strings.Remove(key);
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
for (int index = 0; index < container.ChildCount; index++) {
View view = container.GetChildAt(index);
TextView keyView = (TextView)view.FindViewById(Resource.Id.title);
String key = keyView.Text;
if (String.IsNullOrEmpty(key))
continue;
TextView valueView = (TextView)view.FindViewById(Resource.Id.value);
String value = valueView.Text;
CheckBox cb = (CheckBox)view.FindViewById(Resource.Id.protection);
bool protect = true;
ProtectedString initialString = State.mEntryInDatabase.Strings.Get(key);
if (initialString != null)
protect = initialString.IsProtected;
if (cb != null) //Checkbox removed for ICS (for clarity)
{
protect = cb.Checked;
}
entry.Strings.Set(key, new ProtectedString(protect, value));
}
entry.OverrideUrl = Util.getEditText(this,Resource.Id.entry_override_url);
List<string> vNewTags = StrUtil.StringToTags(Util.getEditText(this,Resource.Id.entry_tags));
entry.Tags.Clear();
foreach(string strTag in vNewTags) entry.AddTag(strTag);
/*KPDesktop
m_atConfig.Enabled = m_cbAutoTypeEnabled.Checked;
m_atConfig.ObfuscationOptions = (m_cbAutoTypeObfuscation.Checked ?
AutoTypeObfuscationOptions.UseClipboard :
AutoTypeObfuscationOptions.None);
SaveDefaultSeq();
newEntry.AutoType = m_atConfig;
*/
}
void addBinaryOrAsk(string filename)
{
string strItem = UrlUtil.GetFileName(filename);
if(mEntry.Binaries.Get(strItem) != null)
if(State.mEntry.Binaries.Get(strItem) != null)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetTitle(GetString(Resource.String.AskOverwriteBinary_title));
@ -429,7 +514,7 @@ namespace keepass2android
while(true)
{
string strNewName = strFileName + nTry.ToString() + strExtension;
if(mEntry.Binaries.Get(strNewName) == null)
if(State.mEntry.Binaries.Get(strNewName) == null)
{
strItem = strNewName;
break;
@ -444,20 +529,20 @@ namespace keepass2android
if(vBytes != null)
{
ProtectedBinary pb = new ProtectedBinary(false, vBytes);
mEntry.Binaries.Set(strItem, pb);
State.mEntry.Binaries.Set(strItem, pb);
}
}
catch(Exception exAttach)
{
Toast.MakeText(this, GetString(Resource.String.AttachFailed)+" "+exAttach.Message, ToastLength.Long).Show();
}
mEntryModified = true;
State.mEntryModified = true;
populateBinaries();
}
public override void OnBackPressed()
{
if (mEntryModified == false)
if (State.mEntryModified == false)
{
base.OnBackPressed();
} else
@ -484,35 +569,50 @@ namespace keepass2android
}
}
public void reload() {
//this reload ìs necessary to overcome a strange problem with the extra string fields which get lost
//somehow after re-creating the activity. Maybe a Mono for Android bug?
Intent intent = Intent;
intent.PutExtra(Intent_ContinueWithEditing, true);
OverridePendingTransition(0, 0);
intent.AddFlags(ActivityFlags.NoAnimation);
mCloseForReload = true;
SetResult(KeePass.EXIT_REFRESH_TITLE); //probably the entry will be modified -> let the EditActivity refresh to be safe
Finish();
OverridePendingTransition(0, 0);
StartActivity(intent);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
switch ((int)resultCode)
{
case RESULT_OK_ICON_PICKER:
mSelectedIconID = (PwIcon) data.Extras.GetInt(IconPickerActivity.KEY_ICON_ID);
mSelectedCustomIconID = PwUuid.Zero;
State.mSelectedIconID = (PwIcon) data.Extras.GetInt(IconPickerActivity.KEY_ICON_ID);
State.mSelectedCustomIconID = PwUuid.Zero;
String customIconIdString = data.Extras.GetString(IconPickerActivity.KEY_CUSTOM_ICON_ID);
if (!String.IsNullOrEmpty(customIconIdString))
mSelectedCustomIconID = new PwUuid(MemUtil.HexStringToByteArray(customIconIdString));
mSelectedIcon = true;
ImageButton currIconButton = (ImageButton) FindViewById(Resource.Id.icon_button);
//TODO: custom image
currIconButton.SetImageResource(Icons.iconToResId(mSelectedIconID));
mEntryModified = true;
State.mSelectedCustomIconID = new PwUuid(MemUtil.HexStringToByteArray(customIconIdString));
State.mSelectedIcon = true;
State.mEntryModified = true;
reload();
break;
case RESULT_OK_PASSWORD_GENERATOR:
String generatedPassword = data.GetStringExtra("keepass2android.password.generated_password");
EditText password = (EditText) FindViewById(Resource.Id.entry_password);
EditText confPassword = (EditText) FindViewById(Resource.Id.entry_confpassword);
password.Text = generatedPassword;
confPassword.Text = generatedPassword;
mEntryModified = true;
byte[] password = StrUtil.Utf8.GetBytes(generatedPassword);
State.mEntry.Strings.Set(PwDefs.PasswordField, new ProtectedString(App.getDB().pm.MemoryProtection.ProtectPassword,
password));
MemUtil.ZeroByteArray(password);
State.mEntryModified = true;
reload();
break;
case (int)Result.Ok:
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE)
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_BINARY)
{
String filename = data.DataString;
if (filename != null) {
@ -524,10 +624,12 @@ namespace keepass2android
addBinaryOrAsk(filename);
}
}
reload();
break;
case (int)Result.Canceled:
reload();
break;
default:
break;
@ -539,7 +641,7 @@ namespace keepass2android
ViewGroup binariesGroup = (ViewGroup)FindViewById(Resource.Id.binaries);
binariesGroup.RemoveAllViews();
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.WrapContent);
foreach (KeyValuePair<string, ProtectedBinary> pair in mEntry.Binaries)
foreach (KeyValuePair<string, ProtectedBinary> pair in State.mEntry.Binaries)
{
String key = pair.Key;
Button binaryButton = new Button(this);
@ -548,9 +650,9 @@ namespace keepass2android
binaryButton.SetCompoundDrawablesWithIntrinsicBounds( Resources.GetDrawable(Android.Resource.Drawable.IcMenuDelete),null, null, null);
binaryButton.Click += (object sender, EventArgs e) =>
{
mEntryModified = true;
State.mEntryModified = true;
Button btnSender = (Button)(sender);
mEntry.Binaries.Remove(key);
State.mEntry.Binaries.Remove(key);
populateBinaries();
};
@ -564,11 +666,14 @@ namespace keepass2android
addBinaryButton.SetCompoundDrawablesWithIntrinsicBounds( Resources.GetDrawable(Android.Resource.Drawable.IcMenuAdd) , null, null, null);
addBinaryButton.Click += (object sender, EventArgs e) =>
{
Util.showBrowseDialog("/mnt/sdcard", this);
Util.showBrowseDialog("/mnt/sdcard", this, Intents.REQUEST_CODE_FILE_BROWSE_FOR_BINARY);
};
binariesGroup.AddView(addBinaryButton,layoutParams);
FindViewById(Resource.Id.entry_binaries_label).Visibility = mEntry.Binaries.UCount > 0 ? ViewStates.Visible : ViewStates.Gone;
var binariesLabel = FindViewById(Resource.Id.entry_binaries_label);
if (binariesLabel != null)
binariesLabel.Visibility = State.mEntry.Binaries.UCount > 0 ? ViewStates.Visible : ViewStates.Gone;
}
public override bool OnCreateOptionsMenu(IMenu menu) {
base.OnCreateOptionsMenu(menu);
@ -578,7 +683,7 @@ namespace keepass2android
IMenuItem togglePassword = menu.FindItem(Resource.Id.menu_toggle_pass);
if ( mShowPassword ) {
if ( State.mShowPassword ) {
togglePassword.SetTitle(Resource.String.menu_hide_password);
} else {
togglePassword.SetTitle(Resource.String.show_password);
@ -599,12 +704,12 @@ namespace keepass2android
return true;
case Resource.Id.menu_toggle_pass:
if ( mShowPassword ) {
if ( State.mShowPassword ) {
item.SetTitle(Resource.String.show_password);
mShowPassword = false;
State.mShowPassword = false;
} else {
item.SetTitle(Resource.String.menu_hide_password);
mShowPassword = true;
State.mShowPassword = true;
}
setPasswordStyle();
return true;
@ -644,7 +749,7 @@ namespace keepass2android
TextView password = (TextView) FindViewById(Resource.Id.entry_password);
TextView confpassword = (TextView) FindViewById(Resource.Id.entry_confpassword);
if ( mShowPassword ) {
if ( State.mShowPassword ) {
password.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
confpassword.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
@ -656,52 +761,75 @@ namespace keepass2android
void updateExpires()
{
if (mEntry.Expires)
if (State.mEntry.Expires)
{
populateText(Resource.Id.entry_expires, getDateTime(mEntry.ExpiryTime));
populateText(Resource.Id.entry_expires, getDateTime(State.mEntry.ExpiryTime));
}
else
{
populateText(Resource.Id.entry_expires, GetString(Resource.String.never));
}
((CheckBox)FindViewById(Resource.Id.entry_expires_checkbox)).Checked = mEntry.Expires;
((EditText)FindViewById(Resource.Id.entry_expires)).Enabled = mEntry.Expires;
((CheckBox)FindViewById(Resource.Id.entry_expires_checkbox)).Checked = State.mEntry.Expires;
((EditText)FindViewById(Resource.Id.entry_expires)).Enabled = State.mEntry.Expires;
}
public override Java.Lang.Object OnRetainNonConfigurationInstance()
{
UpdateEntryFromUi(State.mEntry);
return this;
}
LinearLayout CreateExtraStringView(KeyValuePair<string, ProtectedString> pair)
{
LinearLayout ees = (LinearLayout)LayoutInflater.Inflate(Resource.Layout.entry_edit_section, null);
((TextView)ees.FindViewById(Resource.Id.title)).Text = pair.Key;
((TextView)ees.FindViewById(Resource.Id.title)).TextChanged += (sender, e) => State.mEntryModified = true;
((TextView)ees.FindViewById(Resource.Id.value)).Text = pair.Value.ReadString();
((TextView)ees.FindViewById(Resource.Id.value)).TextChanged += (sender, e) => State.mEntryModified = true;
ees.FindViewById(Resource.Id.delete).Click += (sender, e) => deleteAdvancedString((View)sender);
CheckBox cb = (CheckBox)ees.FindViewById(Resource.Id.protection);
if (cb != null)
{
cb.Checked = pair.Value.IsProtected;
cb.CheckedChange += (sender, e) =>
{
State.mEntryModified = true;
};
}
return ees;
}
private void fillData() {
ImageButton currIconButton = (ImageButton) FindViewById(Resource.Id.icon_button);
App.getDB().drawFactory.assignDrawableTo(currIconButton, Resources, App.getDB().pm, mEntry.IconId, mEntry.CustomIconUuid);
App.getDB().drawFactory.assignDrawableTo(currIconButton, Resources, App.getDB().pm, State.mEntry.IconId, State.mEntry.CustomIconUuid);
populateText(Resource.Id.entry_title, mEntry.Strings.ReadSafe (PwDefs.TitleField));
populateText(Resource.Id.entry_user_name, mEntry.Strings.ReadSafe (PwDefs.UserNameField));
populateText(Resource.Id.entry_url, mEntry.Strings.ReadSafe (PwDefs.UrlField));
populateText(Resource.Id.entry_title, State.mEntry.Strings.ReadSafe (PwDefs.TitleField));
populateText(Resource.Id.entry_user_name, State.mEntry.Strings.ReadSafe (PwDefs.UserNameField));
populateText(Resource.Id.entry_url, State.mEntry.Strings.ReadSafe (PwDefs.UrlField));
String password = mEntry.Strings.ReadSafe(PwDefs.PasswordField);
String password = State.mEntry.Strings.ReadSafe(PwDefs.PasswordField);
populateText(Resource.Id.entry_password, password);
populateText(Resource.Id.entry_confpassword, password);
setPasswordStyle();
populateText(Resource.Id.entry_comment, mEntry.Strings.ReadSafe (PwDefs.NotesField));
populateText(Resource.Id.entry_comment, State.mEntry.Strings.ReadSafe (PwDefs.NotesField));
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
foreach (var pair in mEntry.Strings)
foreach (var pair in State.mEntry.Strings)
{
String key = pair.Key;
if (!PwDefs.IsStandardField(key)) {
EntryEditSection ees = (EntryEditSection) LayoutInflater.Inflate(Resource.Layout.entry_edit_section, null);
ees.setData(key, pair.Value);
ees.ContentChanged += (sender, e) => {mEntryModified=true;};
ees.getDeleteButton().Click += (sender, e) => deleteAdvancedString((View)sender);
var ees = CreateExtraStringView(pair);
container.AddView(ees);
}
}
populateBinaries();
populateText(Resource.Id.entry_override_url, mEntry.OverrideUrl);
populateText(Resource.Id.entry_tags, StrUtil.TagsToString(mEntry.Tags, true));
populateText(Resource.Id.entry_override_url, State.mEntry.OverrideUrl);
populateText(Resource.Id.entry_tags, StrUtil.TagsToString(State.mEntry.Tags, true));
updateExpires();
}
@ -711,11 +839,11 @@ namespace keepass2android
public void deleteAdvancedString(View view) {
EntryEditSection section = (EntryEditSection) view.Parent;
var section = view.Parent;
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
mEntryModified = true;
State.mEntryModified = true;
for (int i = 0; i < container.ChildCount; i++) {
EntryEditSection ees = (EntryEditSection) container.GetChildAt(i);
var ees = container.GetChildAt(i);
if (ees == section) {
container.RemoveViewAt(i);
container.Invalidate();
@ -743,20 +871,20 @@ namespace keepass2android
// Validate expiry date
DateTime newExpiry = new DateTime();
if ((mEntry.Expires) && (!DateTime.TryParse( Util.getEditText(this,Resource.Id.entry_expires), out newExpiry)))
if ((State.mEntry.Expires) && (!DateTime.TryParse( Util.getEditText(this,Resource.Id.entry_expires), out newExpiry)))
{
Toast.MakeText(this, Resource.String.error_invalid_expiry_date, ToastLength.Long).Show();
return false;
}
else
{
mEntry.ExpiryTime = newExpiry;
State.mEntry.ExpiryTime = newExpiry;
}
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
for (int i = 0; i < container.ChildCount; i++) {
EntryEditSection ees = (EntryEditSection) container.GetChildAt(i);
View ees = container.GetChildAt(i);
TextView keyView = (TextView) ees.FindViewById(Resource.Id.title);
string key = keyView.Text;
@ -775,9 +903,18 @@ namespace keepass2android
private void populateText(int viewId, String text) {
TextView tv = (TextView) FindViewById(viewId);
tv.Text = text;
tv.TextChanged += (sender, e) => {mEntryModified = true;};
tv.TextChanged += (sender, e) => {State.mEntryModified = true;};
}
protected override void OnPause()
{
if (!mCloseForReload)
UpdateEntryFromUi(State.mEntry);
base.OnPause();
}
private class AfterSave : OnFinish {
Activity act;
public AfterSave(Handler handler, Activity act): base(handler) {

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using KeePassLib;
namespace keepass2android
{
/// <summary>
/// Holds the state of the EntrryEditActivity. This is required to be able to keep a partially modified entry in memory
/// through the App variable. Serializing this state (especially the mEntry/mEntryInDatabase) can be a performance problem
/// when there are big attachements.
/// </summary>
internal class EntryEditActivityState
{
internal PwEntry mEntry, mEntryInDatabase;
internal bool mShowPassword = false;
internal bool mIsNew;
internal PwIcon mSelectedIconID;
internal PwUuid mSelectedCustomIconID = PwUuid.Zero;
internal bool mSelectedIcon = false;
internal PwGroup parentGroup;
internal bool mEntryModified;
}
}

View File

@ -67,7 +67,7 @@ namespace keepass2android
Button acceptButton = (Button) FindViewById(Resource.Id.accept_button);
View acceptButton = FindViewById(Resource.Id.accept_button);
acceptButton.Click += (object sender, EventArgs e) => {
EditText password = (EditText) FindViewById(Resource.Id.password);
@ -80,7 +80,7 @@ namespace keepass2android
};
Button cancelButton = (Button) FindViewById(Resource.Id.cancel_button);
View cancelButton = FindViewById(Resource.Id.cancel_button);
cancelButton.Click += (object sender, EventArgs e) =>
{
SetResult(Result.Canceled);

View File

@ -126,11 +126,9 @@ namespace keepass2android
} else {
SetContentView (new GroupViewOnlyView (this));
}
Log.Warn (TAG, "Set view");
if (addGroupEnabled) {
// Add Group button
Button addGroup = (Button)FindViewById (Resource.Id.add_group);
View addGroup = FindViewById (Resource.Id.add_group);
addGroup.Click += (object sender, EventArgs e) => {
GroupEditActivity.Launch (this, mGroup);
};
@ -138,7 +136,7 @@ namespace keepass2android
if (addEntryEnabled) {
// Add Entry button
Button addEntry = (Button)FindViewById (Resource.Id.add_entry);
View addEntry = FindViewById (Resource.Id.add_entry);
addEntry.Click += (object sender, EventArgs e) => {
EntryEditActivity.Launch (this, mGroup);

View File

@ -29,6 +29,7 @@ using Android.Widget;
using KeePassLib;
using Android.Preferences;
using keepass2android.view;
using Android.Graphics.Drawables;
namespace keepass2android
{
@ -115,42 +116,56 @@ namespace keepass2android
protected void setGroupTitle()
{
Button tv = (Button)FindViewById(Resource.Id.group_name);
if (tv == null)
return;
if (mGroup != null)
String name = mGroup.Name;
String titleText;
bool clickable = (mGroup != null) && (mGroup.IsVirtual == false) && (mGroup.ParentGroup != null);
if (!String.IsNullOrEmpty(name))
{
String name = mGroup.Name;
if (!String.IsNullOrEmpty(name))
{
tv.Text = name;
} else
{
tv.Text = GetText(Resource.String.root);
}
}
if ((mGroup != null) && (mGroup.IsVirtual == false) && (mGroup.ParentGroup != null))
{
tv.Click += (object sender, EventArgs e) =>
{
Finish();
};
titleText = name;
} else
{
tv.SetCompoundDrawables(null, null, null, null);
tv.Clickable = false;
titleText = GetText(Resource.String.root);
}
//see if the button for SDK Version < 11 is there
Button tv = (Button)FindViewById(Resource.Id.group_name);
if (tv != null)
{
if (mGroup != null)
{
tv.Text = titleText;
}
if (clickable)
{
tv.Click += (object sender, EventArgs e) =>
{
Finish();
};
} else
{
tv.SetCompoundDrawables(null, null, null, null);
tv.Clickable = false;
}
}
//ICS?
if (ActionBar != null)
{
ActionBar.Title = titleText;
if (clickable)
ActionBar.SetDisplayHomeAsUpEnabled(true);
}
}
protected void setGroupIcon() {
if (mGroup != null) {
Drawable drawable = App.getDB().drawFactory.getIconDrawable(Resources, App.getDB().pm, mGroup.IconId, mGroup.CustomIconUuid);
ImageView iv = (ImageView) FindViewById(Resource.Id.icon);
App.getDB().drawFactory.assignDrawableTo(iv, Resources, App.getDB().pm, mGroup.IconId, mGroup.CustomIconUuid);
if (iv != null)
iv.SetImageDrawable(drawable);
if (ActionBar != null)
ActionBar.SetIcon(drawable);
}
}
@ -240,6 +255,12 @@ namespace keepass2android
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
}
return true;
case Android.Resource.Id.Home:
//Currently the action bar only displays the home button when we come from a previous activity.
//So we can simply Finish. See this page for information on how to do this in more general (future?) cases:
//http://developer.android.com/training/implementing-navigation/ancestral.html
Finish();
return true;
}
return base.OnOptionsItemSelected(item);

View File

@ -266,7 +266,7 @@ namespace keepass2android
unloadDatabase();
break;
case Android.App.Result.Ok:
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE) {
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_KEYFILE) {
String filename = data.DataString;
if (filename != null) {
if (filename.StartsWith("file://")) {
@ -447,7 +447,7 @@ namespace keepass2android
try
{
StartActivityForResult(intent, Intents.REQUEST_CODE_FILE_BROWSE);
StartActivityForResult(intent, Intents.REQUEST_CODE_FILE_BROWSE_FOR_KEYFILE);
} catch (ActivityNotFoundException)
{
BrowserDialog diag = new BrowserDialog(this);

View File

@ -55,7 +55,14 @@ namespace keepass2android
SetContentView(Resource.Layout.QuickUnlock);
((TextView)FindViewById(Resource.Id.qu_filename)).Text = mIoc.GetDisplayName();
if (App.getDB().pm.Name != "")
{
FindViewById(Resource.Id.filename_label).Visibility = ViewStates.Invisible;
((TextView)FindViewById(Resource.Id.qu_filename)).Text = App.getDB().pm.Name;
} else
{
((TextView)FindViewById(Resource.Id.qu_filename)).Text = mIoc.Path;
}
TextView txtLabel = (TextView)FindViewById(Resource.Id.QuickUnlock_label);

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -4,5 +4,5 @@
android:shape="rectangle">
<size android:width="1000dp" android:height="2px" />
<solid
android:color="@color/emphasis"/>
android:color="@color/light_gray"/>
</shape>

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal">
<TextView
android:id="@+id/filename_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pass_filename"
android:layout_centerHorizontal="true" />
<ImageView
android:id="@+id/divider1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/filename_label"
android:scaleType="fitXY"
android:src="@android:drawable/divider_horizontal_dark" />
<TextView
android:id="@+id/qu_filename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:text="filename"
android:layout_centerHorizontal="true"
android:layout_below="@id/divider1"
android:gravity="center" />
<TextView
android:id="@+id/QuickUnlock_label"
android:text="@string/QuickUnlock_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/qu_filename"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textSize="20sp"
android:gravity="center" />
<EditText
android:inputType="textPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:layout_below="@id/QuickUnlock_label"
android:id="@+id/QuickUnlock_password"
android:layout_centerHorizontal="true"
android:textSize="28sp"
android:focusable="true"
android:focusableInTouchMode="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/QuickUnlock_password"
android:orientation="horizontal"
android:layout_centerHorizontal="true">
<Button
android:text="@string/QuickUnlock_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/QuickUnlock_button"
android:drawableTop="@drawable/device_access_not_secure" />
<Button
android:text="@string/QuickUnlock_lockButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/QuickUnlock_buttonLock"
android:layout_marginLeft="5dp"
android:drawableTop="@drawable/ic_menu_remove_field_holo_light" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:actionButtonStyle"
android:id="@+id/entry_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_accept"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/entry_save" />
</FrameLayout>

View File

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ScrollView
android:id="@+id/entry_scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/entry_save_header">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- Title -->
<ImageButton
android:id="@+id/icon_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/ic00" />
<EditText
android:id="@+id/entry_title"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:capitalize="sentences"
android:layout_toLeftOf="@+id/icon_button"
android:hint="@string/hint_title"
android:singleLine="true" />
<!-- Username -->
<EditText
android:id="@+id/entry_user_name"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_below="@id/icon_button"
android:hint="@string/hint_username"
android:inputType="textEmailAddress"
android:singleLine="true" />
<!-- URL -->
<EditText
android:id="@+id/entry_url"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_below="@id/entry_user_name"
android:hint="@string/hint_url"
android:inputType="textUri"
android:singleLine="true" />
<!-- Password -->
<TextView
android:id="@+id/entry_password_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry_url"
android:text="@string/entry_password" />
<Button
android:id="@+id/generate_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/entry_password_label"
android:text="@string/ellipsis" />
<EditText
android:id="@+id/entry_password"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/generate_button"
android:layout_toLeftOf="@id/generate_button"
android:hint="@string/hint_pass"
android:inputType="textPassword"
android:singleLine="true"
android:typeface="monospace" />
<!-- Confirm Password -->
<TextView
android:id="@+id/entry_confpassword_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry_password"
android:text="@string/entry_confpassword" />
<EditText
android:id="@+id/entry_confpassword"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_confpassword_label"
android:hint="@string/hint_conf_pass"
android:inputType="textPassword"
android:singleLine="true"
android:typeface="monospace" />
<!-- Comment -->
<TextView
android:id="@+id/entry_comment_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry_confpassword"
android:text="@string/entry_comment" />
<EditText
android:id="@+id/entry_comment"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_comment_label"
android:hint="@string/hint_comment"
android:inputType="textMultiLine" />
<!-- Extra strings -->
<LinearLayout
android:id="@+id/advanced_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_comment"
android:orientation="vertical" />
<Button
android:id="@+id/add_advanced"
style="@style/EditEntryButton"
android:layout_marginTop="-4dp"
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:text="@string/add_extra_string" />
<!-- file attachments -->
<TextView
android:id="@+id/entry_binaries_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/add_advanced"
android:text="@string/entry_binaries" />
<LinearLayout
android:id="@+id/binaries"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_binaries_label"
android:orientation="vertical" />
<!-- Tags -->
<TextView
android:id="@+id/entry_tags_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/binaries"
android:text="@string/entry_tags" />
<EditText
android:id="@+id/entry_tags"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_tags_label"
android:hint="@string/hint_tags"
android:inputType="text"
android:singleLine="true" />
<!-- Override URL -->
<TextView
android:id="@+id/entry_override_url_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry_tags"
android:text="@string/entry_override_url" />
<EditText
android:id="@+id/entry_override_url"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_override_url_label"
android:hint="@string/hint_override_url"
android:inputType="textUri"
android:singleLine="true" />
<!-- Expires -->
<TextView
android:id="@+id/entry_expires_label"
style="@style/TextAppearance_EditEntry_LabelSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_override_url"
android:text="@string/entry_expires" />
<CheckBox
android:id="@+id/entry_expires_checkbox"
android:layout_marginLeft="16dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry_expires_label" />
<EditText
android:id="@+id/entry_expires"
android:layout_marginLeft="-12dip"
android:layout_marginRight="12dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry_expires_label"
android:layout_toRightOf="@id/entry_expires_checkbox" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:paddingTop="1dip"
android:gravity="center_vertical"
android:layout_height="wrap_content">
<EditText
android:id="@+id/title"
android:singleLine="true"
android:inputType="text"
android:hint="@string/field_name"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="top|left"
android:layout_marginRight="0dip" />
<EditText
android:id="@+id/value"
android:hint="@string/field_value"
android:inputType="textMultiLine"
style="@style/TextAppearance_EditEntry_Value"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="top|left"
android:layout_marginRight="0dip" />
<ImageButton
android:id="@+id/delete"
style="@style/MinusButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" />
</LinearLayout>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal" />
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:divider="?android:attr/dividerVertical"
android:layout_alignParentBottom="true"
android:dividerPadding="12dp">
<FrameLayout
style="@style/BottomBarActionButton"
android:id="@+id/entry_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@android:drawable/ic_menu_edit"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/menu_edit" />
</FrameLayout>
</LinearLayout>
<ImageView
android:id="@+id/entry_divider2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom_bar"
android:scaleType="fitXY"
android:tint="@color/blue_highlight"
android:src="@android:drawable/divider_horizontal_bright" />
<ScrollView
android:id="@+id/entry_scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/entry_divider2"
android:fillViewport="true"
android:scrollbarStyle="insideOverlay">
<keepass2android.view.EntryContentsView
android:id="@+id/entry_contents"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</ScrollView>
</RelativeLayout>

View File

@ -1,176 +1,179 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/entry_table"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<!-- Username -->
<TextView
android:id="@+id/entry_user_name_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_user_name"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_user_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!-- URL -->
<TextView
android:id="@+id/entry_url_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_url"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="all"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!-- Password -->
<TextView
android:id="@+id/entry_password_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_password"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:password="true"
android:textIsSelectable="true"
android:typeface="monospace"
style="@style/EntryItem" />
<!-- Comment -->
<TextView
android:id="@+id/entry_comment_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_comment"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_comment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
style="@style/EntryItem" />
<TextView
android:id="@+id/entry_extra_strings_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_extra_strings"
style="@style/EntryFieldHeader"
/>
<LinearLayout
android:id="@+id/extra_strings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<!-- file attachments -->
<TextView
android:id="@+id/entry_binaries_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_binaries"
style="@style/EntryFieldHeader"
/>
<LinearLayout
android:id="@+id/binaries"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<!--Tags -->
<TextView
android:id="@+id/entry_tags_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_tags"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_tags"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!--Override URL-->
<TextView
android:id="@+id/entry_override_url_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_override_url"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_override_url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="all"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!-- Created -->
<TextView
android:id="@+id/entry_created_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_created"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_created"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Modified -->
<TextView
android:id="@+id/entry_modified_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_modified"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_modified"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Accessed -->
<TextView
android:id="@+id/entry_accessed_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_accessed"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_accessed"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Expires -->
<TextView
android:id="@+id/entry_expires_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_expires"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_expires"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Property Change Conflict | id:@+id/entry_url_label -->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/entry_table"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<!-- Username -->
<TextView
android:id="@+id/entry_user_name_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_user_name"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_user_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!-- URL -->
<TextView
android:id="@+id/entry_url_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_url"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="all"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!-- Password -->
<TextView
android:id="@+id/entry_password_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_password"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:password="true"
android:textIsSelectable="true"
android:typeface="monospace"
style="@style/EntryItem" />
<!-- Comment -->
<TextView
android:id="@+id/entry_comment_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_comment"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_comment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
style="@style/EntryItem" />
<TextView
android:id="@+id/entry_extra_strings_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_extra_strings"
style="@style/EntryFieldHeader"
/>
<LinearLayout
android:id="@+id/extra_strings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:orientation="vertical" />
<!-- file attachments -->
<TextView
android:id="@+id/entry_binaries_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_binaries"
style="@style/EntryFieldHeader"
/>
<LinearLayout
android:id="@+id/binaries"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<!--Tags -->
<TextView
android:id="@+id/entry_tags_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_tags"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_tags"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!--Override URL-->
<TextView
android:id="@+id/entry_override_url_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_override_url"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_override_url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="all"
android:textIsSelectable="true"
style="@style/EntryItem" />
<!-- Created -->
<TextView
android:id="@+id/entry_created_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_created"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_created"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Modified -->
<TextView
android:id="@+id/entry_modified_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_modified"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_modified"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Accessed -->
<TextView
android:id="@+id/entry_accessed_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_accessed"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_accessed"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Expires -->
<TextView
android:id="@+id/entry_expires_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_expires"
style="@style/EntryFieldHeader"
/>
<TextView
android:id="@+id/entry_expires"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/EntryItem" />
<!-- Property Change Conflict | id:@+id/entry_url_label -->
</LinearLayout>

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:divider="?android:attr/dividerVertical"
android:showDividers="middle"
android:layout_alignParentBottom="true"
android:dividerPadding="12dp"
android:baselineAligned="false">
<FrameLayout
android:id="@+id/accept_button"
style="@style/BottomBarActionButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_accept"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/accept" />
</FrameLayout>
<FrameLayout
android:id="@+id/cancel_button"
style="@style/BottomBarActionButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/navigation_cancel"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@android:string/cancel" />
</FrameLayout>
</LinearLayout>
<ScrollView
android:id="@+id/ScrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/bottom_bar"
android:layout_marginBottom="12dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:layout_marginTop="12dip">
<RelativeLayout
android:id="@+id/RelativeLayout"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:singleLine="true"
android:typeface="monospace"
android:hint="@string/hint_generated_password" />
<Button
android:id="@+id/generate_password_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/password"
android:text="@string/generate_password" />
<TextView
android:id="@+id/length_label"
android:text="@string/length"
style="@style/TextAppearance_SmallHeading"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_below="@id/generate_password_button" />
<Button
android:id="@+id/btn_length16"
android:text="16"
android:layout_alignParentRight="true"
android:layout_width="60sp"
android:layout_height="wrap_content"
android:layout_below="@id/length_label" />
<Button
android:id="@+id/btn_length12"
android:text="12"
android:layout_toLeftOf="@id/btn_length16"
android:layout_height="wrap_content"
android:layout_width="60sp"
android:layout_alignTop="@id/btn_length16" />
<Button
android:id="@+id/btn_length8"
android:text="8"
android:layout_toLeftOf="@id/btn_length12"
android:layout_height="wrap_content"
android:layout_width="60sp"
android:layout_alignTop="@id/btn_length16" />
<Button
android:id="@+id/btn_length6"
android:text="6"
android:layout_toLeftOf="@id/btn_length8"
android:layout_height="wrap_content"
android:layout_width="60sp"
android:layout_alignTop="@id/btn_length16" />
<EditText
android:id="@+id/length"
android:layout_width="fill_parent"
android:layout_toLeftOf="@id/btn_length6"
android:layout_height="wrap_content"
android:layout_alignTop="@id/btn_length16"
android:singleLine="true"
android:text="12"
android:hint="@string/hint_length" />
<CheckBox
android:id="@+id/cb_uppercase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uppercase"
android:checked="true"
android:layout_below="@id/length" />
<CheckBox
android:id="@+id/cb_lowercase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lowercase"
android:checked="true"
android:layout_below="@id/cb_uppercase" />
<CheckBox
android:id="@+id/cb_digits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/digits"
android:checked="true"
android:layout_below="@id/cb_lowercase" />
<CheckBox
android:id="@+id/cb_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/minus"
android:layout_below="@id/cb_digits" />
<CheckBox
android:id="@+id/cb_underline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/underline"
android:layout_below="@id/cb_minus" />
<CheckBox
android:id="@+id/cb_space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/space"
android:layout_below="@id/cb_underline" />
<CheckBox
android:id="@+id/cb_specials"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/special"
android:layout_below="@id/cb_space" />
<CheckBox
android:id="@+id/cb_brackets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/brackets"
android:layout_below="@id/cb_specials" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal" />
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:divider="?android:attr/dividerVertical"
android:showDividers="middle"
android:layout_alignParentBottom="true"
android:dividerPadding="12dp"
android:baselineAligned="false">
<FrameLayout
android:id="@+id/add_group"
style="@style/BottomBarActionButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/btn_new_group"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/add_group" />
</FrameLayout>
<FrameLayout
android:id="@+id/add_entry"
style="@style/BottomBarActionButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/device_access_new_account"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/add_entry" />
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/divider2"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_above="@id/bottom_bar"
android:background="#b8b8b8" />
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/divider2"
android:layout_below="@id/top"
android:paddingRight="8dp"
android:paddingLeft="8dp" />
</RelativeLayout>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
-->
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/IconGridView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/background_light"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:columnWidth="60dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth">
</GridView>

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:layout_marginBottom="12dip">
<TextView
android:id="@+id/filename_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance_SmallHeading"
android:text="@string/pass_filename" />
<ImageView
android:id="@+id/divider1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/filename_label"
android:scaleType="fitXY"
android:src="@android:drawable/divider_horizontal_dark" />
<HorizontalScrollView
android:id="@+id/filenamescroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/divider1">
<TextView
android:id="@+id/filename"
style="@style/GroupText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:focusable="true"
android:focusableInTouchMode="true" />
</HorizontalScrollView>
<ImageView
android:id="@+id/divider2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/filenamescroll"
android:scaleType="fitXY"
android:src="@android:drawable/divider_horizontal_dark" />
<TextView
android:id="@+id/password_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/divider2"
android:text="@string/entry_and_or" />
<LinearLayout
android:id="@+id/passwordLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/password_label"
android:orientation="horizontal">
<EditText
android:id="@+id/password"
android:layout_width="0px"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textPassword"
android:layout_weight="1"
android:hint="@string/hint_login_pass" />
<ImageButton
android:id="@+id/toggle_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_menu_view" />
</LinearLayout>
<LinearLayout
android:id="@+id/keyfileLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/passwordLine"
android:orientation="horizontal">
<EditText
android:id="@+id/pass_keyfile"
android:layout_width="0px"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_weight="1"
android:hint="@string/entry_keyfile" />
<ImageButton
android:id="@+id/browse_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_folder_small" />
</LinearLayout>
<Button
android:id="@+id/pass_ok"
android:text="@android:string/ok"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/keyfileLine" />
<CheckBox
android:id="@+id/default_database"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/pass_ok"
android:text="@string/default_checkbox" />
<CheckBox
android:id="@+id/enable_quickunlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/default_database"
android:text="@string/enable_quickunlock" />
</RelativeLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_marginTop="8dip"
android:layout_marginLeft="24dip"
android:layout_marginRight="24dip"
android:paddingLeft="8dip"
android:paddingRight="8dip"
android:textAllCaps="true"
android:textColor="#FF737373"
android:background="#e8e8e8" />

View File

@ -39,8 +39,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/entry_title"
style="@style/EntryFieldHeader"
/>
style="@style/EntryFieldHeader" />
<ImageButton
android:id="@+id/icon_button"
android:layout_width="wrap_content"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<keepass2android.view.EntryEditSection xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
@ -37,4 +37,4 @@
android:layout_below="@id/value"
android:scaleType="fitXY"
android:src="@android:drawable/divider_horizontal_dark" />
</keepass2android.view.EntryEditSection>
</LinearLayout>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:layout_marginLeft="10dp"
style="@style/ExtraFieldHeader" />

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:typeface="monospace"
android:text="Value"
android:layout_marginLeft="30dp"
style="@style/EntryItem" />

View File

@ -14,7 +14,6 @@
android:id="@+id/value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:typeface="monospace"
android:text="Value"
android:layout_marginLeft="30dp"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<!-- Extra strings -->
<LinearLayout
android:id="@+id/extra_strings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>

View File

@ -1,57 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_height="fill_parent"
android:layout_margin="12dip">
<TextView
android:id="@+id/file_listtop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/listSeparatorTextViewStyle"
android:text="@string/open_recent" />
<keepass2android.view.FileNameView
android:id="@+id/file_select"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<!--
<Button android:id="@+id/open"
android:text="@string/menu_open"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:width="100sp"/>
<Button android:id="@+id/create"
android:text="@string/menu_create"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/open"
android:width="100sp"/>
<ImageButton android:id="@+id/browse_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_folder_small"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/file_filename"
/>
<EditText android:id="@+id/file_filename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_above="@id/open"
android:layout_toLeftOf="@id/browse_button"
/>
<TextView android:id="@+id/label_open_by_filename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/file_filename"
style="?android:attr/listSeparatorTextViewStyle"
android:text="@string/enter_filename"/>
-->
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/file_listtop"
android:layout_above="@id/file_select" />
android:layout_height="wrap_content"
android:layout_below="@id/file_listtop" />
</RelativeLayout>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="@+id/label_warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="@string/warning_read_only"
android:visibility="visible" />
<Button
android:text="@string/start_open_file"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/start_open_file"
android:minHeight="45dp"
android:drawableTop="@drawable/collections_collection" />
<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" />
<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" />
</LinearLayout>

View File

@ -1,17 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/filename_form">
<TextView
android:id="@+id/label_warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:visibility="invisible" />
<TextView
android:id="@+id/label_open_by_filename"
android:layout_width="wrap_content"
@ -62,31 +57,4 @@
android:layout_toRightOf="@id/create"
android:minWidth="100sp" />
</RelativeLayout>
<Button
android:text="@string/start_open_file"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/GreenButton"
android:layout_alignParentLeft="true"
android:id="@+id/start_open_file"
android:layout_below="@id/filename_form"
android:minHeight="45dp" />
<Button
android:text="@string/start_open_url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/BlueButton"
android:layout_alignParentLeft="true"
android:layout_below="@id/start_open_file"
android:id="@+id/start_open_url"
android:minHeight="45dp" />
<Button
android:text="@string/start_create"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/YellowButton"
android:layout_alignParentLeft="true"
android:layout_below="@id/start_open_url"
android:id="@+id/start_create"
android:minHeight="45dp" />
</RelativeLayout>
</LinearLayout>

View File

@ -1,59 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_height="fill_parent"
android:layout_margin="12dip">
<LinearLayout
android_id="@+id/bottom_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<keepass2android.view.FileNameView
android:id="@+id/file_select"
android:layout_gravity="center_horizontal">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<!--LinearLayout
android:id="@+id/buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/file_select">
<include
layout="@layout/StartScreenButtons" />
</LinearLayout-->
</RelativeLayout>
<!--
<TextView android:id="@+id/label_open_by_filename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/listSeparatorTextViewStyle"
android:text="@string/enter_filename"/>
<ImageButton android:id="@+id/browse_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_folder_small"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/file_filename"
/>
<EditText android:id="@+id/file_filename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_below="@id/label_open_by_filename"
android:layout_toLeftOf="@id/browse_button"
/>
<Button android:id="@+id/open"
android:text="@string/menu_open"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@id/file_filename"
android:width="100sp"/>
<Button android:id="@+id/create"
android:text="@string/menu_create"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@id/file_filename"
android:layout_toRightOf="@id/open"
android:width="100sp"/>
-->
android:layout_height="fill_parent">
<keepass2android.view.FileSelectButtons
android:id="@+id/file_select"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</ScrollView>
</LinearLayout>
<!-- Small hack because I need to include a list since this is a list activity -->
<ListView
android:id="@android:id/list"

View File

@ -2,10 +2,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<keepass2android.view.GroupHeaderView
android:id="@+id/group_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_alignParentBottom="true"
@ -45,6 +41,5 @@
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/divider2"
android:layout_below="@id/group_header" />
android:layout_above="@id/divider2" />
</RelativeLayout>

View File

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<style name="Base" parent="android:Theme.Holo.Light"></style>
<style name="NoTitleBar" parent="android:Theme.Holo.Light"></style>
<style name="Dialog" parent="android:Theme.Holo.Light.Dialog"></style>
<style name="GroupTextSmall" parent="android:Theme.Holo.Light">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">15sp</item>
</style>
<style name="GroupText" parent="android:Theme.Holo.Light">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="GroupTextLarge" parent="android:Theme.Holo.Light">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">28sp</item>
</style>
<style name="ElementTextSmall">
<item name="@android:textSize">15sp</item>
</style>
<style name="ElementText">
<item name="@android:textSize">20sp</item>
</style>
<style name="ElementTextLarge">
<item name="@android:textSize">28sp</item>
</style>
<style name="GroupLabel">
<item name="@android:textSize">20sp</item>
</style>
<style name="WhiteOnBlack">
<item name="@android:background">#666666</item>
<item
name="@android:textColor">@android:color/primary_text_dark</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="WhiteOnBlackSmall" parent="WhiteOnBlack">
<item name="@android:textSize">12sp</item>
</style>
<style name="WhiteOnDarkSmall" parent="WhiteOnBlack">
<item name="@android:textSize">12sp</item>
<item name="@android:textColor">@color/group</item>
</style>
<style name="ElementTextTitle" parent="WhiteOnBlack">
<item name="@android:textColor">@color/group</item>
</style>
<style name="EntryItem">
<item name="@android:padding">5sp</item>
<item name="@android:textColor">@color/group</item>
</style>
<style name="EntryFieldHeader" parent="android:Widget.Holo.Light.TextView">
<item name="android:drawableBottom">@drawable/section_header</item>
<item name="android:drawablePadding">1dp</item>
<item name="android:layout_marginBottom">3dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/emphasis</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="ExtraFieldHeader" parent="android:Widget.Holo.Light.TextView">
<item name="android:drawablePadding">1dp</item>
<item name="android:layout_marginBottom">3dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/emphasis2</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
</resources>

View File

@ -1,26 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<color name="blue_highlight">#0000dd</color>
<color name="group">#333333</color>
<color name="icon_background">#555555</color>
<color name="icon_text">#000000</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<color name="blue_highlight">#0000dd</color>
<color name="group">#333333</color>
<color name="icon_background">#00555555</color>
<color name="icon_text">#000000</color>
<color name="light_gray">#a8a8a8</color>
<color name="dark_gray">#303030</color>
</resources>

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Base" parent="android:Theme.Holo.Light"></style>
<style name="NoTitleBar" parent="android:Theme.Holo.Light"></style>
<style name="Dialog" parent="android:Theme.Holo.Light.Dialog"></style>
<style name="GroupTextSmall" parent="android:Theme.Holo.Light">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">15sp</item>
</style>
<style name="GroupText" parent="android:Theme.Holo.Light">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="GroupTextLarge" parent="android:Theme.Holo.Light">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">28sp</item>
</style>
<style name="ElementTextSmall">
<item name="@android:textSize">15sp</item>
</style>
<style name="ElementText">
<item name="@android:textSize">20sp</item>
</style>
<style name="ElementTextLarge">
<item name="@android:textSize">28sp</item>
</style>
<style name="GroupLabel">
</style>
<style name="WhiteOnBlack">
</style>
<style name="WhiteOnBlackSmall" parent="WhiteOnBlack">
</style>
<style name="WhiteOnDarkSmall" parent="WhiteOnBlack">
</style>
<style name="ElementTextTitle" parent="WhiteOnBlack">
</style>
<style name="EntryItem">
<item name="android:layout_marginLeft">12dip</item>
<item name="android:layout_marginRight">12dip</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textColor">@color/dark_gray</item>
<item name="android:textSize">14sp</item>
</style>
<style name="EntryFieldHeader" parent="android:Widget.Holo.Light.TextView">
<item name="android:drawableBottom">@drawable/section_header</item>
<item name="android:drawablePadding">2dp</item>
<item name="android:layout_marginLeft">12dip</item>
<item name="android:layout_marginRight">12dip</item>
<item name="android:layout_marginBottom">3dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/light_gray</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="BottomBarActionButton" parent="android:style/Widget.Holo.Light.ActionButton">
<item name="android:background">#c8c8c8</item>
</style>
<style name="TextAppearance_EditEntry_Small">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#FF888888</item>
<item name="android:textAllCaps">true</item>
</style>
<style name="TextAppearance_EditEntry_LabelSmall" parent="TextAppearance_EditEntry_Small">
<item name="android:minHeight">24dip</item>
<item name="android:layout_width">144dip</item>
<item name="android:layout_marginTop">12dip</item>
<item name="android:layout_marginLeft">16dip</item>
<item name="android:layout_marginRight">16dip</item>
<item name="android:paddingLeft">8dip</item>
<item name="android:paddingRight">8dip</item>
<item name="android:layout_marginBottom">-12dip</item>
</style>
<style name="TextAppearance_EditEntry">
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textSize">18sp</item>
<item name="android:textColor">#FF333333</item>
</style>
<style name="TextAppearance_EditEntry_Value" parent="TextAppearance_EditEntry">
<item name="android:gravity">center_vertical</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_marginRight">12dip</item>
<item name="android:layout_marginLeft">12dip</item>
</style>
<style name="TextAppearance_SmallHeading" parent="TextAppearance_EditEntry_Small">
<item name="android:minHeight">24dip</item>
<item name="android:layout_width">144dip</item>
<item name="android:layout_marginTop">12dip</item>
<item name="android:layout_marginRight">16dip</item>
<item name="android:paddingRight">8dip</item>
<item name="android:layout_marginBottom">-12dip</item>
</style>
<style name="EditEntryButton">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:layout_marginTop">12dip</item>
<item name="android:layout_marginLeft">24dip</item>
<item name="android:layout_marginRight">24dip</item>
<item name="android:paddingLeft">8dip</item>
<item name="android:paddingRight">8dip</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">#FF737373</item>
<item name="android:background">#e8e8e8</item>
</style>
<style name="AdditionalStringLayout">
<item name="android:layout_marginLeft">24dip</item>
<item name="android:layout_marginRight">24dip</item>
</style>
<style name="MinusButton">
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="android:src">@drawable/ic_menu_remove_field_holo_light</item>
</style>
<style name="ExtraFieldHeader" parent="android:Widget.Holo.Light.TextView">
<item name="android:layout_marginLeft">16dip</item>
<item name="android:layout_marginRight">12dip</item>
<item name="android:layout_marginBottom">3dp</item>
<item name="android:layout_marginTop">4dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/light_gray</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
</resources>

View File

@ -42,6 +42,7 @@
<string name="timeout_key">timeout_key</string>
<string name="TanExpiresOnUse_key">TanExpiresOnUse_key</string>
<string name="default_username_key">defaultUsername</string>
<string name="database_name_key">databaseName</string>
<string name="BinaryDirectory_key">binaryDirectory</string>
<string name="BinaryDirectory_default">/mnt/sdcard/keepass2android/binaries/</string>
<bool name="maskpass_default">true</bool>
@ -75,7 +76,7 @@
<item>300000</item>
<item>-1</item>
</string-array>
<string name="list_size_default">28</string>
<string name="list_size_default">20</string>
<string-array name="list_size_values">
<item>15</item>
<item>20</item>

View File

@ -151,6 +151,7 @@
<string name="rounds">Encryption Rounds</string>
<string name="rounds_explaination">Higher encryption rounds provide additional protection against brute force attacks, but can really slow down loading and saving.</string>
<string name="rounds_hint">rounds</string>
<string name="database_name">Database name</string>
<string name="default_username">Default user name for new entries</string>
<string name="saving_database">Saving database…</string>
<string name="space">Space</string>

View File

@ -22,79 +22,42 @@
<style name="NoTitleBar" parent="android:Theme.NoTitleBar"></style>
<style name="Dialog" parent="android:Theme.Dialog"></style>
<style name="GroupTextSmall" parent="android:Theme">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">15sp</item>
</style>
<style name="GroupText" parent="android:Theme">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="GroupTextLarge" parent="android:Theme">
<item name="@android:textColor">@color/group</item>
<item name="@android:textSize">28sp</item>
</style>
<style name="ElementTextSmall">
<item name="@android:textSize">15sp</item>
</style>
<style name="ElementText">
<item name="@android:textSize">20sp</item>
</style>
<style name="ElementTextLarge">
<item name="@android:textSize">28sp</item>
</style>
<style name="GroupLabel">
<item name="@android:textSize">20sp</item>
</style>
<style name="WhiteOnBlack">
<item name="@android:background">#666666</item>
<item name="@android:textColor">@android:color/primary_text_dark</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="GroupAndEntryHeader">
<item name="@android:background">#000066</item>
<item name="@android:textColor">#ffffff</item>
<item name="@android:textSize">20sp</item>
</style>
<style name="WhiteOnBlackSmall" parent="WhiteOnBlack">
<item name="@android:textSize">12sp</item>
</style>
<style name="WhiteOnDarkSmall" parent="WhiteOnBlack">
<item name="@android:textSize">12sp</item>
<item name="@android:background">#222222</item>
</style>
<style name="EntryFieldHeader" parent="WhiteOnDarkSmall">
<item name="@android:textSize">12sp</item>
</style>
<style name="ElementTextTitle" parent="WhiteOnBlack">
<item name="@android:textColor">@color/group</item>
<item name="@android:background">@android:color/transparent</item>
</style>
<style name="EntryItem">
<item name="@android:padding">5sp</item>
</style>
<style name="EditEntryButton">
</style>
<style name="EntryFieldHeader">
<item name="android:drawableBottom">@drawable/section_header</item>
<item name="android:drawablePadding">1dp</item>
<item name="android:layout_marginBottom">3dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/emphasis</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="@android:background">@android:color/transparent</item>
</style>
<style name="ExtraFieldHeader">
<item name="android:drawablePadding">1dp</item>
<item name="android:layout_marginBottom">3dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/emphasis2</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="@android:background">@android:color/transparent</item>
</style>
</resources>

View File

@ -23,6 +23,10 @@
android:key="@string/db_key"
android:title="@string/database"
android:summary="@string/menu_db_settings">
<EditTextPreference
android:title="@string/database_name"
android:persistent="false"
android:key="@string/database_name_key"/>
<Preference
android:key="@string/algorithm_key"
android:title="@string/algorithm"
@ -39,6 +43,7 @@
android:title="@string/default_username"
android:persistent="false"
android:key="@string/default_username_key"/>
</PreferenceScreen>
<PreferenceScreen

View File

@ -28,10 +28,11 @@ using Android.Runtime;
using Android.Views;
using Android.Widget;
using keepass2android.view;
using Android.Content.PM;
namespace keepass2android
{
[Activity (Label = "@string/kp2a_findUrl")]
[Activity (Label = "@string/kp2a_findUrl", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden, Theme="@style/Base")]
public class ShareUrlResults : GroupBaseActivity
{

View File

@ -88,7 +88,7 @@ namespace keepass2android
}
public static void showBrowseDialog(string filename, Activity act)
public static void showBrowseDialog(string filename, Activity act, int requestCodeBrowse)
{
if (Interaction.isIntentAvailable(act, Intents.FILE_BROWSE))
{
@ -96,7 +96,7 @@ namespace keepass2android
i.SetData(Android.Net.Uri.Parse("file://" + filename));
try
{
act.StartActivityForResult(i, Intents.REQUEST_CODE_FILE_BROWSE);
act.StartActivityForResult(i, requestCodeBrowse);
}
catch (ActivityNotFoundException)
{

View File

@ -65,6 +65,10 @@ namespace keepass2android
private static Database db;
private static bool shutdown = false;
/// <summary>
/// See comments to EntryEditActivityState.
/// </summary>
internal static EntryEditActivityState entryEditActivityState = null;
public static FileDbHelper fileDbHelper;

View File

@ -45,13 +45,6 @@ namespace keepass2android
public class FileSelectActivity : ListActivity
{
enum CurrentAction { None, OpenFile, OpenURL, Create, CreateImport };
CurrentAction currentAction = CurrentAction.None;
public FileSelectActivity (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
@ -65,22 +58,147 @@ namespace keepass2android
public const String UrlToSearch_key = "UrlToSearch";
const String BundleKey_UrlToSearchFor = "UrlToSearch";
const string BundleKey_CurrentAction = "CurrentAction";
const string BundleKey_RecentMode = "RecentMode";
private FileDbHelper mDbHelper;
private String mUrlToSearch;
private bool recentMode = false;
view.FileSelectButtons fileSelectButtons;
bool createdWithActivityResult = false;
IOConnectionInfo loadIoc(string defaultFileName)
{
return mDbHelper.cursorToIoc(mDbHelper.fetchFileByName(defaultFileName));
}
void ShowFilenameDialog(bool showOpenButton, bool showCreateButton, bool showBrowseButton, string defaultFilename, string detailsText, int requestCodeBrowse)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetView(LayoutInflater.Inflate(Resource.Layout.file_selection_filename, null));
Dialog dialog = builder.Create();
dialog.Show();
Button openButton = (Button)dialog.FindViewById(Resource.Id.open);
Button createButton = (Button)dialog.FindViewById(Resource.Id.create);
TextView enterFilenameDetails = (TextView)dialog.FindViewById(Resource.Id.label_open_by_filename_details);
openButton.Visibility = showOpenButton ? ViewStates.Visible : ViewStates.Gone;
createButton.Visibility = showCreateButton ? ViewStates.Visible : ViewStates.Gone;
// Set the initial value of the filename
EditText editFilename = (EditText)dialog.FindViewById(Resource.Id.file_filename);
editFilename.Text = defaultFilename;
enterFilenameDetails.Text = detailsText;
enterFilenameDetails.Visibility = enterFilenameDetails.Text == "" ? ViewStates.Gone : ViewStates.Visible;
// Open button
openButton.Click += ( sender, evt) => {
String fileName = ((EditText)dialog.FindViewById(Resource.Id.file_filename)).Text;
IOConnectionInfo ioc = new IOConnectionInfo() {
Path = fileName
};
LaunchPasswordActivityForIoc(ioc);
};
// Create button
createButton.Click += (sender, evt) => {
String filename = Util.getEditText(this,
Resource.Id.file_filename);
//TODO: allow non-local files?
// Make sure file name exists
if (filename.Length == 0)
{
Toast
.MakeText(this,
Resource.String.error_filename_required,
ToastLength.Long).Show();
return;
}
// Try to create the file
Java.IO.File file = new Java.IO.File(filename);
try
{
if (file.Exists())
{
Toast.MakeText(this,
Resource.String.error_database_exists,
ToastLength.Long).Show();
return;
}
Java.IO.File parent = file.ParentFile;
if (parent == null || (parent.Exists() && ! parent.IsDirectory))
{
Toast.MakeText(this,
Resource.String.error_invalid_path,
ToastLength.Long).Show();
return;
}
if (! parent.Exists())
{
// Create parent dircetory
if (! parent.Mkdirs())
{
Toast.MakeText(this,
Resource.String.error_could_not_create_parent,
ToastLength.Long).Show();
return;
}
}
file.CreateNewFile();
} catch (Java.IO.IOException ex)
{
Toast.MakeText(
this,
GetText(Resource.String.error_file_not_create) + " "
+ ex.LocalizedMessage,
ToastLength.Long).Show();
return;
}
// Prep an object to collect a password once the database has
// been created
CollectPassword password = new CollectPassword(
new LaunchGroupActivity(IOConnectionInfo.FromPath(filename), this), this);
// Create the new database
CreateDB create = new CreateDB(this, IOConnectionInfo.FromPath(filename), password, true);
ProgressTask createTask = new ProgressTask(
this, create,
Resource.String.progress_create);
createTask.run();
};
Button cancelButton = (Button)dialog.FindViewById(Resource.Id.fnv_cancel);
cancelButton.Click += (sender, e) => {
dialog.Dismiss();
};
ImageButton browseButton = (ImageButton)dialog.FindViewById(Resource.Id.browse_button);
if (!showBrowseButton)
{
browseButton.Visibility = ViewStates.Invisible;
}
browseButton.Click += (sender, evt) => {
string filename = ((EditText)dialog.FindViewById(Resource.Id.file_filename)).Text;
Util.showBrowseDialog(filename, this, requestCodeBrowse);
};
}
protected override void OnCreate(Bundle savedInstanceState)
{
@ -98,34 +216,30 @@ namespace keepass2android
if (mDbHelper.hasRecentFiles())
{
recentMode = true;
SetContentView(Resource.Layout.file_selection);
fileSelectButtons = new keepass2android.view.FileSelectButtons(this);
((ListView)FindViewById(Android.Resource.Id.List)).AddFooterView(
fileSelectButtons);
} else
{
SetContentView(Resource.Layout.file_selection_no_recent);
fileSelectButtons = (view.FileSelectButtons)FindViewById(Resource.Id.file_select);
}
View fnform = FindViewById(Resource.Id.filename_form);
fnform.Visibility = ViewStates.Gone;
Button openButton = (Button)FindViewById(Resource.Id.open);
Button createButton = (Button)FindViewById(Resource.Id.create);
TextView enterFilenameDetails = (TextView)FindViewById(Resource.Id.label_open_by_filename_details);
//OPEN FILE
Button openFileButton = (Button)FindViewById(Resource.Id.start_open_file);
EventHandler openFileButtonClick = (object sender, EventArgs e) =>
{
if (currentAction == CurrentAction.OpenFile)
return;
currentAction = CurrentAction.OpenFile;
fnform.Visibility = ViewStates.Visible;
openButton.Visibility = ViewStates.Visible;
createButton.Visibility = ViewStates.Gone;
// Set the initial value of the filename
EditText filename = (EditText)FindViewById(Resource.Id.file_filename);
filename.Text = Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path);
enterFilenameDetails.Text = "";//GetString(Resource.String.enter_filename_details_file);
enterFilenameDetails.Visibility = enterFilenameDetails.Text == "" ? ViewStates.Gone : ViewStates.Visible;
string defaultFilename = Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path);
string detailsText = "";
ShowFilenameDialog(true, false, true, defaultFilename, detailsText, Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN);
};
openFileButton.Click += openFileButtonClick;
//OPEN URL
@ -137,16 +251,7 @@ namespace keepass2android
EventHandler openUrlButtonClick = (object sender, EventArgs e) =>
{
if (currentAction == CurrentAction.OpenURL)
return;
currentAction = CurrentAction.OpenURL;
fnform.Visibility = ViewStates.Visible;
openButton.Visibility = ViewStates.Visible;
createButton.Visibility = ViewStates.Gone;
EditText filename = (EditText)FindViewById(Resource.Id.file_filename);
filename.Text = "";
enterFilenameDetails.Text = GetString(Resource.String.enter_filename_details_url);
enterFilenameDetails.Visibility = enterFilenameDetails.Text == "" ? ViewStates.Gone : ViewStates.Visible;
ShowFilenameDialog(true, false, false, "", GetString(Resource.String.enter_filename_details_url), Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN);
};
openUrlButton.Click += openUrlButtonClick;
@ -154,17 +259,7 @@ namespace keepass2android
Button createNewButton = (Button)FindViewById(Resource.Id.start_create);
EventHandler createNewButtonClick = (object sender, EventArgs e) =>
{
if (currentAction == CurrentAction.Create)
return;
currentAction = CurrentAction.Create;
fnform.Visibility = ViewStates.Visible;
openButton.Visibility = ViewStates.Gone;
createButton.Visibility = ViewStates.Visible;
// Set the initial value of the filename
EditText filename = (EditText)FindViewById(Resource.Id.file_filename);
filename.Text = Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path);
enterFilenameDetails.Text = "";//GetString(Resource.String.enter_filename_details_create);
enterFilenameDetails.Visibility = enterFilenameDetails.Text == "" ? ViewStates.Gone : ViewStates.Visible;
ShowFilenameDialog(false, true, true, Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path), "", Intents.REQUEST_CODE_FILE_BROWSE_FOR_CREATE);
};
createNewButton.Click += createNewButtonClick;
@ -172,10 +267,6 @@ namespace keepass2android
Button createImportButton = (Button)FindViewById(Resource.Id.start_create_import);
createImportButton.Click += (object sender, EventArgs e) =>
{
if (currentAction == CurrentAction.CreateImport)
return;
currentAction = CurrentAction.CreateImport;
fnform.Visibility = ViewStates.Visible;
openButton.Visibility = ViewStates.Gone;
createButton.Visibility = ViewStates.Visible;
enterFilenameDetails.Text = GetString(Resource.String.enter_filename_details_create_import);
@ -185,115 +276,6 @@ namespace keepass2android
filename.Text = Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path);
};*/
// Open button
openButton.Click += ( sender, evt) => {
String fileName = Util.getEditText(this, Resource.Id.file_filename);
IOConnectionInfo ioc = new IOConnectionInfo() {
Path = fileName
};
LaunchPasswordActivityForIoc(ioc);
};
// Create button
createButton.Click += (sender, evt) => {
String filename = Util.getEditText(this,
Resource.Id.file_filename);
//TODO: allow non-local files?
// Make sure file name exists
if (filename.Length == 0)
{
Toast
.MakeText(this,
Resource.String.error_filename_required,
ToastLength.Long).Show();
return;
}
// Try to create the file
Java.IO.File file = new Java.IO.File(filename);
try
{
if (file.Exists())
{
Toast.MakeText(this,
Resource.String.error_database_exists,
ToastLength.Long).Show();
return;
}
Java.IO.File parent = file.ParentFile;
if (parent == null || (parent.Exists() && ! parent.IsDirectory))
{
Toast.MakeText(this,
Resource.String.error_invalid_path,
ToastLength.Long).Show();
return;
}
if (! parent.Exists())
{
// Create parent dircetory
if (! parent.Mkdirs())
{
Toast.MakeText(this,
Resource.String.error_could_not_create_parent,
ToastLength.Long).Show();
return;
}
}
file.CreateNewFile();
} catch (Java.IO.IOException ex)
{
Toast.MakeText(
this,
GetText(Resource.String.error_file_not_create) + " "
+ ex.LocalizedMessage,
ToastLength.Long).Show();
return;
}
// Prep an object to collect a password once the database has
// been created
CollectPassword password = new CollectPassword(
new LaunchGroupActivity(IOConnectionInfo.FromPath(filename), this), this);
// Create the new database
CreateDB create = new CreateDB(this, IOConnectionInfo.FromPath(filename), password, true);
ProgressTask createTask = new ProgressTask(
this, create,
Resource.String.progress_create);
createTask.run();
};
Button cancelButton = (Button)FindViewById(Resource.Id.fnv_cancel);
cancelButton.Click += (sender, e) => {
currentAction = CurrentAction.None;
fnform.Visibility = ViewStates.Gone;
EditText editText = (EditText)FindViewById(Resource.Id.file_filename);
InputMethodManager imm = (InputMethodManager)GetSystemService(
Context.InputMethodService);
imm.HideSoftInputFromWindow(editText.WindowToken, 0);
};
ImageButton browseButton = (ImageButton)FindViewById(Resource.Id.browse_button);
browseButton.Click += (sender, evt) => {
string filename = Util.getEditText(this, Resource.Id.file_filename);
Util.showBrowseDialog(filename, this);
};
fillData();
@ -301,29 +283,18 @@ namespace keepass2android
if (savedInstanceState != null)
{
CurrentAction newCurrentAction = (CurrentAction)savedInstanceState.GetInt(BundleKey_CurrentAction, (int)currentAction);
mUrlToSearch = savedInstanceState.GetString(BundleKey_UrlToSearchFor, null);
recentMode = savedInstanceState.GetBoolean(BundleKey_RecentMode, recentMode);
if (newCurrentAction == CurrentAction.OpenFile)
{
openFileButtonClick(openFileButton, new EventArgs());
} else if (newCurrentAction == CurrentAction.OpenURL)
{
openUrlButtonClick(openUrlButton, new EventArgs());
} else if (newCurrentAction == CurrentAction.Create)
{
createNewButtonClick(createNewButton, new EventArgs());
}
}
}
protected override void OnSaveInstanceState(Bundle outState)
{
base.OnSaveInstanceState(outState);
outState.PutInt(BundleKey_CurrentAction, (int)currentAction);
outState.PutString(BundleKey_UrlToSearchFor, mUrlToSearch);
outState.PutBoolean(BundleKey_RecentMode, recentMode);
}
@ -387,6 +358,8 @@ namespace keepass2android
// Now create a simple cursor adapter and set it to display
SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
Resource.Layout.file_row, filesCursor, from, to);
ListAdapter = notes;
}
@ -456,7 +429,9 @@ namespace keepass2android
fillData();
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE && resultCode == Result.Ok) {
if ( (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_CREATE
|| requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN)
&& resultCode == Result.Ok) {
String filename = data.DataString;
if (filename != null) {
if (filename.StartsWith("file://")) {
@ -464,10 +439,20 @@ namespace keepass2android
}
filename = Java.Net.URLDecoder.Decode(filename);
EditText fn = (EditText) FindViewById(Resource.Id.file_filename);
fn.Text = filename;
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN)
{
IOConnectionInfo ioc = new IOConnectionInfo() {
Path = filename
};
LaunchPasswordActivityForIoc(ioc);
}
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_CREATE)
{
ShowFilenameDialog(false, true, true, filename, "", Intents.REQUEST_CODE_FILE_BROWSE_FOR_CREATE);
}
}
}
@ -488,8 +473,8 @@ namespace keepass2android
Finish();
}
view.FileNameView fnv = (view.FileNameView)FindViewById(Resource.Id.file_select);
fnv.updateExternalStorageWarning();
fileSelectButtons.updateExternalStorageWarning();
if (!createdWithActivityResult)
{

View File

@ -57,7 +57,7 @@ namespace keepass2android
iv.SetImageDrawable (draw);
}
private Drawable getIconDrawable (Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
public Drawable getIconDrawable (Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
{
if (customIconId != PwUuid.Zero) {
return getIconDrawable (res, db, customIconId);

View File

@ -38,7 +38,10 @@ namespace keepass2android
public const String CHECK_KEYBOARD = "keepass2android.check_keyboard";
public const String FILE_BROWSE = "org.openintents.action.PICK_FILE";
public const int REQUEST_CODE_FILE_BROWSE = 987321;
public const int REQUEST_CODE_FILE_BROWSE_FOR_OPEN = 987321;
public const int REQUEST_CODE_FILE_BROWSE_FOR_CREATE = 987322;
public const int REQUEST_CODE_FILE_BROWSE_FOR_BINARY = 987323;
public const int REQUEST_CODE_FILE_BROWSE_FOR_KEYFILE = 987324;
public const String SHOW_NOTIFICATION = "keepass2android.show_notification";
}

View File

@ -88,7 +88,6 @@
<Compile Include="Utils\Util.cs" />
<Compile Include="Utils\Interaction.cs" />
<Compile Include="intents\Intents.cs" />
<Compile Include="views\FileNameView.cs" />
<Compile Include="fileselect\BrowserDialog.cs" />
<Compile Include="timeout\TimeoutHelper.cs" />
<Compile Include="timers\Timeout.cs" />
@ -158,6 +157,8 @@
<Compile Include="services\QuickUnlockForegroundService.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="database\edit\DeleteRunnable.cs" />
<Compile Include="views\FileSelectButtons.cs" />
<Compile Include="EntryEditActivityState.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
@ -189,9 +190,6 @@
<None Include="settings\RoundsPreference %28Kopie%29.cs">
<Visible>False</Visible>
</None>
<None Include="Resources\layout-v11\entry_view_contents.xml">
<Visible>False</Visible>
</None>
<None Include="Resources\drawable\new_group.xcf">
<Visible>False</Visible>
</None>
@ -262,6 +260,24 @@
<None Include="..\java\kp2akeytransform\libs\mips\libfinal-key.so">
<Link>libs\mips\libfinal-key.so</Link>
</None>
<None Include="Resources\drawable-hdpi\Thumbs.db">
<Visible>False</Visible>
</None>
<None Include="Resources\drawable-ldpi\Thumbs.db">
<Visible>False</Visible>
</None>
<None Include="Resources\drawable-mdpi\Thumbs.db">
<Visible>False</Visible>
</None>
<None Include="Resources\drawable-xhdpi\Thumbs.db">
<Visible>False</Visible>
</None>
<None Include="Resources\drawable-xxhdpi\Thumbs.db">
<Visible>False</Visible>
</None>
<None Include="Resources\layout-v14\entry_view_contents.xml">
<Visible>False</Visible>
</None>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic00.png" />
@ -521,12 +537,9 @@
<AndroidResource Include="Resources\drawable-mdpi\ic_launcher.png" />
<AndroidResource Include="Resources\drawable-xhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\values-v11\styles.xml" />
<AndroidResource Include="Resources\values-v11\colors.xml" />
<AndroidResource Include="Resources\drawable\ic_action_eye_open.png" />
<AndroidResource Include="Resources\drawable-hdpi\ic_action_eye_open.png" />
<AndroidResource Include="Resources\drawable-mdpi\ic_action_eye_open.png" />
<AndroidResource Include="Resources\layout-v11\entry_view_contents.xml" />
<AndroidResource Include="Resources\layout\search.xml" />
<AndroidResource Include="Resources\drawable\ic_action_search.png" />
<AndroidResource Include="Resources\drawable-hdpi\ic_action_search.png" />
@ -585,6 +598,44 @@
<AndroidResource Include="Resources\drawable\ic_launcher_gray.png" />
<AndroidResource Include="Resources\drawable-hdpi\notify_keyboard.png" />
<AndroidResource Include="Resources\drawable\notify_keyboard.png" />
<AndroidResource Include="Resources\drawable\ic_menu_add_field_holo_light.png" />
<AndroidResource Include="Resources\drawable\ic_menu_remove_field_holo_light.png" />
<AndroidResource Include="Resources\drawable\navigation_cancel.png" />
<AndroidResource Include="Resources\values-v14\styles.xml" />
<AndroidResource Include="Resources\values-v14\colors.xml" />
<AndroidResource Include="Resources\layout-v14\entry_view_contents.xml" />
<AndroidResource Include="Resources\layout-v14\group_add_entry.xml" />
<AndroidResource Include="Resources\layout-v14\entry_view.xml" />
<AndroidResource Include="Resources\layout-v14\entry_edit.xml" />
<AndroidResource Include="Resources\layout-v14\SaveButton.xml" />
<AndroidResource Include="Resources\layout-v14\entry_edit_section.xml" />
<AndroidResource Include="Resources\layout-v14\generate_password.xml" />
<AndroidResource Include="Resources\layout-v14\icon_picker.xml" />
<AndroidResource Include="Resources\layout-v14\password.xml" />
<AndroidResource Include="Resources\layout\InViewButton.xml" />
<AndroidResource Include="Resources\drawable\collections_collection.png" />
<AndroidResource Include="Resources\drawable\collections_new_label.png" />
<AndroidResource Include="Resources\drawable\location_web_site.png" />
<AndroidResource Include="Resources\drawable-hdpi\collections_collection.png" />
<AndroidResource Include="Resources\drawable-hdpi\location_web_site.png" />
<AndroidResource Include="Resources\drawable-hdpi\collections_new_label.png" />
<AndroidResource Include="Resources\drawable-ldpi\collections_collection.png" />
<AndroidResource Include="Resources\drawable-ldpi\collections_new_label.png" />
<AndroidResource Include="Resources\drawable-ldpi\location_web_site.png" />
<AndroidResource Include="Resources\drawable-mdpi\collections_collection.png" />
<AndroidResource Include="Resources\drawable-mdpi\collections_new_label.png" />
<AndroidResource Include="Resources\drawable-mdpi\location_web_site.png" />
<AndroidResource Include="Resources\layout\file_selection_buttons.xml" />
<AndroidResource Include="Resources\drawable\device_access_not_secure.png" />
<AndroidResource Include="Resources\drawable-hdpi\device_access_not_secure.png" />
<AndroidResource Include="Resources\drawable-hdpi\ic_menu_remove_field_holo_light.png" />
<AndroidResource Include="Resources\drawable-ldpi\device_access_not_secure.png" />
<AndroidResource Include="Resources\drawable-ldpi\ic_menu_remove_field_holo_light.png" />
<AndroidResource Include="Resources\drawable-mdpi\device_access_not_secure.png" />
<AndroidResource Include="Resources\layout-v14\QuickUnlock_Unused.xml" />
<AndroidResource Include="Resources\layout\entry_view_test.xml" />
<AndroidResource Include="Resources\layout\entry_extrastring_title.xml" />
<AndroidResource Include="Resources\layout\entry_extrastring_value.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<ItemGroup>
@ -603,14 +654,12 @@
<Folder Include="settings\" />
<Folder Include="password\" />
<Folder Include="compat\" />
<Folder Include="Resources\layout-v11\" />
<Folder Include="Resources\menu-v11\" />
<Folder Include="Resources\drawable-hdpi\" />
<Folder Include="Resources\drawable-ldpi\" />
<Folder Include="Resources\drawable-mdpi\" />
<Folder Include="Resources\drawable-xhdpi\" />
<Folder Include="Resources\drawable-xxhdpi\" />
<Folder Include="Resources\values-v11\" />
<Folder Include="Resources\drawable-v11\" />
<Folder Include="Resources\values-de\" />
<Folder Include="Resources\values-ca\" />
@ -636,6 +685,8 @@
<Folder Include="libs\armeabi-v7a\" />
<Folder Include="libs\armeabi\" />
<Folder Include="libs\mips\" />
<Folder Include="Resources\values-v14\" />
<Folder Include="Resources\layout-v14\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">

View File

@ -31,7 +31,7 @@ using keepass2android.search;
namespace keepass2android
{
[Activity (Label = "@string/short_app_name", Theme="@style/Base")]
[Activity (Label = "@string/app_name", Theme="@style/Base")]
public class SearchActivity : LifecycleDebugActivity
{
bool GetCheckBoxValue(int resId)
@ -63,8 +63,6 @@ namespace keepass2android
ImageButton btnSearch = (ImageButton)FindViewById(Resource.Id.search_button);
//TODO: "Enter"-Key should run the search
btnSearch.Click += (object sender, EventArgs e) =>
{
PerformSearch();

View File

@ -54,11 +54,13 @@ namespace keepass2android.search
if ( ! mDb.Open ) {
Finish();
}
query(getSearch(Intent));
}
private void query (SearchParameters searchParams)
{
try {

View File

@ -92,7 +92,33 @@ namespace keepass2android
ProgressTask pt = new ProgressTask(this, save, Resource.String.saving_database);
pt.run();
};
Preference databaseName = FindPreference(GetString(Resource.String.database_name_key));
((EditTextPreference)databaseName).EditText.Text = db.pm.Name;
((EditTextPreference)databaseName).Text = db.pm.Name;
databaseName.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
{
DateTime previousNameChanged = db.pm.NameChanged;
String previousName = db.pm.Name;
db.pm.Name = e.NewValue.ToString();
Handler handler = new Handler();
SaveDB save = new SaveDB(this, App.getDB(), new ActionOnFinish( (success, message) =>
{
if (!success)
{
db.pm.Name = previousName;
db.pm.NameChanged = previousNameChanged;
Toast.MakeText(this, message, ToastLength.Long).Show();
}
}));
ProgressTask pt = new ProgressTask(this, save, Resource.String.saving_database);
pt.run();
};
setRounds(db, rounds);
Preference algorithm = FindPreference(GetString(Resource.String.algorithm_key));

View File

@ -31,7 +31,7 @@ using KeePassLib.Security;
namespace keepass2android.view
{
public class EntryEditSection : RelativeLayout
public class EntryEditSection : LinearLayout
{
public event EventHandler ContentChanged;
@ -58,15 +58,20 @@ namespace keepass2android.view
}
public void setData(String title, ProtectedString value) {
public void setData(String title, ProtectedString value)
{
setText(Resource.Id.title, title);
setText(Resource.Id.value, value.ReadString());
CheckBox cb = (CheckBox) FindViewById(Resource.Id.protection);
cb.Checked = value.IsProtected;
cb.CheckedChange += (sender, e) => {if (ContentChanged != null)
ContentChanged(this, new EventArgs());
};
CheckBox cb = (CheckBox)FindViewById(Resource.Id.protection);
if (cb != null)
{
cb.Checked = value.IsProtected;
cb.CheckedChange += (sender, e) => {
if (ContentChanged != null)
ContentChanged(this, new EventArgs());
};
}
}
public ImageButton getDeleteButton()

View File

@ -58,7 +58,12 @@ namespace keepass2android.view
inflater.Inflate(Resource.Layout.entry_section, this);
setText(Resource.Id.title, title);
FindViewById<TextView>(Resource.Id.value).Invalidate();
setText(Resource.Id.value, value);
//TODO: this seems to cause a bug when rotating the device (and the activity gets destroyed)
//After recreating the activity, the value fields all have the same content.
FindViewById<TextView>(Resource.Id.value).SetTextIsSelectable(true);
}
private void setText(int resId, String str) {

View File

@ -1,81 +1,80 @@
/*
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace keepass2android.view
{
public class FileNameView : RelativeLayout {
public FileNameView(Context context):this(context,null) {
}
public FileNameView(Context context, Android.Util.IAttributeSet attrs)
:base(context, attrs)
{
inflate(context);
}
public FileNameView (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}
private void inflate(Context context) {
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
inflater.Inflate(Resource.Layout.file_selection_filename, this);
}
public void updateExternalStorageWarning() {
int warning = -1;
String state = Android.OS.Environment.ExternalStorageState;
if (state.Equals(Android.OS.Environment.MediaMountedReadOnly)) {
warning = Resource.String.warning_read_only;
} else if (!state.Equals(Android.OS.Environment.MediaMounted)) {
warning = Resource.String.warning_unmounted;
}
TextView tv = (TextView) FindViewById(Resource.Id.label_warning);
TextView label = (TextView) FindViewById(Resource.Id.label_open_by_filename);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FillParent, LayoutParams.WrapContent);
if (warning != -1) {
tv.SetText(warning);
tv.Visibility = ViewStates.Visible;
lp.AddRule(LayoutRules.Below, Resource.Id.label_warning);
} else {
tv.Visibility = ViewStates.Invisible;
}
label.LayoutParameters = lp;
}
}
}
/*
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
Keepass2Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Keepass2Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace keepass2android.view
{
public class FileSelectButtons : RelativeLayout {
public FileSelectButtons(Context context):this(context,null) {
}
public FileSelectButtons(Context context, Android.Util.IAttributeSet attrs)
:base(context, attrs)
{
inflate(context);
}
public FileSelectButtons (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}
private void inflate(Context context) {
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
inflater.Inflate(Resource.Layout.file_selection_buttons, this);
}
public void updateExternalStorageWarning() {
int warning = -1;
String state = Android.OS.Environment.ExternalStorageState;
if (state.Equals(Android.OS.Environment.MediaMountedReadOnly)) {
warning = Resource.String.warning_read_only;
} else if (!state.Equals(Android.OS.Environment.MediaMounted)) {
warning = Resource.String.warning_unmounted;
}
TextView tv = (TextView) FindViewById(Resource.Id.label_warning);
if (warning != -1) {
tv.SetText(warning);
tv.Visibility = ViewStates.Visible;
} else {
tv.Visibility = ViewStates.Invisible;
}
}
}
}

View File

@ -62,7 +62,7 @@ namespace keepass2android.view
LayoutInflater inflater = (LayoutInflater) Context.GetSystemService(Context.LayoutInflaterService);
inflater.Inflate(Resource.Layout.group_add_entry, this);
Button addEntry = (Button) FindViewById(Resource.Id.add_entry);
View addEntry = FindViewById(Resource.Id.add_entry);
addEntry.Visibility = ViewStates.Invisible;
}

View File

@ -59,6 +59,8 @@ namespace keepass2android.view
View divider2 = FindViewById(Resource.Id.divider2);
divider2.Visibility = ViewStates.Invisible;
FindViewById(Resource.Id.bottom_bar).Visibility = ViewStates.Invisible;
View list = FindViewById(Android.Resource.Id.List);
LayoutParams lp = (RelativeLayout.LayoutParams) list.LayoutParameters;