示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            if (IsFinishing) {
                return;
            }

            SetResult (KeePass.ExitNormal);

            Log.Warn (Tag, "Creating group view");
            Intent intent = Intent;

            PwUuid id = RetrieveGroupId (intent);

            Database db = App.Kp2a.GetDb();
            if (id == null) {
                Group = db.Root;
            } else {
                Group = db.Groups[id];
            }

            Log.Warn (Tag, "Retrieved group");
            if (Group == null) {
                Log.Warn (Tag, "Group was null");
                return;
            }

            if (AddGroupEnabled) {
                // Add Group button
                View addGroup = FindViewById (Resource.Id.add_group);
                addGroup.Click += (sender, e) => {
                    GroupEditActivity.Launch (this, Group);
                };
            }

            if (AddEntryEnabled) {
                // Add Entry button
                View addEntry = FindViewById (Resource.Id.add_entry);
                addEntry.Click += (sender, e) => {
                    EntryEditActivity.Launch (this, Group, AppTask);

                };
            }

            SetGroupTitle();
            SetGroupIcon();

            ListAdapter = new PwGroupListAdapter(this, Group);
            RegisterForContextMenu(ListView);
            Log.Warn(Tag, "Finished creating group");
        }
示例#2
0
        private void Query(SearchParameters searchParams)
        {
            try {
                Group = App.Kp2a.GetDb().Search (searchParams, null);
            } catch (Exception e) {
                Kp2aLog.Log(e.ToString());
                Toast.MakeText(this,e.Message, ToastLength.Long).Show();
                Finish();
                return;
            }

            if ( Group == null || (!Group.Entries.Any()) ) {
                SetContentView(new GroupEmptyView(this));
            }

            SetGroupTitle();

            ListAdapter = new PwGroupListAdapter(this, Group);
        }