mirror of
https://github.com/moparisthebest/keepass2android
synced 2025-02-07 02:10:10 -05:00
* fixed bug in SearchResults.cs: _db was always null
* refactoring of GroupView: removed GroupAddEntryView.cs, renamed GroupViewOnlyView.cs to GroupView with added method to set button visibility * introduced AppTask for moving an element (but not yet implemented/used)
This commit is contained in:
parent
4cbc4542c2
commit
55e81ab25b
@ -110,16 +110,12 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
SetupButtons ();
|
||||
|
||||
GroupView groupView = new GroupView(this);
|
||||
|
||||
SetContentView (groupView);
|
||||
groupView.SetNormalButtonVisibility(AddGroupEnabled, AddEntryEnabled);
|
||||
|
||||
if (AddGroupEnabled && AddEntryEnabled) {
|
||||
SetContentView (new GroupAddEntryView (this));
|
||||
} else if (AddGroupEnabled) {
|
||||
SetContentView (new GroupRootView (this));
|
||||
} else if (AddEntryEnabled) {
|
||||
throw new Exception ("This mode is not supported.");
|
||||
} else {
|
||||
SetContentView (new GroupViewOnlyView (this));
|
||||
}
|
||||
if (AddGroupEnabled) {
|
||||
// Add Group button
|
||||
View addGroup = FindViewById (Resource.Id.add_group);
|
||||
|
@ -75,7 +75,8 @@ namespace keepass2android
|
||||
protected PwGroup Group;
|
||||
|
||||
internal AppTask AppTask;
|
||||
|
||||
private GroupView _groupView;
|
||||
|
||||
protected override void OnResume() {
|
||||
base.OnResume();
|
||||
|
||||
@ -119,8 +120,10 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
_prefs = PreferenceManager.GetDefaultSharedPreferences(this);
|
||||
|
||||
SetContentView(new GroupViewOnlyView(this));
|
||||
|
||||
_groupView = new GroupView(this);
|
||||
SetContentView(_groupView);
|
||||
_groupView.SetNormalButtonVisibility(false, false);
|
||||
SetResult(KeePass.ExitNormal);
|
||||
|
||||
StyleScrollBars();
|
||||
|
811
src/keepass2android/Resources/Resource.designer.cs
generated
811
src/keepass2android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,27 @@
|
||||
android:text="@string/add_entry"
|
||||
android:drawableLeft="@drawable/device_access_new_account"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/insert_element"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/insert_element_here"
|
||||
android:visibility="gone"
|
||||
android:drawableLeft="@drawable/btn_new_group"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/cancel_insert_element"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/insert_element"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/cancel"
|
||||
android:visibility="gone"
|
||||
android:drawableLeft="@android:drawable/ic_menu_close_clear_cancel"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/divider2"
|
||||
|
@ -168,6 +168,7 @@
|
||||
<string name="search_in">Search in</string>
|
||||
<string name="select_other_entry">Select another entry</string>
|
||||
<string name="select_group_then_add">Open the desired group, then press "%1$s"!</string>
|
||||
<string name="insert_element_here">Insert here</string>
|
||||
<string name="twofish">Twofish</string>
|
||||
<string name="underline">Underline</string>
|
||||
<string name="unsupported_db_version">Unsupported database version.</string>
|
||||
@ -296,14 +297,13 @@
|
||||
|
||||
<string name="ChangeLog_title">Change log</string>
|
||||
<string name="ChangeLog_0_8_5">
|
||||
<b>Version 0.8.5 preview</b>\n
|
||||
<b>Version 0.8.5</b>\n
|
||||
* Remote files are stored in the local application cache to allow offline usage (including editing and later synchronization). See settings. \n
|
||||
* Notification icon to visualize the lock-state of the database (see settings)\n
|
||||
* Improved determination of lock-state in some situations\n
|
||||
* Database files are loaded to memory while you are typing your password for increased loading speed (see settings)\n
|
||||
* Entries can be added to root group\n
|
||||
* Bug fixes (resolving reference fields, problems with keyboard on Italian an Chinese devices)\n
|
||||
Please Note: this is a preview intended for testing! Please report any problems on keepass2android.codeplex.com.
|
||||
* Bug fixes (resolving reference fields, problems with keyboard on Italian an Chinese devices)
|
||||
</string>
|
||||
<string name="ChangeLog_0_8_4">
|
||||
<b>Version 0.8.4</b>\n
|
||||
|
@ -143,12 +143,10 @@ namespace keepass2android
|
||||
//show results:
|
||||
if (Group == null || (!Group.Entries.Any()))
|
||||
{
|
||||
//SetContentView(new GroupEmptyView(this));
|
||||
SetContentView(Resource.Layout.searchurlresults_empty);
|
||||
} else
|
||||
{
|
||||
SetContentView(Resource.Layout.searchurlresults);
|
||||
//SetContentView(new GroupViewOnlyView(this));
|
||||
}
|
||||
|
||||
SetGroupTitle();
|
||||
|
@ -20,6 +20,7 @@ using Android.OS;
|
||||
using System.Collections.Generic;
|
||||
using KeePassLib;
|
||||
using KeePassLib.Security;
|
||||
using KeePassLib.Utility;
|
||||
|
||||
namespace keepass2android
|
||||
{
|
||||
@ -253,6 +254,32 @@ namespace keepass2android
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// User is about to move an entry or group to another group
|
||||
/// </summary>
|
||||
public class MoveElementTask: AppTask
|
||||
{
|
||||
public const String UuidKey = "MoveElement_Uuid";
|
||||
|
||||
public PwUuid Uuid
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override void Setup(Bundle b)
|
||||
{
|
||||
Uuid = new PwUuid(MemUtil.HexStringToByteArray(b.GetString(UuidKey)));
|
||||
}
|
||||
public override IEnumerable<IExtra> Extras
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new StringExtra { Key = UuidKey, Value = MemUtil.ByteArrayToHexString(Uuid.UuidBytes) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// User is about to create a new entry. The task might already "know" some information about the contents.
|
||||
|
@ -99,8 +99,7 @@
|
||||
<Compile Include="LockCloseListActivity.cs" />
|
||||
<Compile Include="LockingListActivity.cs" />
|
||||
<Compile Include="views\ClickView.cs" />
|
||||
<Compile Include="views\GroupViewOnlyView.cs" />
|
||||
<Compile Include="views\GroupAddEntryView.cs" />
|
||||
<Compile Include="views\GroupView.cs" />
|
||||
<Compile Include="views\GroupRootView.cs" />
|
||||
<Compile Include="PwGroupListAdapter.cs" />
|
||||
<Compile Include="views\PwGroupView.cs" />
|
||||
|
@ -34,7 +34,7 @@ namespace keepass2android.search
|
||||
[IntentFilter(new[]{Intent.ActionSearch}, Categories=new[]{Intent.CategoryDefault})]
|
||||
public class SearchResults : GroupBaseActivity
|
||||
{
|
||||
private Database _db;
|
||||
private GroupView _groupView;
|
||||
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
@ -80,8 +80,9 @@ namespace keepass2android.search
|
||||
private void Query (SearchParameters searchParams)
|
||||
{
|
||||
try {
|
||||
Group = _db.Search (searchParams, null);
|
||||
Group = App.Kp2a.GetDb().Search (searchParams, null);
|
||||
} catch (Exception e) {
|
||||
Kp2aLog.Log(e.ToString());
|
||||
Toast.MakeText(this,e.Message, ToastLength.Long).Show();
|
||||
Finish();
|
||||
return;
|
||||
@ -91,10 +92,14 @@ namespace keepass2android.search
|
||||
|
||||
if ( Group == null || (!Group.Entries.Any()) ) {
|
||||
SetContentView(new GroupEmptyView(this));
|
||||
} else {
|
||||
SetContentView(new GroupViewOnlyView(this));
|
||||
} else
|
||||
{
|
||||
_groupView = new GroupView(this);
|
||||
SetContentView(_groupView);
|
||||
_groupView.SetNormalButtonVisibility(false, false);
|
||||
}
|
||||
|
||||
|
||||
SetGroupTitle();
|
||||
|
||||
ListAdapter = new PwGroupListAdapter(this, Group);
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
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 Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.Util;
|
||||
|
||||
namespace keepass2android.view
|
||||
{
|
||||
|
||||
public class GroupAddEntryView : RelativeLayout
|
||||
{
|
||||
public GroupAddEntryView (IntPtr javaReference, JniHandleOwnership transfer)
|
||||
: base(javaReference, transfer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GroupAddEntryView(Context context): base(context) {
|
||||
Inflate(context);
|
||||
}
|
||||
|
||||
public GroupAddEntryView(Context context, IAttributeSet attrs): base(context, attrs) {
|
||||
Inflate(context);
|
||||
}
|
||||
|
||||
private void Inflate(Context context) {
|
||||
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
|
||||
inflater.Inflate(Resource.Layout.group_add_entry, this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,48 +24,63 @@ using Android.Widget;
|
||||
|
||||
namespace keepass2android.view
|
||||
{
|
||||
public class GroupViewOnlyView : RelativeLayout
|
||||
public class GroupView : RelativeLayout
|
||||
{
|
||||
public GroupViewOnlyView (IntPtr javaReference, JniHandleOwnership transfer)
|
||||
public GroupView (IntPtr javaReference, JniHandleOwnership transfer)
|
||||
: base(javaReference, transfer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GroupViewOnlyView(Context context): base(context) {
|
||||
Inflate(context);
|
||||
}
|
||||
public GroupView(Context context): base(context) {
|
||||
Inflate(context);
|
||||
}
|
||||
|
||||
public GroupViewOnlyView(Context context, IAttributeSet attrs): base(context, attrs) {
|
||||
Inflate(context);
|
||||
}
|
||||
public GroupView(Context context, IAttributeSet attrs): base(context, attrs) {
|
||||
Inflate(context);
|
||||
}
|
||||
|
||||
private void Inflate(Context context) {
|
||||
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
|
||||
inflater.Inflate(Resource.Layout.group_add_entry, this);
|
||||
private void Inflate(Context context) {
|
||||
LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
|
||||
inflater.Inflate(Resource.Layout.group_add_entry, this);
|
||||
|
||||
// Hide the buttons
|
||||
|
||||
}
|
||||
public void SetNormalButtonVisibility(bool showAddGroup, bool showAddEntry)
|
||||
{
|
||||
if (!showAddGroup)
|
||||
{
|
||||
View addGroup = FindViewById(Resource.Id.add_group);
|
||||
addGroup.Visibility = ViewStates.Invisible;
|
||||
|
||||
addGroup.Visibility = ViewStates.Invisible;
|
||||
}
|
||||
|
||||
if (!showAddEntry)
|
||||
{
|
||||
View addEntry = FindViewById(Resource.Id.add_entry);
|
||||
addEntry.Visibility = ViewStates.Invisible;
|
||||
|
||||
addEntry.Visibility = ViewStates.Invisible;
|
||||
}
|
||||
|
||||
if (!showAddEntry && !showAddGroup)
|
||||
{
|
||||
View divider2 = FindViewById(Resource.Id.divider2);
|
||||
divider2.Visibility = ViewStates.Invisible;
|
||||
|
||||
FindViewById(Resource.Id.bottom_bar).Visibility = ViewStates.Invisible;
|
||||
|
||||
|
||||
View list = FindViewById(Android.Resource.Id.List);
|
||||
LayoutParams lp = (RelativeLayout.LayoutParams) list.LayoutParameters;
|
||||
|
||||
lp.AddRule(LayoutRules.AlignParentBottom, (int)LayoutRules.True);
|
||||
|
||||
|
||||
lp.AddRule(LayoutRules.AlignParentBottom, (int) LayoutRules.True);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ShowInsertButtons()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user