Пример #1
0
        public PwGroupListAdapter(GroupBaseActivity act, PwGroup group)
        {
            _act   = act;
            _group = group;


            FilterAndSort();
        }
Пример #2
0
        public override void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
        {
            base.StartInGroupActivity(groupBaseActivity);

            if (GroupIsFound(groupBaseActivity))               // Group has been found: display toaster and stop here

            {
                if (ToastEnable)
                {
                    String toastMessage = groupBaseActivity.GetString(Resource.String.NavigationToGroupCompleted_message, new Java.Lang.Object[] { FullGroupName });

                    Toast.MakeText(groupBaseActivity, toastMessage, ToastLength.Long).Show();
                }

                groupBaseActivity.StartTask(TaskToBeLaunchedAfterNavigation);
                return;
            }
            else if ((groupBaseActivity.FullGroupId != null) && _fullGroupIds.Contains(groupBaseActivity.FullGroupId.FullId))                 // Need to down up in groups tree

            // Get next Group Uuid
            {
                var linkedListNode = _fullGroupIds.Find(groupBaseActivity.FullGroupId.FullId);
                if (linkedListNode != null)
                {
                    //Note: Resharper says there is a possible NullRefException.
                    //This is not the case because it was checked above if we're already there or not.
                    String nextGroupFullId = linkedListNode.Next.Value;

                    ElementAndDatabaseId fullId = new ElementAndDatabaseId(nextGroupFullId);

                    PwUuid nextGroupPwUuid = new PwUuid(MemUtil.HexStringToByteArray(fullId.ElementIdString));

                    // Create Group Activity
                    PwGroup nextGroup = App.Kp2a.GetDatabase(fullId.DatabaseId).GroupsById[nextGroupPwUuid];
                    GroupActivity.Launch(groupBaseActivity, nextGroup, this, new ActivityLaunchModeRequestCode(0));
                }
                return;
            }
            else                 // Need to go up in groups tree
            {
                ElementAndDatabaseId fullId = new ElementAndDatabaseId(_fullGroupIds.Last.Value);
                var targetDb = App.Kp2a.GetDatabase(fullId.DatabaseId);
                if (App.Kp2a.CurrentDb != targetDb)
                {
                    App.Kp2a.CurrentDb = targetDb;
                    GroupActivity.Launch(groupBaseActivity, targetDb.Root, this, new ActivityLaunchModeForward());
                }
                else
                {
                    SetActivityResult(groupBaseActivity, KeePass.ExitNormal);
                }
                groupBaseActivity.Finish();
            }
        }
Пример #3
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (AppTask.TryGetFromActivityResult(data, ref AppTask))
            {
                //make sure the app task is passed to the calling activity
                AppTask.SetActivityResult(this, KeePass.ExitNormal);
            }

            if ((GroupEditActivity.RequestCodeGroupEdit == requestCode) && (resultCode == Result.Ok))
            {
                String groupName         = data.Extras.GetString(GroupEditActivity.KeyName);
                int    groupIconId       = data.Extras.GetInt(GroupEditActivity.KeyIconId);
                PwUuid groupCustomIconId =
                    new PwUuid(MemUtil.HexStringToByteArray(data.Extras.GetString(GroupEditActivity.KeyCustomIconId)));
                String            strGroupUuid = data.Extras.GetString(GroupEditActivity.KeyGroupUuid);
                GroupBaseActivity act          = this;
                Handler           handler      = new Handler();
                RunnableOnFinish  task;
                if (strGroupUuid == null)
                {
                    task = AddGroup.GetInstance(this, App.Kp2a, groupName, groupIconId, groupCustomIconId, Group, new RefreshTask(handler, this), false);
                }
                else
                {
                    PwUuid groupUuid = new PwUuid(MemUtil.HexStringToByteArray(strGroupUuid));
                    task = new EditGroup(this, App.Kp2a, groupName, (PwIcon)groupIconId, groupCustomIconId, App.Kp2a.GetDb().Groups[groupUuid],
                                         new RefreshTask(handler, this));
                }
                ProgressTask pt = new ProgressTask(App.Kp2a, act, task);
                pt.Run();
            }

            if (resultCode == KeePass.ExitCloseAfterTaskComplete)
            {
                AppTask.SetActivityResult(this, KeePass.ExitCloseAfterTaskComplete);
                Finish();
            }

            if (resultCode == KeePass.ExitReloadDb)
            {
                AppTask.SetActivityResult(this, KeePass.ExitReloadDb);
                Finish();
            }
        }
Пример #4
0
        public override void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
        {
            base.StartInGroupActivity(groupBaseActivity);

            if (GroupIsFound(groupBaseActivity))               // Group has been found: display toaster and stop here

            {
                if (ToastEnable)
                {
                    String toastMessage = groupBaseActivity.GetString(Resource.String.NavigationToGroupCompleted_message, new Java.Lang.Object[] { FullGroupName });

                    Toast.MakeText(groupBaseActivity, toastMessage, ToastLength.Long).Show();
                }

                groupBaseActivity.StartTask(TaskToBeLaunchedAfterNavigation);
                return;
            }
            else if (_groupUuid.Contains(groupBaseActivity.UuidGroup))                 // Need to go up in groups tree

            // Get next Group Uuid
            {
                var linkedListNode = _groupUuid.Find(groupBaseActivity.UuidGroup);
                if (linkedListNode != null)
                {
                    //Note: Resharper says there is a possible NullRefException.
                    //This is not the case because it was checked above if we're already there or not.
                    String nextGroupUuid   = linkedListNode.Next.Value;
                    PwUuid nextGroupPwUuid = new PwUuid(MemUtil.HexStringToByteArray(nextGroupUuid));

                    // Create Group Activity
                    PwGroup nextGroup = App.Kp2a.GetDb().Groups [nextGroupPwUuid];
                    GroupActivity.Launch(groupBaseActivity, nextGroup, this);
                }
                return;
            }
            else                 // Need to go down in groups tree
            {
                SetActivityResult(groupBaseActivity, KeePass.ExitNormal);
                groupBaseActivity.Finish();
            }
        }
 public AfterDeleteGroup(Handler handler, GroupBaseActivity act)
     : base(handler)
 {
     _act = act;
 }
Пример #6
0
 public OnQueryTextListener(GroupBaseActivity activity)
 {
     _activity = activity;
 }
Пример #7
0
 public AfterDeleteGroup(Handler handler, GroupBaseActivity act)
     : base(handler)
 {
     _act = act;
 }
Пример #8
0
 public override void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
 {
     base.StartInGroupActivity(groupBaseActivity);
     groupBaseActivity.StartMovingElements();
 }
Пример #9
0
 public virtual void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
 {
 }
Пример #10
0
 public override void SetupGroupBaseActivityButtons(GroupBaseActivity groupBaseActivity)
 {
 }
Пример #11
0
 public virtual void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
 {
 }
Пример #12
0
 public virtual void SetupGroupBaseActivityButtons(GroupBaseActivity groupBaseActivity)
 {
     groupBaseActivity.SetupNormalButtons();
 }
Пример #13
0
 public RefreshTask(Handler handler, GroupBaseActivity act)
     : base(act, handler)
 {
 }
Пример #14
0
 public OnQueryTextListener(GroupBaseActivity activity)
 {
     _activity = activity;
 }
Пример #15
0
 public SuggestionListener(Android.Support.V4.Widget.CursorAdapter suggestionsAdapter, GroupBaseActivity activity, IMenuItem searchItem)
 {
     _suggestionsAdapter = suggestionsAdapter;
     _activity           = activity;
     _searchItem         = searchItem;
 }
Пример #16
0
 public AfterDeleteGroup(Handler handler, GroupBaseActivity act)
     : base(act, handler)
 {
 }
Пример #17
0
 public override void SetupGroupBaseActivityButtons(GroupBaseActivity groupBaseActivity)
 {
     groupBaseActivity.ShowInsertElementButtons();
 }
Пример #18
0
 public override void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
 {
     base.StartInGroupActivity(groupBaseActivity);
     groupBaseActivity.StartMovingElement();
 }
Пример #19
0
 public bool GroupIsFound(GroupBaseActivity groupBaseActivity)
 {
     return(_groupUuid.Last.Value.Equals(groupBaseActivity.UuidGroup));
 }
Пример #20
0
 public bool GroupIsFound(GroupBaseActivity groupBaseActivity)
 {
     return _groupUuid.Last.Value.Equals (groupBaseActivity.UuidGroup);
 }
Пример #21
0
 public virtual void SetupGroupBaseActivityButtons(GroupBaseActivity groupBaseActivity)
 {
     groupBaseActivity.SetupNormalButtons();
 }
Пример #22
0
 public override void SetupGroupBaseActivityButtons(GroupBaseActivity groupBaseActivity)
 {
 }
Пример #23
0
 public override void SetupGroupBaseActivityButtons(GroupBaseActivity groupBaseActivity)
 {
     groupBaseActivity.ShowInsertElementsButtons();
 }
Пример #24
0
        public override void StartInGroupActivity(GroupBaseActivity groupBaseActivity)
        {
            base.StartInGroupActivity(groupBaseActivity);

            if (GroupIsFound(groupBaseActivity) ){ // Group has been found: display toaster and stop here

                if (ToastEnable) {
                    String toastMessage = groupBaseActivity.GetString (Resource.String.NavigationToGroupCompleted_message, new Java.Lang.Object[] { FullGroupName});

                    Toast.MakeText (groupBaseActivity, toastMessage, ToastLength.Long).Show ();
                }

                groupBaseActivity.StartTask (TaskToBeLaunchedAfterNavigation);
                return;

            } else if (_groupUuid.Contains(groupBaseActivity.UuidGroup)) { // Need to go up in groups tree

                // Get next Group Uuid
                var linkedListNode = _groupUuid.Find(groupBaseActivity.UuidGroup);
                if (linkedListNode != null)
                {
                    //Note: Resharper says there is a possible NullRefException.
                    //This is not the case because it was checked above if we're already there or not.
                    String nextGroupUuid = linkedListNode.Next.Value;
                    PwUuid nextGroupPwUuid = new PwUuid (MemUtil.HexStringToByteArray (nextGroupUuid));

                    // Create Group Activity
                    PwGroup nextGroup = App.Kp2a.GetDb ().Groups [nextGroupPwUuid];
                    GroupActivity.Launch (groupBaseActivity, nextGroup, this);
                }
                return;

            } else { // Need to go down in groups tree
                SetActivityResult(groupBaseActivity, KeePass.ExitNormal);
                groupBaseActivity.Finish();

            }
        }
Пример #25
0
 public RefreshTask(Handler handler, GroupBaseActivity act)
     : base(handler)
 {
     _act = act;
 }
Пример #26
0
        public bool GroupIsFound(GroupBaseActivity groupBaseActivity)
        {
            var fullId = groupBaseActivity.FullGroupId;

            return(fullId != null && _fullGroupIds.Last.Value.Equals(fullId.FullId));
        }
Пример #27
0
 public SuggestionListener(CursorAdapter suggestionsAdapter, GroupBaseActivity activity, IMenuItem searchItem)
 {
     _suggestionsAdapter = suggestionsAdapter;
     _activity = activity;
     _searchItem = searchItem;
 }
Пример #28
0
 public RefreshTask(Handler handler, GroupBaseActivity act)
     : base(handler)
 {
     _act = act;
 }