Merge branch 'UITesting'
Conflicts: .gitignore src/KeePass.sln src/keepass2android/EntryActivity.cs src/keepass2android/Resources/Resource.designer.cs src/keepass2android/keepass2android.csproj
1
.gitignore
vendored
@ -25,3 +25,4 @@
|
|||||||
/src/java/KP2ASoftKeyboard/gen
|
/src/java/KP2ASoftKeyboard/gen
|
||||||
/src/java/KP2ASoftKeyboard/projectzip
|
/src/java/KP2ASoftKeyboard/projectzip
|
||||||
/src/java/KP2ASoftKeyboard/createProjectZip.bat
|
/src/java/KP2ASoftKeyboard/createProjectZip.bat
|
||||||
|
Thumbs.db
|
||||||
|
95
src/KeyValueTest/Activity1.cs
Normal 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"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
19
src/KeyValueTest/Assets/AboutAssets.txt
Normal 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");
|
75
src/KeyValueTest/EntrySection.cs
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
69
src/KeyValueTest/KeyValueTest.csproj
Normal 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>
|
28
src/KeyValueTest/Properties/AssemblyInfo.cs
Normal 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("")]
|
||||||
|
|
44
src/KeyValueTest/Resources/AboutResources.txt
Normal 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.
|
109
src/KeyValueTest/Resources/Resource.designer.cs
generated
Normal 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
|
BIN
src/KeyValueTest/Resources/drawable/Icon.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
12
src/KeyValueTest/Resources/layout-v14/Main.axml
Normal 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>
|
17
src/KeyValueTest/Resources/layout-v14/entry_section.xml
Normal 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>
|
49
src/KeyValueTest/Resources/layout/Main.axml
Normal 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>
|
18
src/KeyValueTest/Resources/layout/entry_section.xml
Normal 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>
|
5
src/KeyValueTest/Resources/values/Strings.xml
Normal 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>
|
@ -38,6 +38,7 @@ using Android.Content.PM;
|
|||||||
using KeePassLib.Security;
|
using KeePassLib.Security;
|
||||||
using keepass2android.view;
|
using keepass2android.view;
|
||||||
using Android.Webkit;
|
using Android.Webkit;
|
||||||
|
using Android.Graphics;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
@ -76,7 +77,7 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setupEditButtons() {
|
protected void setupEditButtons() {
|
||||||
Button edit = (Button) FindViewById(Resource.Id.entry_edit);
|
View edit = FindViewById(Resource.Id.entry_edit);
|
||||||
edit.Click += (sender, e) => {
|
edit.Click += (sender, e) => {
|
||||||
EntryEditActivity.Launch(this, mEntry);
|
EntryEditActivity.Launch(this, mEntry);
|
||||||
};
|
};
|
||||||
@ -206,7 +207,8 @@ namespace keepass2android
|
|||||||
String key = pair.Key;
|
String key = pair.Key;
|
||||||
if (!PwDefs.IsStandardField(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);
|
extraGroup.AddView(view);
|
||||||
hasExtraFields = true;
|
hasExtraFields = true;
|
||||||
}
|
}
|
||||||
@ -214,6 +216,28 @@ namespace keepass2android
|
|||||||
FindViewById(Resource.Id.entry_extra_strings_label).Visibility = hasExtraFields ? ViewStates.Visible : ViewStates.Gone;
|
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)
|
string writeBinaryToFile(string key)
|
||||||
{
|
{
|
||||||
ProtectedBinary pb = mEntry.Binaries.Get(key);
|
ProtectedBinary pb = mEntry.Binaries.Get(key);
|
||||||
@ -333,14 +357,24 @@ namespace keepass2android
|
|||||||
protected void fillData(bool trimList)
|
protected void fillData(bool trimList)
|
||||||
{
|
{
|
||||||
ImageView iv = (ImageView)FindViewById(Resource.Id.entry_icon);
|
ImageView iv = (ImageView)FindViewById(Resource.Id.entry_icon);
|
||||||
|
if (iv != null)
|
||||||
|
{
|
||||||
App.getDB().drawFactory.assignDrawableTo(iv, Resources, App.getDB().pm, mEntry.IconId, mEntry.CustomIconUuid);
|
App.getDB().drawFactory.assignDrawableTo(iv, Resources, App.getDB().pm, mEntry.IconId, mEntry.CustomIconUuid);
|
||||||
|
}
|
||||||
|
|
||||||
//populateText(Resource.Id.entry_title, mEntry.Strings.ReadSafe(PwDefs.TitleField));
|
//populateText(Resource.Id.entry_title, mEntry.Strings.ReadSafe(PwDefs.TitleField));
|
||||||
var button = ((Button)FindViewById(Resource.Id.entry_title));
|
var button = ((Button)FindViewById(Resource.Id.entry_title));
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
button.Text = mEntry.Strings.ReadSafe(PwDefs.TitleField);
|
button.Text = mEntry.Strings.ReadSafe(PwDefs.TitleField);
|
||||||
button.Click += (object sender, EventArgs e) => {
|
button.Click += (object sender, EventArgs e) => {
|
||||||
Finish(); };
|
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_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));
|
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();
|
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||||
}
|
}
|
||||||
return true;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,16 +45,14 @@ namespace keepass2android
|
|||||||
|
|
||||||
public const int RESULT_OK_ICON_PICKER = (int)Result.FirstUser + 1000;
|
public const int RESULT_OK_ICON_PICKER = (int)Result.FirstUser + 1000;
|
||||||
public const int RESULT_OK_PASSWORD_GENERATOR = RESULT_OK_ICON_PICKER + 1;
|
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) {
|
public static void Launch(Activity act, PwEntry pw) {
|
||||||
Intent i = new Intent(act, typeof(EntryEditActivity));
|
Intent i = new Intent(act, typeof(EntryEditActivity));
|
||||||
|
|
||||||
@ -73,41 +71,63 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ScrollView scroll;
|
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);
|
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);
|
SetContentView(Resource.Layout.entry_edit);
|
||||||
SetResult(KeePass.EXIT_NORMAL);
|
mCloseForReload = false;
|
||||||
|
|
||||||
// Likely the app has been killed exit the activity
|
// Likely the app has been killed exit the activity
|
||||||
Database db = App.getDB();
|
Database db = App.getDB();
|
||||||
if ( ! db.Open ) {
|
if (! db.Open)
|
||||||
|
{
|
||||||
Finish();
|
Finish();
|
||||||
return;
|
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;
|
Intent i = Intent;
|
||||||
String uuidBytes = i.GetStringExtra(KEY_ENTRY);
|
String uuidBytes = i.GetStringExtra(KEY_ENTRY);
|
||||||
|
|
||||||
PwUuid entryId = PwUuid.Zero;
|
PwUuid entryId = PwUuid.Zero;
|
||||||
if (uuidBytes != null)
|
if (uuidBytes != null)
|
||||||
entryId = new KeePassLib.PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
|
entryId = new KeePassLib.PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
|
||||||
|
|
||||||
PwGroup parentGroup = null;
|
State.parentGroup = null;
|
||||||
if ( entryId == PwUuid.Zero ) {
|
if (entryId == PwUuid.Zero)
|
||||||
String groupId = i.GetStringExtra(KEY_PARENT);
|
{
|
||||||
|
String groupId = i.GetStringExtra(KEY_PARENT);
|
||||||
parentGroup = db.groups[new PwUuid(MemUtil.HexStringToByteArray(groupId))];
|
|
||||||
|
State.parentGroup = db.groups [new PwUuid(MemUtil.HexStringToByteArray(groupId))];
|
||||||
mEntryInDatabase = new PwEntry(true, true);
|
|
||||||
mEntryInDatabase.Strings.Set(PwDefs.UserNameField, new ProtectedString(
|
State.mEntryInDatabase = new PwEntry(true, true);
|
||||||
db.pm.MemoryProtection.ProtectUserName, db.pm.DefaultUserName));
|
State.mEntryInDatabase.Strings.Set(PwDefs.UserNameField, new ProtectedString(
|
||||||
|
db.pm.MemoryProtection.ProtectUserName, db.pm.DefaultUserName));
|
||||||
/*KPDesktop
|
|
||||||
|
/*KPDesktop
|
||||||
* ProtectedString psAutoGen;
|
* ProtectedString psAutoGen;
|
||||||
PwGenerator.Generate(out psAutoGen, Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile,
|
PwGenerator.Generate(out psAutoGen, Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile,
|
||||||
null, Program.PwGeneratorPool);
|
null, Program.PwGeneratorPool);
|
||||||
@ -120,15 +140,15 @@ namespace keepass2android
|
|||||||
pwe.Expires = true;
|
pwe.Expires = true;
|
||||||
pwe.ExpiryTime = DateTime.Now.AddDays(nExpireDays);
|
pwe.ExpiryTime = DateTime.Now.AddDays(nExpireDays);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if((parentGroup.IconId != PwIcon.Folder) && (parentGroup.IconId != PwIcon.FolderOpen) &&
|
if ((State.parentGroup.IconId != PwIcon.Folder) && (State.parentGroup.IconId != PwIcon.FolderOpen) &&
|
||||||
(parentGroup.IconId != PwIcon.FolderPackage))
|
(State.parentGroup.IconId != PwIcon.FolderPackage))
|
||||||
{
|
{
|
||||||
mEntryInDatabase.IconId = parentGroup.IconId; // Inherit icon from group
|
State.mEntryInDatabase.IconId = State.parentGroup.IconId; // Inherit icon from group
|
||||||
}
|
}
|
||||||
mEntryInDatabase.CustomIconUuid = parentGroup.CustomIconUuid;
|
State.mEntryInDatabase.CustomIconUuid = State.parentGroup.CustomIconUuid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* KPDesktop
|
* KPDesktop
|
||||||
if(strDefaultSeq.Length == 0)
|
if(strDefaultSeq.Length == 0)
|
||||||
{
|
{
|
||||||
@ -146,35 +166,51 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
mIsNew = true;
|
State.mIsNew = true;
|
||||||
mEntryModified = true;
|
State.mEntryModified = true;
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
System.Diagnostics.Debug.Assert(entryId != null);
|
|
||||||
|
System.Diagnostics.Debug.Assert(entryId != null);
|
||||||
mEntryInDatabase = db.entries[entryId];
|
|
||||||
mIsNew = false;
|
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();
|
fillData();
|
||||||
View scrollView = FindViewById(Resource.Id.entry_scroll);
|
View scrollView = FindViewById(Resource.Id.entry_scroll);
|
||||||
scrollView.ScrollBarStyle = ScrollbarStyles.InsideInset;
|
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) => {
|
iconButton.Click += (sender, evt) => {
|
||||||
|
UpdateEntryFromUi(State.mEntry);
|
||||||
IconPickerActivity.Launch(this);
|
IconPickerActivity.Launch(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Generate password button
|
// 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) => {
|
generatePassword.Click += (object sender, EventArgs e) => {
|
||||||
|
UpdateEntryFromUi(State.mEntry);
|
||||||
GeneratePasswordActivity.Launch(this);
|
GeneratePasswordActivity.Launch(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,164 +218,30 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
// Save button
|
// 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) =>
|
save.Click += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
|
OnFinish onFinish = new AfterSave(new Handler(), this);
|
||||||
EntryEditActivity act = this;
|
|
||||||
|
|
||||||
if (!validateBeforeSaving())
|
|
||||||
return;
|
|
||||||
|
|
||||||
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
|
// Respect mask password setting
|
||||||
if (mShowPassword) {
|
if (State.mShowPassword) {
|
||||||
EditText pass = (EditText) FindViewById(Resource.Id.entry_password);
|
EditText pass = (EditText) FindViewById(Resource.Id.entry_password);
|
||||||
EditText conf = (EditText) FindViewById(Resource.Id.entry_confpassword);
|
EditText conf = (EditText) FindViewById(Resource.Id.entry_confpassword);
|
||||||
|
|
||||||
@ -354,41 +256,224 @@ namespace keepass2android
|
|||||||
addButton.Click += (object sender, EventArgs e) =>
|
addButton.Click += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
||||||
|
|
||||||
EntryEditSection ees = (EntryEditSection) LayoutInflater.Inflate(Resource.Layout.entry_edit_section, null);
|
KeyValuePair<string, ProtectedString> pair = new KeyValuePair<string, ProtectedString>("" , new ProtectedString(true, ""));
|
||||||
ees.setData("", new ProtectedString(false, ""));
|
LinearLayout ees = CreateExtraStringView(pair);
|
||||||
ees.getDeleteButton().Click += (senderEes, eEes) => deleteAdvancedString((View)senderEes);
|
|
||||||
container.AddView(ees);
|
container.AddView(ees);
|
||||||
|
|
||||||
mEntryModified = true;
|
State.mEntryModified = true;
|
||||||
|
|
||||||
// Scroll bottom
|
TextView keyView = (TextView) ees.FindViewById(Resource.Id.title);
|
||||||
scroll.Post(() => {
|
keyView.RequestFocus();
|
||||||
scroll.FullScroll(FocusSearchDirection.Down);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
((CheckBox)FindViewById(Resource.Id.entry_expires_checkbox)).CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) =>
|
((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 (e.IsChecked)
|
||||||
{
|
{
|
||||||
if (mEntry.ExpiryTime < DateTime.Now)
|
if (State.mEntry.ExpiryTime < DateTime.Now)
|
||||||
mEntry.ExpiryTime = DateTime.Now;
|
State.mEntry.ExpiryTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
updateExpires();
|
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)
|
void addBinaryOrAsk(string filename)
|
||||||
{
|
{
|
||||||
string strItem = UrlUtil.GetFileName(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);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.SetTitle(GetString(Resource.String.AskOverwriteBinary_title));
|
builder.SetTitle(GetString(Resource.String.AskOverwriteBinary_title));
|
||||||
@ -429,7 +514,7 @@ namespace keepass2android
|
|||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
string strNewName = strFileName + nTry.ToString() + strExtension;
|
string strNewName = strFileName + nTry.ToString() + strExtension;
|
||||||
if(mEntry.Binaries.Get(strNewName) == null)
|
if(State.mEntry.Binaries.Get(strNewName) == null)
|
||||||
{
|
{
|
||||||
strItem = strNewName;
|
strItem = strNewName;
|
||||||
break;
|
break;
|
||||||
@ -444,20 +529,20 @@ namespace keepass2android
|
|||||||
if(vBytes != null)
|
if(vBytes != null)
|
||||||
{
|
{
|
||||||
ProtectedBinary pb = new ProtectedBinary(false, vBytes);
|
ProtectedBinary pb = new ProtectedBinary(false, vBytes);
|
||||||
mEntry.Binaries.Set(strItem, pb);
|
State.mEntry.Binaries.Set(strItem, pb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception exAttach)
|
catch(Exception exAttach)
|
||||||
{
|
{
|
||||||
Toast.MakeText(this, GetString(Resource.String.AttachFailed)+" "+exAttach.Message, ToastLength.Long).Show();
|
Toast.MakeText(this, GetString(Resource.String.AttachFailed)+" "+exAttach.Message, ToastLength.Long).Show();
|
||||||
}
|
}
|
||||||
mEntryModified = true;
|
State.mEntryModified = true;
|
||||||
populateBinaries();
|
populateBinaries();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnBackPressed()
|
public override void OnBackPressed()
|
||||||
{
|
{
|
||||||
if (mEntryModified == false)
|
if (State.mEntryModified == false)
|
||||||
{
|
{
|
||||||
base.OnBackPressed();
|
base.OnBackPressed();
|
||||||
} else
|
} 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)
|
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||||
{
|
{
|
||||||
switch ((int)resultCode)
|
switch ((int)resultCode)
|
||||||
{
|
{
|
||||||
case RESULT_OK_ICON_PICKER:
|
case RESULT_OK_ICON_PICKER:
|
||||||
mSelectedIconID = (PwIcon) data.Extras.GetInt(IconPickerActivity.KEY_ICON_ID);
|
State.mSelectedIconID = (PwIcon) data.Extras.GetInt(IconPickerActivity.KEY_ICON_ID);
|
||||||
mSelectedCustomIconID = PwUuid.Zero;
|
State.mSelectedCustomIconID = PwUuid.Zero;
|
||||||
String customIconIdString = data.Extras.GetString(IconPickerActivity.KEY_CUSTOM_ICON_ID);
|
String customIconIdString = data.Extras.GetString(IconPickerActivity.KEY_CUSTOM_ICON_ID);
|
||||||
if (!String.IsNullOrEmpty(customIconIdString))
|
if (!String.IsNullOrEmpty(customIconIdString))
|
||||||
mSelectedCustomIconID = new PwUuid(MemUtil.HexStringToByteArray(customIconIdString));
|
State.mSelectedCustomIconID = new PwUuid(MemUtil.HexStringToByteArray(customIconIdString));
|
||||||
mSelectedIcon = true;
|
State.mSelectedIcon = true;
|
||||||
ImageButton currIconButton = (ImageButton) FindViewById(Resource.Id.icon_button);
|
State.mEntryModified = true;
|
||||||
//TODO: custom image
|
reload();
|
||||||
currIconButton.SetImageResource(Icons.iconToResId(mSelectedIconID));
|
|
||||||
mEntryModified = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESULT_OK_PASSWORD_GENERATOR:
|
case RESULT_OK_PASSWORD_GENERATOR:
|
||||||
String generatedPassword = data.GetStringExtra("keepass2android.password.generated_password");
|
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;
|
byte[] password = StrUtil.Utf8.GetBytes(generatedPassword);
|
||||||
confPassword.Text = generatedPassword;
|
State.mEntry.Strings.Set(PwDefs.PasswordField, new ProtectedString(App.getDB().pm.MemoryProtection.ProtectPassword,
|
||||||
mEntryModified = true;
|
password));
|
||||||
|
MemUtil.ZeroByteArray(password);
|
||||||
|
|
||||||
|
State.mEntryModified = true;
|
||||||
|
reload();
|
||||||
break;
|
break;
|
||||||
case (int)Result.Ok:
|
case (int)Result.Ok:
|
||||||
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE)
|
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_BINARY)
|
||||||
{
|
{
|
||||||
String filename = data.DataString;
|
String filename = data.DataString;
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
@ -524,10 +624,12 @@ namespace keepass2android
|
|||||||
addBinaryOrAsk(filename);
|
addBinaryOrAsk(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reload();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (int)Result.Canceled:
|
case (int)Result.Canceled:
|
||||||
|
reload();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -539,7 +641,7 @@ namespace keepass2android
|
|||||||
ViewGroup binariesGroup = (ViewGroup)FindViewById(Resource.Id.binaries);
|
ViewGroup binariesGroup = (ViewGroup)FindViewById(Resource.Id.binaries);
|
||||||
binariesGroup.RemoveAllViews();
|
binariesGroup.RemoveAllViews();
|
||||||
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.WrapContent);
|
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;
|
String key = pair.Key;
|
||||||
Button binaryButton = new Button(this);
|
Button binaryButton = new Button(this);
|
||||||
@ -548,9 +650,9 @@ namespace keepass2android
|
|||||||
binaryButton.SetCompoundDrawablesWithIntrinsicBounds( Resources.GetDrawable(Android.Resource.Drawable.IcMenuDelete),null, null, null);
|
binaryButton.SetCompoundDrawablesWithIntrinsicBounds( Resources.GetDrawable(Android.Resource.Drawable.IcMenuDelete),null, null, null);
|
||||||
binaryButton.Click += (object sender, EventArgs e) =>
|
binaryButton.Click += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
mEntryModified = true;
|
State.mEntryModified = true;
|
||||||
Button btnSender = (Button)(sender);
|
Button btnSender = (Button)(sender);
|
||||||
mEntry.Binaries.Remove(key);
|
State.mEntry.Binaries.Remove(key);
|
||||||
populateBinaries();
|
populateBinaries();
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -564,11 +666,14 @@ namespace keepass2android
|
|||||||
addBinaryButton.SetCompoundDrawablesWithIntrinsicBounds( Resources.GetDrawable(Android.Resource.Drawable.IcMenuAdd) , null, null, null);
|
addBinaryButton.SetCompoundDrawablesWithIntrinsicBounds( Resources.GetDrawable(Android.Resource.Drawable.IcMenuAdd) , null, null, null);
|
||||||
addBinaryButton.Click += (object sender, EventArgs e) =>
|
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);
|
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) {
|
public override bool OnCreateOptionsMenu(IMenu menu) {
|
||||||
base.OnCreateOptionsMenu(menu);
|
base.OnCreateOptionsMenu(menu);
|
||||||
@ -578,7 +683,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
IMenuItem togglePassword = menu.FindItem(Resource.Id.menu_toggle_pass);
|
IMenuItem togglePassword = menu.FindItem(Resource.Id.menu_toggle_pass);
|
||||||
if ( mShowPassword ) {
|
if ( State.mShowPassword ) {
|
||||||
togglePassword.SetTitle(Resource.String.menu_hide_password);
|
togglePassword.SetTitle(Resource.String.menu_hide_password);
|
||||||
} else {
|
} else {
|
||||||
togglePassword.SetTitle(Resource.String.show_password);
|
togglePassword.SetTitle(Resource.String.show_password);
|
||||||
@ -599,12 +704,12 @@ namespace keepass2android
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
case Resource.Id.menu_toggle_pass:
|
case Resource.Id.menu_toggle_pass:
|
||||||
if ( mShowPassword ) {
|
if ( State.mShowPassword ) {
|
||||||
item.SetTitle(Resource.String.show_password);
|
item.SetTitle(Resource.String.show_password);
|
||||||
mShowPassword = false;
|
State.mShowPassword = false;
|
||||||
} else {
|
} else {
|
||||||
item.SetTitle(Resource.String.menu_hide_password);
|
item.SetTitle(Resource.String.menu_hide_password);
|
||||||
mShowPassword = true;
|
State.mShowPassword = true;
|
||||||
}
|
}
|
||||||
setPasswordStyle();
|
setPasswordStyle();
|
||||||
return true;
|
return true;
|
||||||
@ -644,7 +749,7 @@ namespace keepass2android
|
|||||||
TextView password = (TextView) FindViewById(Resource.Id.entry_password);
|
TextView password = (TextView) FindViewById(Resource.Id.entry_password);
|
||||||
TextView confpassword = (TextView) FindViewById(Resource.Id.entry_confpassword);
|
TextView confpassword = (TextView) FindViewById(Resource.Id.entry_confpassword);
|
||||||
|
|
||||||
if ( mShowPassword ) {
|
if ( State.mShowPassword ) {
|
||||||
password.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
|
password.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
|
||||||
confpassword.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
|
confpassword.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword;
|
||||||
|
|
||||||
@ -656,52 +761,75 @@ namespace keepass2android
|
|||||||
|
|
||||||
void updateExpires()
|
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
|
else
|
||||||
{
|
{
|
||||||
populateText(Resource.Id.entry_expires, GetString(Resource.String.never));
|
populateText(Resource.Id.entry_expires, GetString(Resource.String.never));
|
||||||
}
|
}
|
||||||
((CheckBox)FindViewById(Resource.Id.entry_expires_checkbox)).Checked = mEntry.Expires;
|
((CheckBox)FindViewById(Resource.Id.entry_expires_checkbox)).Checked = State.mEntry.Expires;
|
||||||
((EditText)FindViewById(Resource.Id.entry_expires)).Enabled = 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() {
|
private void fillData() {
|
||||||
ImageButton currIconButton = (ImageButton) FindViewById(Resource.Id.icon_button);
|
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_title, State.mEntry.Strings.ReadSafe (PwDefs.TitleField));
|
||||||
populateText(Resource.Id.entry_user_name, mEntry.Strings.ReadSafe (PwDefs.UserNameField));
|
populateText(Resource.Id.entry_user_name, State.mEntry.Strings.ReadSafe (PwDefs.UserNameField));
|
||||||
populateText(Resource.Id.entry_url, mEntry.Strings.ReadSafe (PwDefs.UrlField));
|
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_password, password);
|
||||||
populateText(Resource.Id.entry_confpassword, password);
|
populateText(Resource.Id.entry_confpassword, password);
|
||||||
setPasswordStyle();
|
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);
|
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;
|
String key = pair.Key;
|
||||||
|
|
||||||
if (!PwDefs.IsStandardField(key)) {
|
if (!PwDefs.IsStandardField(key)) {
|
||||||
EntryEditSection ees = (EntryEditSection) LayoutInflater.Inflate(Resource.Layout.entry_edit_section, null);
|
var ees = CreateExtraStringView(pair);
|
||||||
ees.setData(key, pair.Value);
|
|
||||||
ees.ContentChanged += (sender, e) => {mEntryModified=true;};
|
|
||||||
ees.getDeleteButton().Click += (sender, e) => deleteAdvancedString((View)sender);
|
|
||||||
container.AddView(ees);
|
container.AddView(ees);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
populateBinaries();
|
populateBinaries();
|
||||||
|
|
||||||
populateText(Resource.Id.entry_override_url, mEntry.OverrideUrl);
|
populateText(Resource.Id.entry_override_url, State.mEntry.OverrideUrl);
|
||||||
populateText(Resource.Id.entry_tags, StrUtil.TagsToString(mEntry.Tags, true));
|
populateText(Resource.Id.entry_tags, StrUtil.TagsToString(State.mEntry.Tags, true));
|
||||||
|
|
||||||
updateExpires();
|
updateExpires();
|
||||||
}
|
}
|
||||||
@ -711,11 +839,11 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
public void deleteAdvancedString(View view) {
|
public void deleteAdvancedString(View view) {
|
||||||
EntryEditSection section = (EntryEditSection) view.Parent;
|
var section = view.Parent;
|
||||||
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
||||||
mEntryModified = true;
|
State.mEntryModified = true;
|
||||||
for (int i = 0; i < container.ChildCount; i++) {
|
for (int i = 0; i < container.ChildCount; i++) {
|
||||||
EntryEditSection ees = (EntryEditSection) container.GetChildAt(i);
|
var ees = container.GetChildAt(i);
|
||||||
if (ees == section) {
|
if (ees == section) {
|
||||||
container.RemoveViewAt(i);
|
container.RemoveViewAt(i);
|
||||||
container.Invalidate();
|
container.Invalidate();
|
||||||
@ -743,20 +871,20 @@ namespace keepass2android
|
|||||||
|
|
||||||
// Validate expiry date
|
// Validate expiry date
|
||||||
DateTime newExpiry = new DateTime();
|
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();
|
Toast.MakeText(this, Resource.String.error_invalid_expiry_date, ToastLength.Long).Show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mEntry.ExpiryTime = newExpiry;
|
State.mEntry.ExpiryTime = newExpiry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
||||||
for (int i = 0; i < container.ChildCount; i++) {
|
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);
|
TextView keyView = (TextView) ees.FindViewById(Resource.Id.title);
|
||||||
string key = keyView.Text;
|
string key = keyView.Text;
|
||||||
@ -775,9 +903,18 @@ namespace keepass2android
|
|||||||
private void populateText(int viewId, String text) {
|
private void populateText(int viewId, String text) {
|
||||||
TextView tv = (TextView) FindViewById(viewId);
|
TextView tv = (TextView) FindViewById(viewId);
|
||||||
tv.Text = text;
|
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 {
|
private class AfterSave : OnFinish {
|
||||||
Activity act;
|
Activity act;
|
||||||
public AfterSave(Handler handler, Activity act): base(handler) {
|
public AfterSave(Handler handler, Activity act): base(handler) {
|
||||||
|
37
src/keepass2android/EntryEditActivityState.cs
Normal 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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) => {
|
acceptButton.Click += (object sender, EventArgs e) => {
|
||||||
EditText password = (EditText) FindViewById(Resource.Id.password);
|
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) =>
|
cancelButton.Click += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
SetResult(Result.Canceled);
|
SetResult(Result.Canceled);
|
||||||
|
@ -126,11 +126,9 @@ namespace keepass2android
|
|||||||
} else {
|
} else {
|
||||||
SetContentView (new GroupViewOnlyView (this));
|
SetContentView (new GroupViewOnlyView (this));
|
||||||
}
|
}
|
||||||
Log.Warn (TAG, "Set view");
|
|
||||||
|
|
||||||
if (addGroupEnabled) {
|
if (addGroupEnabled) {
|
||||||
// Add Group button
|
// Add Group button
|
||||||
Button addGroup = (Button)FindViewById (Resource.Id.add_group);
|
View addGroup = FindViewById (Resource.Id.add_group);
|
||||||
addGroup.Click += (object sender, EventArgs e) => {
|
addGroup.Click += (object sender, EventArgs e) => {
|
||||||
GroupEditActivity.Launch (this, mGroup);
|
GroupEditActivity.Launch (this, mGroup);
|
||||||
};
|
};
|
||||||
@ -138,7 +136,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
if (addEntryEnabled) {
|
if (addEntryEnabled) {
|
||||||
// Add Entry button
|
// Add Entry button
|
||||||
Button addEntry = (Button)FindViewById (Resource.Id.add_entry);
|
View addEntry = FindViewById (Resource.Id.add_entry);
|
||||||
addEntry.Click += (object sender, EventArgs e) => {
|
addEntry.Click += (object sender, EventArgs e) => {
|
||||||
EntryEditActivity.Launch (this, mGroup);
|
EntryEditActivity.Launch (this, mGroup);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ using Android.Widget;
|
|||||||
using KeePassLib;
|
using KeePassLib;
|
||||||
using Android.Preferences;
|
using Android.Preferences;
|
||||||
using keepass2android.view;
|
using keepass2android.view;
|
||||||
|
using Android.Graphics.Drawables;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
@ -115,42 +116,56 @@ namespace keepass2android
|
|||||||
|
|
||||||
protected void setGroupTitle()
|
protected void setGroupTitle()
|
||||||
{
|
{
|
||||||
Button tv = (Button)FindViewById(Resource.Id.group_name);
|
String name = mGroup.Name;
|
||||||
if (tv == null)
|
String titleText;
|
||||||
return;
|
bool clickable = (mGroup != null) && (mGroup.IsVirtual == false) && (mGroup.ParentGroup != null);
|
||||||
|
if (!String.IsNullOrEmpty(name))
|
||||||
if (mGroup != null)
|
|
||||||
{
|
{
|
||||||
String name = mGroup.Name;
|
titleText = 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();
|
|
||||||
};
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
tv.SetCompoundDrawables(null, null, null, null);
|
titleText = GetText(Resource.String.root);
|
||||||
tv.Clickable = false;
|
}
|
||||||
|
|
||||||
|
//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() {
|
protected void setGroupIcon() {
|
||||||
if (mGroup != null) {
|
if (mGroup != null) {
|
||||||
|
Drawable drawable = App.getDB().drawFactory.getIconDrawable(Resources, App.getDB().pm, mGroup.IconId, mGroup.CustomIconUuid);
|
||||||
ImageView iv = (ImageView) FindViewById(Resource.Id.icon);
|
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();
|
Toast.MakeText(this, Resource.String.no_url_handler, ToastLength.Long).Show();
|
||||||
}
|
}
|
||||||
return true;
|
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);
|
return base.OnOptionsItemSelected(item);
|
||||||
|
@ -266,7 +266,7 @@ namespace keepass2android
|
|||||||
unloadDatabase();
|
unloadDatabase();
|
||||||
break;
|
break;
|
||||||
case Android.App.Result.Ok:
|
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;
|
String filename = data.DataString;
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
if (filename.StartsWith("file://")) {
|
if (filename.StartsWith("file://")) {
|
||||||
@ -447,7 +447,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StartActivityForResult(intent, Intents.REQUEST_CODE_FILE_BROWSE);
|
StartActivityForResult(intent, Intents.REQUEST_CODE_FILE_BROWSE_FOR_KEYFILE);
|
||||||
} catch (ActivityNotFoundException)
|
} catch (ActivityNotFoundException)
|
||||||
{
|
{
|
||||||
BrowserDialog diag = new BrowserDialog(this);
|
BrowserDialog diag = new BrowserDialog(this);
|
||||||
|
@ -55,7 +55,14 @@ namespace keepass2android
|
|||||||
|
|
||||||
SetContentView(Resource.Layout.QuickUnlock);
|
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);
|
TextView txtLabel = (TextView)FindViewById(Resource.Id.QuickUnlock_label);
|
||||||
|
1740
src/keepass2android/Resources/Resource.designer.cs
generated
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 433 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 785 B |
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 1.6 KiB |
BIN
src/keepass2android/Resources/drawable/collections_new_label.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 785 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 959 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 703 B |
BIN
src/keepass2android/Resources/drawable/location_web_site.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
src/keepass2android/Resources/drawable/navigation_cancel.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
@ -4,5 +4,5 @@
|
|||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<size android:width="1000dp" android:height="2px" />
|
<size android:width="1000dp" android:height="2px" />
|
||||||
<solid
|
<solid
|
||||||
android:color="@color/emphasis"/>
|
android:color="@color/light_gray"/>
|
||||||
</shape>
|
</shape>
|
@ -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>
|
18
src/keepass2android/Resources/layout-v14/SaveButton.xml
Normal 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>
|
200
src/keepass2android/Resources/layout-v14/entry_edit.xml
Normal 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>
|
@ -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>
|
59
src/keepass2android/Resources/layout-v14/entry_view.xml
Normal 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>
|
@ -1,176 +1,179 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/entry_table"
|
android:id="@+id/entry_table"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<!-- Username -->
|
|
||||||
<TextView
|
<!-- Username -->
|
||||||
android:id="@+id/entry_user_name_label"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_user_name_label"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/entry_user_name"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryFieldHeader"
|
android:text="@string/entry_user_name"
|
||||||
/>
|
style="@style/EntryFieldHeader"
|
||||||
<TextView
|
/>
|
||||||
android:id="@+id/entry_user_name"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_user_name"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:textIsSelectable="true"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryItem" />
|
android:textIsSelectable="true"
|
||||||
<!-- URL -->
|
style="@style/EntryItem" />
|
||||||
<TextView
|
<!-- URL -->
|
||||||
android:id="@+id/entry_url_label"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_url_label"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/entry_url"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryFieldHeader"
|
android:text="@string/entry_url"
|
||||||
/>
|
style="@style/EntryFieldHeader"
|
||||||
<TextView
|
/>
|
||||||
android:id="@+id/entry_url"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_url"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:autoLink="all"
|
android:layout_height="wrap_content"
|
||||||
android:textIsSelectable="true"
|
android:autoLink="all"
|
||||||
style="@style/EntryItem" />
|
android:textIsSelectable="true"
|
||||||
<!-- Password -->
|
style="@style/EntryItem" />
|
||||||
<TextView
|
<!-- Password -->
|
||||||
android:id="@+id/entry_password_label"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_password_label"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/entry_password"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryFieldHeader"
|
android:text="@string/entry_password"
|
||||||
/>
|
style="@style/EntryFieldHeader"
|
||||||
<TextView
|
/>
|
||||||
android:id="@+id/entry_password"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_password"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:password="true"
|
android:layout_height="wrap_content"
|
||||||
android:textIsSelectable="true"
|
android:password="true"
|
||||||
android:typeface="monospace"
|
android:textIsSelectable="true"
|
||||||
style="@style/EntryItem" />
|
android:typeface="monospace"
|
||||||
<!-- Comment -->
|
style="@style/EntryItem" />
|
||||||
<TextView
|
<!-- Comment -->
|
||||||
android:id="@+id/entry_comment_label"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_comment_label"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/entry_comment"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryFieldHeader"
|
android:text="@string/entry_comment"
|
||||||
/>
|
style="@style/EntryFieldHeader"
|
||||||
<TextView
|
/>
|
||||||
android:id="@+id/entry_comment"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_comment"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:textIsSelectable="true"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryItem" />
|
android:textIsSelectable="true"
|
||||||
|
style="@style/EntryItem" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/entry_extra_strings_label"
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/entry_extra_strings_label"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/entry_extra_strings"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EntryFieldHeader"
|
android:text="@string/entry_extra_strings"
|
||||||
/>
|
style="@style/EntryFieldHeader"
|
||||||
<LinearLayout
|
/>
|
||||||
android:id="@+id/extra_strings"
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/extra_strings"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" />
|
android:layout_height="wrap_content"
|
||||||
<!-- file attachments -->
|
android:layout_marginLeft="12dp"
|
||||||
<TextView
|
android:layout_marginRight="12dp"
|
||||||
android:id="@+id/entry_binaries_label"
|
android:orientation="vertical" />
|
||||||
android:layout_width="fill_parent"
|
<!-- file attachments -->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_binaries"
|
android:id="@+id/entry_binaries_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<LinearLayout
|
android:text="@string/entry_binaries"
|
||||||
android:id="@+id/binaries"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<LinearLayout
|
||||||
android:orientation="vertical" />
|
android:id="@+id/binaries"
|
||||||
<!--Tags -->
|
android:layout_width="fill_parent"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/entry_tags_label"
|
android:orientation="vertical" />
|
||||||
android:layout_width="fill_parent"
|
<!--Tags -->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_tags"
|
android:id="@+id/entry_tags_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:text="@string/entry_tags"
|
||||||
android:id="@+id/entry_tags"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:textIsSelectable="true"
|
android:id="@+id/entry_tags"
|
||||||
style="@style/EntryItem" />
|
android:layout_width="fill_parent"
|
||||||
<!--Override URL-->
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:textIsSelectable="true"
|
||||||
android:id="@+id/entry_override_url_label"
|
style="@style/EntryItem" />
|
||||||
android:layout_width="fill_parent"
|
<!--Override URL-->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_override_url"
|
android:id="@+id/entry_override_url_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:text="@string/entry_override_url"
|
||||||
android:id="@+id/entry_override_url"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:autoLink="all"
|
android:id="@+id/entry_override_url"
|
||||||
android:textIsSelectable="true"
|
android:layout_width="fill_parent"
|
||||||
style="@style/EntryItem" />
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="all"
|
||||||
<!-- Created -->
|
android:textIsSelectable="true"
|
||||||
<TextView
|
style="@style/EntryItem" />
|
||||||
android:id="@+id/entry_created_label"
|
|
||||||
android:layout_width="fill_parent"
|
<!-- Created -->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_created"
|
android:id="@+id/entry_created_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:text="@string/entry_created"
|
||||||
android:id="@+id/entry_created"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
style="@style/EntryItem" />
|
android:id="@+id/entry_created"
|
||||||
<!-- Modified -->
|
android:layout_width="fill_parent"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/entry_modified_label"
|
style="@style/EntryItem" />
|
||||||
android:layout_width="fill_parent"
|
<!-- Modified -->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_modified"
|
android:id="@+id/entry_modified_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:text="@string/entry_modified"
|
||||||
android:id="@+id/entry_modified"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
style="@style/EntryItem" />
|
android:id="@+id/entry_modified"
|
||||||
<!-- Accessed -->
|
android:layout_width="fill_parent"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/entry_accessed_label"
|
style="@style/EntryItem" />
|
||||||
android:layout_width="fill_parent"
|
<!-- Accessed -->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_accessed"
|
android:id="@+id/entry_accessed_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:text="@string/entry_accessed"
|
||||||
android:id="@+id/entry_accessed"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
style="@style/EntryItem" />
|
android:id="@+id/entry_accessed"
|
||||||
<!-- Expires -->
|
android:layout_width="fill_parent"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/entry_expires_label"
|
style="@style/EntryItem" />
|
||||||
android:layout_width="fill_parent"
|
<!-- Expires -->
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="@string/entry_expires"
|
android:id="@+id/entry_expires_label"
|
||||||
style="@style/EntryFieldHeader"
|
android:layout_width="fill_parent"
|
||||||
/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:text="@string/entry_expires"
|
||||||
android:id="@+id/entry_expires"
|
style="@style/EntryFieldHeader"
|
||||||
android:layout_width="fill_parent"
|
/>
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
style="@style/EntryItem" />
|
android:id="@+id/entry_expires"
|
||||||
<!-- Property Change Conflict | id:@+id/entry_url_label -->
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/EntryItem" />
|
||||||
|
<!-- Property Change Conflict | id:@+id/entry_url_label -->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
174
src/keepass2android/Resources/layout-v14/generate_password.xml
Normal 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>
|
69
src/keepass2android/Resources/layout-v14/group_add_entry.xml
Normal 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>
|
30
src/keepass2android/Resources/layout-v14/icon_picker.xml
Normal 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>
|
106
src/keepass2android/Resources/layout-v14/password.xml
Normal 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>
|
13
src/keepass2android/Resources/layout/InViewButton.xml
Normal 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" />
|
@ -39,8 +39,7 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/entry_title"
|
android:text="@string/entry_title"
|
||||||
style="@style/EntryFieldHeader"
|
style="@style/EntryFieldHeader" />
|
||||||
/>
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/icon_button"
|
android:id="@+id/icon_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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_width="fill_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<EditText
|
<EditText
|
||||||
@ -37,4 +37,4 @@
|
|||||||
android:layout_below="@id/value"
|
android:layout_below="@id/value"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@android:drawable/divider_horizontal_dark" />
|
android:src="@android:drawable/divider_horizontal_dark" />
|
||||||
</keepass2android.view.EntryEditSection>
|
</LinearLayout>
|
@ -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" />
|
@ -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" />
|
@ -14,7 +14,6 @@
|
|||||||
android:id="@+id/value"
|
android:id="@+id/value"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:typeface="monospace"
|
android:typeface="monospace"
|
||||||
android:text="Value"
|
android:text="Value"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
|
12
src/keepass2android/Resources/layout/entry_view_test.xml
Normal 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>
|
@ -1,57 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_margin="12dip">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/file_listtop"
|
android:id="@+id/file_listtop"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="?android:attr/listSeparatorTextViewStyle"
|
style="?android:attr/listSeparatorTextViewStyle"
|
||||||
android:text="@string/open_recent" />
|
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
|
<ListView
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/file_listtop"
|
android:layout_below="@id/file_listtop" />
|
||||||
android:layout_above="@id/file_select" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -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>
|
@ -1,17 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:layout_width="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/filename_form">
|
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
|
<TextView
|
||||||
android:id="@+id/label_open_by_filename"
|
android:id="@+id/label_open_by_filename"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -62,31 +57,4 @@
|
|||||||
android:layout_toRightOf="@id/create"
|
android:layout_toRightOf="@id/create"
|
||||||
android:minWidth="100sp" />
|
android:minWidth="100sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<Button
|
</LinearLayout>
|
||||||
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>
|
|
@ -1,59 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent"
|
||||||
<RelativeLayout
|
android:layout_margin="12dip">
|
||||||
|
<LinearLayout
|
||||||
android_id="@+id/bottom_layout"
|
android_id="@+id/bottom_layout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true">
|
android:layout_gravity="center_horizontal">
|
||||||
<keepass2android.view.FileNameView
|
<ScrollView
|
||||||
android:id="@+id/file_select"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="fill_parent">
|
||||||
<!--LinearLayout
|
<keepass2android.view.FileSelectButtons
|
||||||
android:id="@+id/buttons"
|
android:id="@+id/file_select"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_below="@id/file_select">
|
</ScrollView>
|
||||||
<include
|
</LinearLayout>
|
||||||
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"/>
|
|
||||||
-->
|
|
||||||
<!-- Small hack because I need to include a list since this is a list activity -->
|
<!-- Small hack because I need to include a list since this is a list activity -->
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="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
|
<LinearLayout
|
||||||
android:id="@+id/bottom_bar"
|
android:id="@+id/bottom_bar"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
@ -45,6 +41,5 @@
|
|||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@id/divider2"
|
android:layout_above="@id/divider2" />
|
||||||
android:layout_below="@id/group_header" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -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>
|
|
@ -1,26 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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.
|
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
|
Keepass2Android is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Keepass2Android is distributed in the hope that it will be useful,
|
Keepass2Android is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<color name="blue_highlight">#0000dd</color>
|
<color name="blue_highlight">#0000dd</color>
|
||||||
<color name="group">#333333</color>
|
<color name="group">#333333</color>
|
||||||
<color name="icon_background">#555555</color>
|
<color name="icon_background">#00555555</color>
|
||||||
<color name="icon_text">#000000</color>
|
<color name="icon_text">#000000</color>
|
||||||
|
<color name="light_gray">#a8a8a8</color>
|
||||||
</resources>
|
<color name="dark_gray">#303030</color>
|
||||||
|
|
||||||
|
</resources>
|
156
src/keepass2android/Resources/values-v14/styles.xml
Normal 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>
|
@ -42,6 +42,7 @@
|
|||||||
<string name="timeout_key">timeout_key</string>
|
<string name="timeout_key">timeout_key</string>
|
||||||
<string name="TanExpiresOnUse_key">TanExpiresOnUse_key</string>
|
<string name="TanExpiresOnUse_key">TanExpiresOnUse_key</string>
|
||||||
<string name="default_username_key">defaultUsername</string>
|
<string name="default_username_key">defaultUsername</string>
|
||||||
|
<string name="database_name_key">databaseName</string>
|
||||||
<string name="BinaryDirectory_key">binaryDirectory</string>
|
<string name="BinaryDirectory_key">binaryDirectory</string>
|
||||||
<string name="BinaryDirectory_default">/mnt/sdcard/keepass2android/binaries/</string>
|
<string name="BinaryDirectory_default">/mnt/sdcard/keepass2android/binaries/</string>
|
||||||
<bool name="maskpass_default">true</bool>
|
<bool name="maskpass_default">true</bool>
|
||||||
@ -75,7 +76,7 @@
|
|||||||
<item>300000</item>
|
<item>300000</item>
|
||||||
<item>-1</item>
|
<item>-1</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string name="list_size_default">28</string>
|
<string name="list_size_default">20</string>
|
||||||
<string-array name="list_size_values">
|
<string-array name="list_size_values">
|
||||||
<item>15</item>
|
<item>15</item>
|
||||||
<item>20</item>
|
<item>20</item>
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
<string name="rounds">Encryption Rounds</string>
|
<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_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="rounds_hint">rounds</string>
|
||||||
|
<string name="database_name">Database name</string>
|
||||||
<string name="default_username">Default user name for new entries</string>
|
<string name="default_username">Default user name for new entries</string>
|
||||||
<string name="saving_database">Saving database…</string>
|
<string name="saving_database">Saving database…</string>
|
||||||
<string name="space">Space</string>
|
<string name="space">Space</string>
|
||||||
|
@ -22,79 +22,42 @@
|
|||||||
<style name="NoTitleBar" parent="android:Theme.NoTitleBar"></style>
|
<style name="NoTitleBar" parent="android:Theme.NoTitleBar"></style>
|
||||||
<style name="Dialog" parent="android:Theme.Dialog"></style>
|
<style name="Dialog" parent="android:Theme.Dialog"></style>
|
||||||
<style name="GroupTextSmall" parent="android:Theme">
|
<style name="GroupTextSmall" parent="android:Theme">
|
||||||
<item name="@android:textColor">@color/group</item>
|
|
||||||
<item name="@android:textSize">15sp</item>
|
<item name="@android:textSize">15sp</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="GroupText" parent="android:Theme">
|
<style name="GroupText" parent="android:Theme">
|
||||||
<item name="@android:textColor">@color/group</item>
|
|
||||||
<item name="@android:textSize">20sp</item>
|
<item name="@android:textSize">20sp</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="GroupTextLarge" parent="android:Theme">
|
<style name="GroupTextLarge" parent="android:Theme">
|
||||||
<item name="@android:textColor">@color/group</item>
|
|
||||||
<item name="@android:textSize">28sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="ElementTextSmall">
|
<style name="ElementTextSmall">
|
||||||
<item name="@android:textSize">15sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="ElementText">
|
<style name="ElementText">
|
||||||
<item name="@android:textSize">20sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="ElementTextLarge">
|
<style name="ElementTextLarge">
|
||||||
<item name="@android:textSize">28sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="GroupLabel">
|
<style name="GroupLabel">
|
||||||
<item name="@android:textSize">20sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="WhiteOnBlack">
|
<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>
|
||||||
<style name="GroupAndEntryHeader">
|
<style name="GroupAndEntryHeader">
|
||||||
<item name="@android:background">#000066</item>
|
|
||||||
<item name="@android:textColor">#ffffff</item>
|
|
||||||
<item name="@android:textSize">20sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="WhiteOnBlackSmall" parent="WhiteOnBlack">
|
<style name="WhiteOnBlackSmall" parent="WhiteOnBlack">
|
||||||
<item name="@android:textSize">12sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="WhiteOnDarkSmall" parent="WhiteOnBlack">
|
<style name="WhiteOnDarkSmall" parent="WhiteOnBlack">
|
||||||
<item name="@android:textSize">12sp</item>
|
|
||||||
<item name="@android:background">#222222</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="EntryFieldHeader" parent="WhiteOnDarkSmall">
|
<style name="EntryFieldHeader" parent="WhiteOnDarkSmall">
|
||||||
<item name="@android:textSize">12sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="ElementTextTitle" parent="WhiteOnBlack">
|
<style name="ElementTextTitle" parent="WhiteOnBlack">
|
||||||
<item name="@android:textColor">@color/group</item>
|
|
||||||
<item name="@android:background">@android:color/transparent</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style name="EntryItem">
|
<style name="EntryItem">
|
||||||
<item name="@android:padding">5sp</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
<style name="EditEntryButton">
|
||||||
|
</style>
|
||||||
<style name="EntryFieldHeader">
|
<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>
|
||||||
|
|
||||||
<style name="ExtraFieldHeader">
|
<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>
|
</style>
|
||||||
</resources>
|
</resources>
|
@ -23,6 +23,10 @@
|
|||||||
android:key="@string/db_key"
|
android:key="@string/db_key"
|
||||||
android:title="@string/database"
|
android:title="@string/database"
|
||||||
android:summary="@string/menu_db_settings">
|
android:summary="@string/menu_db_settings">
|
||||||
|
<EditTextPreference
|
||||||
|
android:title="@string/database_name"
|
||||||
|
android:persistent="false"
|
||||||
|
android:key="@string/database_name_key"/>
|
||||||
<Preference
|
<Preference
|
||||||
android:key="@string/algorithm_key"
|
android:key="@string/algorithm_key"
|
||||||
android:title="@string/algorithm"
|
android:title="@string/algorithm"
|
||||||
@ -39,6 +43,7 @@
|
|||||||
android:title="@string/default_username"
|
android:title="@string/default_username"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:key="@string/default_username_key"/>
|
android:key="@string/default_username_key"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
|
@ -28,10 +28,11 @@ using Android.Runtime;
|
|||||||
using Android.Views;
|
using Android.Views;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
using keepass2android.view;
|
using keepass2android.view;
|
||||||
|
using Android.Content.PM;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
[Activity (Label = "@string/kp2a_findUrl")]
|
[Activity (Label = "@string/kp2a_findUrl", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden, Theme="@style/Base")]
|
||||||
public class ShareUrlResults : GroupBaseActivity
|
public class ShareUrlResults : GroupBaseActivity
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -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))
|
if (Interaction.isIntentAvailable(act, Intents.FILE_BROWSE))
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ namespace keepass2android
|
|||||||
i.SetData(Android.Net.Uri.Parse("file://" + filename));
|
i.SetData(Android.Net.Uri.Parse("file://" + filename));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
act.StartActivityForResult(i, Intents.REQUEST_CODE_FILE_BROWSE);
|
act.StartActivityForResult(i, requestCodeBrowse);
|
||||||
}
|
}
|
||||||
catch (ActivityNotFoundException)
|
catch (ActivityNotFoundException)
|
||||||
{
|
{
|
||||||
|
@ -65,6 +65,10 @@ namespace keepass2android
|
|||||||
private static Database db;
|
private static Database db;
|
||||||
private static bool shutdown = false;
|
private static bool shutdown = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// See comments to EntryEditActivityState.
|
||||||
|
/// </summary>
|
||||||
|
internal static EntryEditActivityState entryEditActivityState = null;
|
||||||
|
|
||||||
public static FileDbHelper fileDbHelper;
|
public static FileDbHelper fileDbHelper;
|
||||||
|
|
||||||
|
@ -45,13 +45,6 @@ namespace keepass2android
|
|||||||
public class FileSelectActivity : ListActivity
|
public class FileSelectActivity : ListActivity
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
enum CurrentAction { None, OpenFile, OpenURL, Create, CreateImport };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CurrentAction currentAction = CurrentAction.None;
|
|
||||||
|
|
||||||
public FileSelectActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
public FileSelectActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
: base(javaReference, transfer)
|
: base(javaReference, transfer)
|
||||||
{
|
{
|
||||||
@ -65,22 +58,147 @@ namespace keepass2android
|
|||||||
|
|
||||||
public const String UrlToSearch_key = "UrlToSearch";
|
public const String UrlToSearch_key = "UrlToSearch";
|
||||||
const String BundleKey_UrlToSearchFor = "UrlToSearch";
|
const String BundleKey_UrlToSearchFor = "UrlToSearch";
|
||||||
const string BundleKey_CurrentAction = "CurrentAction";
|
|
||||||
const string BundleKey_RecentMode = "RecentMode";
|
const string BundleKey_RecentMode = "RecentMode";
|
||||||
|
|
||||||
private FileDbHelper mDbHelper;
|
private FileDbHelper mDbHelper;
|
||||||
private String mUrlToSearch;
|
private String mUrlToSearch;
|
||||||
|
|
||||||
private bool recentMode = false;
|
private bool recentMode = false;
|
||||||
|
view.FileSelectButtons fileSelectButtons;
|
||||||
bool createdWithActivityResult = false;
|
bool createdWithActivityResult = false;
|
||||||
|
|
||||||
|
|
||||||
IOConnectionInfo loadIoc(string defaultFileName)
|
IOConnectionInfo loadIoc(string defaultFileName)
|
||||||
{
|
{
|
||||||
return mDbHelper.cursorToIoc(mDbHelper.fetchFileByName(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)
|
protected override void OnCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
@ -98,34 +216,30 @@ namespace keepass2android
|
|||||||
if (mDbHelper.hasRecentFiles())
|
if (mDbHelper.hasRecentFiles())
|
||||||
{
|
{
|
||||||
recentMode = true;
|
recentMode = true;
|
||||||
|
|
||||||
SetContentView(Resource.Layout.file_selection);
|
SetContentView(Resource.Layout.file_selection);
|
||||||
|
fileSelectButtons = new keepass2android.view.FileSelectButtons(this);
|
||||||
|
((ListView)FindViewById(Android.Resource.Id.List)).AddFooterView(
|
||||||
|
fileSelectButtons);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
SetContentView(Resource.Layout.file_selection_no_recent);
|
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);
|
Button openFileButton = (Button)FindViewById(Resource.Id.start_open_file);
|
||||||
|
|
||||||
|
|
||||||
EventHandler openFileButtonClick = (object sender, EventArgs e) =>
|
EventHandler openFileButtonClick = (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (currentAction == CurrentAction.OpenFile)
|
string defaultFilename = Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path);
|
||||||
return;
|
string detailsText = "";
|
||||||
currentAction = CurrentAction.OpenFile;
|
ShowFilenameDialog(true, false, true, defaultFilename, detailsText, Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN);
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
openFileButton.Click += openFileButtonClick;
|
openFileButton.Click += openFileButtonClick;
|
||||||
//OPEN URL
|
//OPEN URL
|
||||||
@ -137,16 +251,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
EventHandler openUrlButtonClick = (object sender, EventArgs e) =>
|
EventHandler openUrlButtonClick = (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (currentAction == CurrentAction.OpenURL)
|
ShowFilenameDialog(true, false, false, "", GetString(Resource.String.enter_filename_details_url), Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN);
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
openUrlButton.Click += openUrlButtonClick;
|
openUrlButton.Click += openUrlButtonClick;
|
||||||
|
|
||||||
@ -154,17 +259,7 @@ namespace keepass2android
|
|||||||
Button createNewButton = (Button)FindViewById(Resource.Id.start_create);
|
Button createNewButton = (Button)FindViewById(Resource.Id.start_create);
|
||||||
EventHandler createNewButtonClick = (object sender, EventArgs e) =>
|
EventHandler createNewButtonClick = (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (currentAction == CurrentAction.Create)
|
ShowFilenameDialog(false, true, true, Android.OS.Environment.ExternalStorageDirectory + GetString(Resource.String.default_file_path), "", Intents.REQUEST_CODE_FILE_BROWSE_FOR_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;
|
|
||||||
};
|
};
|
||||||
createNewButton.Click += createNewButtonClick;
|
createNewButton.Click += createNewButtonClick;
|
||||||
|
|
||||||
@ -172,10 +267,6 @@ namespace keepass2android
|
|||||||
Button createImportButton = (Button)FindViewById(Resource.Id.start_create_import);
|
Button createImportButton = (Button)FindViewById(Resource.Id.start_create_import);
|
||||||
createImportButton.Click += (object sender, EventArgs e) =>
|
createImportButton.Click += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (currentAction == CurrentAction.CreateImport)
|
|
||||||
return;
|
|
||||||
currentAction = CurrentAction.CreateImport;
|
|
||||||
fnform.Visibility = ViewStates.Visible;
|
|
||||||
openButton.Visibility = ViewStates.Gone;
|
openButton.Visibility = ViewStates.Gone;
|
||||||
createButton.Visibility = ViewStates.Visible;
|
createButton.Visibility = ViewStates.Visible;
|
||||||
enterFilenameDetails.Text = GetString(Resource.String.enter_filename_details_create_import);
|
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);
|
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();
|
fillData();
|
||||||
|
|
||||||
@ -301,29 +283,18 @@ namespace keepass2android
|
|||||||
|
|
||||||
if (savedInstanceState != null)
|
if (savedInstanceState != null)
|
||||||
{
|
{
|
||||||
CurrentAction newCurrentAction = (CurrentAction)savedInstanceState.GetInt(BundleKey_CurrentAction, (int)currentAction);
|
|
||||||
mUrlToSearch = savedInstanceState.GetString(BundleKey_UrlToSearchFor, null);
|
mUrlToSearch = savedInstanceState.GetString(BundleKey_UrlToSearchFor, null);
|
||||||
recentMode = savedInstanceState.GetBoolean(BundleKey_RecentMode, recentMode);
|
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)
|
protected override void OnSaveInstanceState(Bundle outState)
|
||||||
{
|
{
|
||||||
base.OnSaveInstanceState(outState);
|
base.OnSaveInstanceState(outState);
|
||||||
outState.PutInt(BundleKey_CurrentAction, (int)currentAction);
|
|
||||||
outState.PutString(BundleKey_UrlToSearchFor, mUrlToSearch);
|
outState.PutString(BundleKey_UrlToSearchFor, mUrlToSearch);
|
||||||
outState.PutBoolean(BundleKey_RecentMode, recentMode);
|
outState.PutBoolean(BundleKey_RecentMode, recentMode);
|
||||||
}
|
}
|
||||||
@ -387,6 +358,8 @@ namespace keepass2android
|
|||||||
// Now create a simple cursor adapter and set it to display
|
// Now create a simple cursor adapter and set it to display
|
||||||
SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
|
SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
|
||||||
Resource.Layout.file_row, filesCursor, from, to);
|
Resource.Layout.file_row, filesCursor, from, to);
|
||||||
|
|
||||||
|
|
||||||
ListAdapter = notes;
|
ListAdapter = notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +429,9 @@ namespace keepass2android
|
|||||||
|
|
||||||
fillData();
|
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;
|
String filename = data.DataString;
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
if (filename.StartsWith("file://")) {
|
if (filename.StartsWith("file://")) {
|
||||||
@ -464,10 +439,20 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename = Java.Net.URLDecoder.Decode(filename);
|
filename = Java.Net.URLDecoder.Decode(filename);
|
||||||
|
|
||||||
EditText fn = (EditText) FindViewById(Resource.Id.file_filename);
|
if (requestCode == Intents.REQUEST_CODE_FILE_BROWSE_FOR_OPEN)
|
||||||
fn.Text = filename;
|
{
|
||||||
|
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();
|
Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
view.FileNameView fnv = (view.FileNameView)FindViewById(Resource.Id.file_select);
|
|
||||||
fnv.updateExternalStorageWarning();
|
fileSelectButtons.updateExternalStorageWarning();
|
||||||
|
|
||||||
if (!createdWithActivityResult)
|
if (!createdWithActivityResult)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ namespace keepass2android
|
|||||||
iv.SetImageDrawable (draw);
|
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) {
|
if (customIconId != PwUuid.Zero) {
|
||||||
return getIconDrawable (res, db, customIconId);
|
return getIconDrawable (res, db, customIconId);
|
||||||
|
@ -38,7 +38,10 @@ namespace keepass2android
|
|||||||
public const String CHECK_KEYBOARD = "keepass2android.check_keyboard";
|
public const String CHECK_KEYBOARD = "keepass2android.check_keyboard";
|
||||||
|
|
||||||
public const String FILE_BROWSE = "org.openintents.action.PICK_FILE";
|
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";
|
public const String SHOW_NOTIFICATION = "keepass2android.show_notification";
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,6 @@
|
|||||||
<Compile Include="Utils\Util.cs" />
|
<Compile Include="Utils\Util.cs" />
|
||||||
<Compile Include="Utils\Interaction.cs" />
|
<Compile Include="Utils\Interaction.cs" />
|
||||||
<Compile Include="intents\Intents.cs" />
|
<Compile Include="intents\Intents.cs" />
|
||||||
<Compile Include="views\FileNameView.cs" />
|
|
||||||
<Compile Include="fileselect\BrowserDialog.cs" />
|
<Compile Include="fileselect\BrowserDialog.cs" />
|
||||||
<Compile Include="timeout\TimeoutHelper.cs" />
|
<Compile Include="timeout\TimeoutHelper.cs" />
|
||||||
<Compile Include="timers\Timeout.cs" />
|
<Compile Include="timers\Timeout.cs" />
|
||||||
@ -158,6 +157,8 @@
|
|||||||
<Compile Include="services\QuickUnlockForegroundService.cs" />
|
<Compile Include="services\QuickUnlockForegroundService.cs" />
|
||||||
<Compile Include="AssemblyInfo.cs" />
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
<Compile Include="database\edit\DeleteRunnable.cs" />
|
<Compile Include="database\edit\DeleteRunnable.cs" />
|
||||||
|
<Compile Include="views\FileSelectButtons.cs" />
|
||||||
|
<Compile Include="EntryEditActivityState.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\AboutResources.txt" />
|
<None Include="Resources\AboutResources.txt" />
|
||||||
@ -189,9 +190,6 @@
|
|||||||
<None Include="settings\RoundsPreference %28Kopie%29.cs">
|
<None Include="settings\RoundsPreference %28Kopie%29.cs">
|
||||||
<Visible>False</Visible>
|
<Visible>False</Visible>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Resources\layout-v11\entry_view_contents.xml">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
</None>
|
|
||||||
<None Include="Resources\drawable\new_group.xcf">
|
<None Include="Resources\drawable\new_group.xcf">
|
||||||
<Visible>False</Visible>
|
<Visible>False</Visible>
|
||||||
</None>
|
</None>
|
||||||
@ -262,6 +260,24 @@
|
|||||||
<None Include="..\java\kp2akeytransform\libs\mips\libfinal-key.so">
|
<None Include="..\java\kp2akeytransform\libs\mips\libfinal-key.so">
|
||||||
<Link>libs\mips\libfinal-key.so</Link>
|
<Link>libs\mips\libfinal-key.so</Link>
|
||||||
</None>
|
</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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\ic00.png" />
|
<AndroidResource Include="Resources\drawable\ic00.png" />
|
||||||
@ -521,12 +537,9 @@
|
|||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_launcher.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_launcher.png" />
|
||||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_launcher.png" />
|
<AndroidResource Include="Resources\drawable-xhdpi\ic_launcher.png" />
|
||||||
<AndroidResource Include="Resources\drawable-xxhdpi\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\ic_action_eye_open.png" />
|
||||||
<AndroidResource Include="Resources\drawable-hdpi\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\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\layout\search.xml" />
|
||||||
<AndroidResource Include="Resources\drawable\ic_action_search.png" />
|
<AndroidResource Include="Resources\drawable\ic_action_search.png" />
|
||||||
<AndroidResource Include="Resources\drawable-hdpi\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\ic_launcher_gray.png" />
|
||||||
<AndroidResource Include="Resources\drawable-hdpi\notify_keyboard.png" />
|
<AndroidResource Include="Resources\drawable-hdpi\notify_keyboard.png" />
|
||||||
<AndroidResource Include="Resources\drawable\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>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -603,14 +654,12 @@
|
|||||||
<Folder Include="settings\" />
|
<Folder Include="settings\" />
|
||||||
<Folder Include="password\" />
|
<Folder Include="password\" />
|
||||||
<Folder Include="compat\" />
|
<Folder Include="compat\" />
|
||||||
<Folder Include="Resources\layout-v11\" />
|
|
||||||
<Folder Include="Resources\menu-v11\" />
|
<Folder Include="Resources\menu-v11\" />
|
||||||
<Folder Include="Resources\drawable-hdpi\" />
|
<Folder Include="Resources\drawable-hdpi\" />
|
||||||
<Folder Include="Resources\drawable-ldpi\" />
|
<Folder Include="Resources\drawable-ldpi\" />
|
||||||
<Folder Include="Resources\drawable-mdpi\" />
|
<Folder Include="Resources\drawable-mdpi\" />
|
||||||
<Folder Include="Resources\drawable-xhdpi\" />
|
<Folder Include="Resources\drawable-xhdpi\" />
|
||||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||||
<Folder Include="Resources\values-v11\" />
|
|
||||||
<Folder Include="Resources\drawable-v11\" />
|
<Folder Include="Resources\drawable-v11\" />
|
||||||
<Folder Include="Resources\values-de\" />
|
<Folder Include="Resources\values-de\" />
|
||||||
<Folder Include="Resources\values-ca\" />
|
<Folder Include="Resources\values-ca\" />
|
||||||
@ -636,6 +685,8 @@
|
|||||||
<Folder Include="libs\armeabi-v7a\" />
|
<Folder Include="libs\armeabi-v7a\" />
|
||||||
<Folder Include="libs\armeabi\" />
|
<Folder Include="libs\armeabi\" />
|
||||||
<Folder Include="libs\mips\" />
|
<Folder Include="libs\mips\" />
|
||||||
|
<Folder Include="Resources\values-v14\" />
|
||||||
|
<Folder Include="Resources\layout-v14\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
|
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
|
||||||
|
@ -31,7 +31,7 @@ using keepass2android.search;
|
|||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
[Activity (Label = "@string/short_app_name", Theme="@style/Base")]
|
[Activity (Label = "@string/app_name", Theme="@style/Base")]
|
||||||
public class SearchActivity : LifecycleDebugActivity
|
public class SearchActivity : LifecycleDebugActivity
|
||||||
{
|
{
|
||||||
bool GetCheckBoxValue(int resId)
|
bool GetCheckBoxValue(int resId)
|
||||||
@ -63,8 +63,6 @@ namespace keepass2android
|
|||||||
|
|
||||||
ImageButton btnSearch = (ImageButton)FindViewById(Resource.Id.search_button);
|
ImageButton btnSearch = (ImageButton)FindViewById(Resource.Id.search_button);
|
||||||
|
|
||||||
//TODO: "Enter"-Key should run the search
|
|
||||||
|
|
||||||
btnSearch.Click += (object sender, EventArgs e) =>
|
btnSearch.Click += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
PerformSearch();
|
PerformSearch();
|
||||||
|
@ -54,11 +54,13 @@ namespace keepass2android.search
|
|||||||
if ( ! mDb.Open ) {
|
if ( ! mDb.Open ) {
|
||||||
Finish();
|
Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
query(getSearch(Intent));
|
query(getSearch(Intent));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void query (SearchParameters searchParams)
|
private void query (SearchParameters searchParams)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -92,7 +92,33 @@ namespace keepass2android
|
|||||||
ProgressTask pt = new ProgressTask(this, save, Resource.String.saving_database);
|
ProgressTask pt = new ProgressTask(this, save, Resource.String.saving_database);
|
||||||
pt.run();
|
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);
|
setRounds(db, rounds);
|
||||||
|
|
||||||
Preference algorithm = FindPreference(GetString(Resource.String.algorithm_key));
|
Preference algorithm = FindPreference(GetString(Resource.String.algorithm_key));
|
||||||
|
@ -31,7 +31,7 @@ using KeePassLib.Security;
|
|||||||
|
|
||||||
namespace keepass2android.view
|
namespace keepass2android.view
|
||||||
{
|
{
|
||||||
public class EntryEditSection : RelativeLayout
|
public class EntryEditSection : LinearLayout
|
||||||
{
|
{
|
||||||
public event EventHandler ContentChanged;
|
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.title, title);
|
||||||
setText(Resource.Id.value, value.ReadString());
|
setText(Resource.Id.value, value.ReadString());
|
||||||
|
|
||||||
CheckBox cb = (CheckBox) FindViewById(Resource.Id.protection);
|
CheckBox cb = (CheckBox)FindViewById(Resource.Id.protection);
|
||||||
cb.Checked = value.IsProtected;
|
if (cb != null)
|
||||||
cb.CheckedChange += (sender, e) => {if (ContentChanged != null)
|
{
|
||||||
ContentChanged(this, new EventArgs());
|
cb.Checked = value.IsProtected;
|
||||||
};
|
cb.CheckedChange += (sender, e) => {
|
||||||
|
if (ContentChanged != null)
|
||||||
|
ContentChanged(this, new EventArgs());
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageButton getDeleteButton()
|
public ImageButton getDeleteButton()
|
||||||
|
@ -58,7 +58,12 @@ namespace keepass2android.view
|
|||||||
inflater.Inflate(Resource.Layout.entry_section, this);
|
inflater.Inflate(Resource.Layout.entry_section, this);
|
||||||
|
|
||||||
setText(Resource.Id.title, title);
|
setText(Resource.Id.title, title);
|
||||||
|
|
||||||
|
FindViewById<TextView>(Resource.Id.value).Invalidate();
|
||||||
setText(Resource.Id.value, value);
|
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) {
|
private void setText(int resId, String str) {
|
||||||
|
@ -1,81 +1,80 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
|
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
|
Keepass2Android is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Keepass2Android is distributed in the hope that it will be useful,
|
Keepass2Android is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
|
|
||||||
namespace keepass2android.view
|
namespace keepass2android.view
|
||||||
{
|
{
|
||||||
public class FileNameView : RelativeLayout {
|
public class FileSelectButtons : RelativeLayout {
|
||||||
|
|
||||||
public FileNameView(Context context):this(context,null) {
|
public FileSelectButtons(Context context):this(context,null) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileNameView(Context context, Android.Util.IAttributeSet attrs)
|
public FileSelectButtons(Context context, Android.Util.IAttributeSet attrs)
|
||||||
:base(context, attrs)
|
:base(context, attrs)
|
||||||
{
|
{
|
||||||
inflate(context);
|
inflate(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileNameView (IntPtr javaReference, JniHandleOwnership transfer)
|
public FileSelectButtons (IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
: base(javaReference, transfer)
|
: base(javaReference, transfer)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inflate(Context context) {
|
private void inflate(Context context) {
|
||||||
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
|
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
|
||||||
inflater.Inflate(Resource.Layout.file_selection_filename, this);
|
inflater.Inflate(Resource.Layout.file_selection_buttons, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateExternalStorageWarning() {
|
public void updateExternalStorageWarning() {
|
||||||
int warning = -1;
|
int warning = -1;
|
||||||
String state = Android.OS.Environment.ExternalStorageState;
|
String state = Android.OS.Environment.ExternalStorageState;
|
||||||
if (state.Equals(Android.OS.Environment.MediaMountedReadOnly)) {
|
if (state.Equals(Android.OS.Environment.MediaMountedReadOnly)) {
|
||||||
warning = Resource.String.warning_read_only;
|
warning = Resource.String.warning_read_only;
|
||||||
} else if (!state.Equals(Android.OS.Environment.MediaMounted)) {
|
} else if (!state.Equals(Android.OS.Environment.MediaMounted)) {
|
||||||
warning = Resource.String.warning_unmounted;
|
warning = Resource.String.warning_unmounted;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView tv = (TextView) FindViewById(Resource.Id.label_warning);
|
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) {
|
||||||
if (warning != -1) {
|
tv.SetText(warning);
|
||||||
tv.SetText(warning);
|
tv.Visibility = ViewStates.Visible;
|
||||||
tv.Visibility = ViewStates.Visible;
|
|
||||||
|
|
||||||
lp.AddRule(LayoutRules.Below, Resource.Id.label_warning);
|
} else {
|
||||||
} else {
|
tv.Visibility = ViewStates.Invisible;
|
||||||
tv.Visibility = ViewStates.Invisible;
|
|
||||||
|
}
|
||||||
}
|
|
||||||
label.LayoutParameters = lp;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -62,7 +62,7 @@ namespace keepass2android.view
|
|||||||
LayoutInflater inflater = (LayoutInflater) Context.GetSystemService(Context.LayoutInflaterService);
|
LayoutInflater inflater = (LayoutInflater) Context.GetSystemService(Context.LayoutInflaterService);
|
||||||
inflater.Inflate(Resource.Layout.group_add_entry, this);
|
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;
|
addEntry.Visibility = ViewStates.Invisible;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ namespace keepass2android.view
|
|||||||
|
|
||||||
View divider2 = FindViewById(Resource.Id.divider2);
|
View divider2 = FindViewById(Resource.Id.divider2);
|
||||||
divider2.Visibility = ViewStates.Invisible;
|
divider2.Visibility = ViewStates.Invisible;
|
||||||
|
|
||||||
|
FindViewById(Resource.Id.bottom_bar).Visibility = ViewStates.Invisible;
|
||||||
|
|
||||||
View list = FindViewById(Android.Resource.Id.List);
|
View list = FindViewById(Android.Resource.Id.List);
|
||||||
LayoutParams lp = (RelativeLayout.LayoutParams) list.LayoutParameters;
|
LayoutParams lp = (RelativeLayout.LayoutParams) list.LayoutParameters;
|
||||||
|