From 6095f32b0805c9dadad47a51b3c1b5a7c5f369fa Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Mon, 10 Aug 2015 15:39:34 +0200 Subject: [PATCH] GroupBaseActivity: Re-enable refresh of list after changes/sorting Fixed issues in QuickUnlock --- src/keepass2android/GroupBaseActivity.cs | 35 +++++++++++-------- src/keepass2android/QuickUnlock.cs | 5 +++ .../Resources/layout/QuickUnlock.xml | 2 ++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/keepass2android/GroupBaseActivity.cs b/src/keepass2android/GroupBaseActivity.cs index c81047a5..16113561 100644 --- a/src/keepass2android/GroupBaseActivity.cs +++ b/src/keepass2android/GroupBaseActivity.cs @@ -180,7 +180,9 @@ namespace keepass2android //TODO protected GroupView GroupView; private String strCachedGroupUuid = null; - public String UuidGroup { + + + public String UuidGroup { get { if (strCachedGroupUuid == null) { strCachedGroupUuid = MemUtil.ByteArrayToHexString (Group.Uuid.UuidBytes); @@ -210,13 +212,17 @@ namespace keepass2android Database db = App.Kp2a.GetDb(); if ( db.Dirty.Contains(Group) ) { db.Dirty.Remove(Group); - /*TODO BaseAdapter adapter = (BaseAdapter) ListAdapter; - adapter.NotifyDataSetChanged();*/ + ListAdapter.NotifyDataSetChanged(); } } - - /*TODO + + public BaseAdapter ListAdapter + { + get { return (BaseAdapter) FragmentManager.FindFragmentById(Resource.Id.list_fragment).ListAdapter; } + } + + /*TODO * protected override void OnListItemClick(ListView l, View v, int position, long id) { base.OnListItemClick(l, v, position, id); @@ -494,12 +500,11 @@ namespace keepass2android if (!String.IsNullOrEmpty(message)) Toast.MakeText(this, message, ToastLength.Long).Show(); - /*TODO - // Tell the adapter to refresh it's list + // Tell the adapter to refresh it's list BaseAdapter adapter = (BaseAdapter)ListAdapter; adapter.NotifyDataSetChanged(); - */ - if (App.Kp2a.GetDb().OtpAuxFileIoc != null) + + if (App.Kp2a.GetDb().OtpAuxFileIoc != null) { var task2 = new SyncOtpAuxFile(App.Kp2a.GetDb().OtpAuxFileIoc); new ProgressTask(App.Kp2a, this, task2).Run(); @@ -556,10 +561,10 @@ namespace keepass2android db.Dirty.Remove(Group); // Tell the adapter to refresh it's list - /*TODO + BaseAdapter adapter = (BaseAdapter)ListAdapter; adapter.NotifyDataSetChanged(); - */ + }) .SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ((Dialog)sender).Dismiss()) @@ -628,9 +633,9 @@ namespace keepass2android { ShowInsertElementButtons(); - /*TODOGroupView.ListView.InvalidateViews(); + //TODO Required? GroupView.ListView.InvalidateViews(); BaseAdapter adapter = (BaseAdapter)ListAdapter; - adapter.NotifyDataSetChanged();*/ + adapter.NotifyDataSetChanged(); } public void ShowInsertElementButtons() @@ -661,9 +666,9 @@ namespace keepass2android AppTask = new NullTask(); AppTask.SetupGroupBaseActivityButtons(this); - /*TODO GroupView.ListView.InvalidateViews(); + //TODO Required? GroupView.ListView.InvalidateViews(); BaseAdapter adapter = (BaseAdapter)ListAdapter; - adapter.NotifyDataSetChanged();*/ + adapter.NotifyDataSetChanged(); } diff --git a/src/keepass2android/QuickUnlock.cs b/src/keepass2android/QuickUnlock.cs index 8eae8699..2aa46a0b 100644 --- a/src/keepass2android/QuickUnlock.cs +++ b/src/keepass2android/QuickUnlock.cs @@ -104,6 +104,11 @@ namespace keepass2android OnUnlock(quickUnlockLength, pwd); }; + FindViewById(Resource.Id.unlock_img_button).Click += (sender, args) => + { + OnUnlock(quickUnlockLength, pwd); + }; + Button btnLock = (Button) FindViewById(Resource.Id.QuickUnlock_buttonLock); btnLock.Click += (object sender, EventArgs e) => { diff --git a/src/keepass2android/Resources/layout/QuickUnlock.xml b/src/keepass2android/Resources/layout/QuickUnlock.xml index ac462052..b54d7d6a 100644 --- a/src/keepass2android/Resources/layout/QuickUnlock.xml +++ b/src/keepass2android/Resources/layout/QuickUnlock.xml @@ -139,6 +139,8 @@ android:paddingRight="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="16dp" + android:layout_marginBottom="8dp" + android:layout_gravity="bottom" android:src="@drawable/ic_unlock" android:background="?android:selectableItemBackground" />