GroupBaseActivity: Re-enable refresh of list after changes/sorting

Fixed issues in QuickUnlock
This commit is contained in:
Philipp Crocoll 2015-08-10 15:39:34 +02:00
parent 0ef2378ddc
commit 6095f32b08
3 changed files with 27 additions and 15 deletions

View File

@ -180,7 +180,9 @@ namespace keepass2android
//TODO protected GroupView GroupView; //TODO protected GroupView GroupView;
private String strCachedGroupUuid = null; private String strCachedGroupUuid = null;
public String UuidGroup {
public String UuidGroup {
get { get {
if (strCachedGroupUuid == null) { if (strCachedGroupUuid == null) {
strCachedGroupUuid = MemUtil.ByteArrayToHexString (Group.Uuid.UuidBytes); strCachedGroupUuid = MemUtil.ByteArrayToHexString (Group.Uuid.UuidBytes);
@ -210,13 +212,17 @@ namespace keepass2android
Database db = App.Kp2a.GetDb(); Database db = App.Kp2a.GetDb();
if ( db.Dirty.Contains(Group) ) { if ( db.Dirty.Contains(Group) ) {
db.Dirty.Remove(Group); db.Dirty.Remove(Group);
/*TODO BaseAdapter adapter = (BaseAdapter) ListAdapter; ListAdapter.NotifyDataSetChanged();
adapter.NotifyDataSetChanged();*/
} }
} }
/*TODO public BaseAdapter ListAdapter
{
get { return (BaseAdapter) FragmentManager.FindFragmentById<GroupListFragment>(Resource.Id.list_fragment).ListAdapter; }
}
/*TODO
* protected override void OnListItemClick(ListView l, View v, int position, long id) { * protected override void OnListItemClick(ListView l, View v, int position, long id) {
base.OnListItemClick(l, v, position, id); base.OnListItemClick(l, v, position, id);
@ -494,12 +500,11 @@ namespace keepass2android
if (!String.IsNullOrEmpty(message)) if (!String.IsNullOrEmpty(message))
Toast.MakeText(this, message, ToastLength.Long).Show(); 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; BaseAdapter adapter = (BaseAdapter)ListAdapter;
adapter.NotifyDataSetChanged(); adapter.NotifyDataSetChanged();
*/
if (App.Kp2a.GetDb().OtpAuxFileIoc != null) if (App.Kp2a.GetDb().OtpAuxFileIoc != null)
{ {
var task2 = new SyncOtpAuxFile(App.Kp2a.GetDb().OtpAuxFileIoc); var task2 = new SyncOtpAuxFile(App.Kp2a.GetDb().OtpAuxFileIoc);
new ProgressTask(App.Kp2a, this, task2).Run(); new ProgressTask(App.Kp2a, this, task2).Run();
@ -556,10 +561,10 @@ namespace keepass2android
db.Dirty.Remove(Group); db.Dirty.Remove(Group);
// Tell the adapter to refresh it's list // Tell the adapter to refresh it's list
/*TODO
BaseAdapter adapter = (BaseAdapter)ListAdapter; BaseAdapter adapter = (BaseAdapter)ListAdapter;
adapter.NotifyDataSetChanged(); adapter.NotifyDataSetChanged();
*/
}) })
.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ((Dialog)sender).Dismiss()) .SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ((Dialog)sender).Dismiss())
@ -628,9 +633,9 @@ namespace keepass2android
{ {
ShowInsertElementButtons(); ShowInsertElementButtons();
/*TODOGroupView.ListView.InvalidateViews(); //TODO Required? GroupView.ListView.InvalidateViews();
BaseAdapter adapter = (BaseAdapter)ListAdapter; BaseAdapter adapter = (BaseAdapter)ListAdapter;
adapter.NotifyDataSetChanged();*/ adapter.NotifyDataSetChanged();
} }
public void ShowInsertElementButtons() public void ShowInsertElementButtons()
@ -661,9 +666,9 @@ namespace keepass2android
AppTask = new NullTask(); AppTask = new NullTask();
AppTask.SetupGroupBaseActivityButtons(this); AppTask.SetupGroupBaseActivityButtons(this);
/*TODO GroupView.ListView.InvalidateViews(); //TODO Required? GroupView.ListView.InvalidateViews();
BaseAdapter adapter = (BaseAdapter)ListAdapter; BaseAdapter adapter = (BaseAdapter)ListAdapter;
adapter.NotifyDataSetChanged();*/ adapter.NotifyDataSetChanged();
} }

View File

@ -104,6 +104,11 @@ namespace keepass2android
OnUnlock(quickUnlockLength, pwd); OnUnlock(quickUnlockLength, pwd);
}; };
FindViewById(Resource.Id.unlock_img_button).Click += (sender, args) =>
{
OnUnlock(quickUnlockLength, pwd);
};
Button btnLock = (Button) FindViewById(Resource.Id.QuickUnlock_buttonLock); Button btnLock = (Button) FindViewById(Resource.Id.QuickUnlock_buttonLock);
btnLock.Click += (object sender, EventArgs e) => btnLock.Click += (object sender, EventArgs e) =>
{ {

View File

@ -139,6 +139,8 @@ android:paddingRight="16dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginBottom="8dp"
android:layout_gravity="bottom"
android:src="@drawable/ic_unlock" android:src="@drawable/ic_unlock"
android:background="?android:selectableItemBackground" /> android:background="?android:selectableItemBackground" />