예제 #1
1
        public static void Launch(Activity act, PwEntry pw, AppTask appTask)
        {
            Intent i = new Intent(act, typeof(EntryEditActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());

            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
예제 #2
0
        private void RequiresRefresh()
        {
            Intent ret = new Intent();

            ret.PutExtra(KeyRefreshPos, _pos);
            _appTask.ToIntent(ret);
            SetResult(KeePass.ExitRefresh, ret);
        }
예제 #3
0
        void PerformSearch()
        {
            String searchString = ((EditText)FindViewById(Resource.Id.searchEditText)).Text;

            if (String.IsNullOrWhiteSpace(searchString))
            {
                return;
            }
            Intent searchIntent = new Intent(this, typeof(SearchResults));

            searchIntent.PutExtra("SearchInTitles", GetCheckBoxValue(Resource.Id.cbSearchInTitle));
            searchIntent.PutExtra("SearchInUrls", GetCheckBoxValue(Resource.Id.cbSearchInUrl));
            searchIntent.PutExtra("SearchInPasswords", GetCheckBoxValue(Resource.Id.cbSearchInPassword));
            searchIntent.PutExtra("SearchInUserNames", GetCheckBoxValue(Resource.Id.cbSearchInUsername));
            searchIntent.PutExtra("SearchInNotes", GetCheckBoxValue(Resource.Id.cbSearchInNotes));
            searchIntent.PutExtra("SearchInGroupNames", GetCheckBoxValue(Resource.Id.cbSearchInGroupName));
            searchIntent.PutExtra("SearchInOther", GetCheckBoxValue(Resource.Id.cbSearchInOtherStrings));
            searchIntent.PutExtra("SearchInTags", GetCheckBoxValue(Resource.Id.cbSearchInTags));
            searchIntent.PutExtra("RegularExpression", GetCheckBoxValue(Resource.Id.cbRegEx));
            searchIntent.PutExtra("CaseSensitive", GetCheckBoxValue(Resource.Id.cbCaseSensitive));
            searchIntent.PutExtra("ExcludeExpired", GetCheckBoxValue(Resource.Id.cbExcludeExpiredEntries));
            searchIntent.PutExtra(SearchManager.Query, searchString);
            //forward appTask:
            _appTask.ToIntent(searchIntent);

            Util.FinishAndForward(this, searchIntent);
        }
예제 #4
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.menu_search_advanced:
                if (App.Kp2a.CurrentDb == null)
                {
                    App.Kp2a.CurrentDb = App.Kp2a.OpenDatabases.First();
                }
                Intent i = new Intent(this, typeof(SearchActivity));
                AppTask.ToIntent(i);
                StartActivityForResult(i, 0);
                return(true);

            case Resource.Id.menu_lock:
                App.Kp2a.Lock();
                return(true);

            case Resource.Id.menu_donate:
                return(Util.GotoDonateUrl(this));

            case Resource.Id.menu_app_settings:
                DatabaseSettingsActivity.Launch(this);
                return(true);

            default:
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }
예제 #5
0
        public override bool OnSearchRequested()
        {
            Intent i = new Intent(this, typeof(SearchActivity));

            AppTask.ToIntent(i);
            StartActivityForResult(i, 0);
            return(true);
        }
예제 #6
0
        private void LaunchNextActivity()
        {
            Intent intent = new Intent(this, typeof(SelectCurrentDbActivity));

            _appTask.ToIntent(intent);
            intent.AddFlags(ActivityFlags.ForwardResult);
            StartActivity(intent);
            Finish();
        }
예제 #7
0
        public override bool OnSearchRequested()
        {
            Intent i = new Intent(this, typeof(SearchActivity));

            AppTask.ToIntent(i);
            i.SetFlags(ActivityFlags.ForwardResult);
            StartActivity(i);
            return(true);
        }
예제 #8
0
        private void StartFileSelect(bool noForwardToPassword = false)
        {
            Intent intent = new Intent(this, typeof(FileSelectActivity));

            AppTask.ToIntent(intent);
            intent.PutExtra(FileSelectActivity.NoForwardToPasswordActivity, noForwardToPassword);
            LaunchingOther = true;
            StartActivityForResult(intent, ReqCodeOpenNewDb);
        }
예제 #9
0
        public static void Launch(Activity act, PwEntry pw, AppTask appTask)
        {
            Intent i = new Intent(act, typeof(EntryEditActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());

            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
예제 #10
0
        public static void Launch(Activity act, PwGroup g, AppTask appTask, ActivityLaunchMode launchMode)
        {
            Intent i = new Intent(act, typeof(GroupActivity));

            if (g != null)
            {
                i.PutExtra(KeyEntry, g.Uuid.ToHexString());
            }
            appTask.ToIntent(i);

            launchMode.Launch(act, i);
        }
예제 #11
0
        public static void Launch(Activity act, PwGroup pw, PwUuid templateUuid, AppTask appTask)
        {
            Intent i = new Intent(act, typeof(EntryEditActivity));

            PwGroup parent = pw;

            i.PutExtra(KeyParent, parent.Uuid.ToHexString());
            i.PutExtra(KeyTemplateUuid, templateUuid.ToHexString());

            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
예제 #12
0
        public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags?flags = null)
        {
            Intent i = new Intent(act, typeof(EntryActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());
            i.PutExtra(KeyRefreshPos, pos);

            if (flags != null)
            {
                i.SetFlags((ActivityFlags)flags);
            }

            appTask.ToIntent(i);
            if (flags != null && (((ActivityFlags)flags) | ActivityFlags.ForwardResult) == ActivityFlags.ForwardResult)
            {
                act.StartActivity(i);
            }
            else
            {
                act.StartActivityForResult(i, 0);
            }
        }
예제 #13
0
        public static void Launch(Activity act, PwGroup g, AppTask appTask)
        {
            // Need to use PwDatabase since group may be null
            PwDatabase db = App.Kp2a.GetDb().KpDatabase;

            if (db == null)
            {
                // Reached if db is null
                Log.Debug(Tag, "Tried to launch with null db");
                return;
            }

            Intent i = new Intent(act, typeof(GroupActivity));

            if (g != null)
            {
                i.PutExtra(KeyEntry, g.Uuid.ToHexString());
            }
            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
예제 #14
0
        private void LaunchNextActivity()
        {
            if (!App.Kp2a.GetDb().Loaded)
            {
                // Load default database
                ISharedPreferences prefs           = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(this);
                String             defaultFileName = prefs.GetString(PasswordActivity.KeyDefaultFilename, "");

                if (defaultFileName.Length > 0)
                {
                    try
                    {
                        PasswordActivity.Launch(this, LoadIoc(defaultFileName), _appTask);
                        Finish();
                        return;
                    }
                    catch (Exception e)
                    {
                        Toast.MakeText(this, e.Message, ToastLength.Long);
                        // Ignore exception
                    }
                }
            }
            else
            {
                PasswordActivity.Launch(this, App.Kp2a.GetDb().Ioc, _appTask);
                Finish();
                return;
            }

            Intent intent = new Intent(this, typeof(FileSelectActivity));

            _appTask.ToIntent(intent);
            intent.AddFlags(ActivityFlags.ForwardResult);
            StartActivity(intent);
            Finish();
        }
예제 #15
0
        public static void Launch(Activity act, PwGroup g, AppTask appTask)
        {
            // Need to use PwDatabase since group may be null
            PwDatabase db = App.Kp2a.GetDb().KpDatabase;

            if (db == null) {
                // Reached if db is null
                Log.Debug (Tag, "Tried to launch with null db");
                return;
            }

            Intent i = new Intent(act, typeof(GroupActivity));

            if ( g != null ) {
                i.PutExtra(KeyEntry, g.Uuid.ToHexString());
            }
            appTask.ToIntent(i);

            act.StartActivityForResult(i,0);
        }
예제 #16
0
        public static void Launch(Activity act, String fileName, AppTask appTask)
        {
            File dbFile = new File(fileName);
            if ( ! dbFile.Exists() ) {
                throw new FileNotFoundException();
            }

            Intent i = new Intent(act, typeof(PasswordActivity));
            i.SetFlags(ActivityFlags.ForwardResult);
            i.PutExtra(KeyFilename, fileName);
            appTask.ToIntent(i);

            act.StartActivity(i);
        }
예제 #17
0
        public static void Launch(Activity act, IOConnectionInfo ioc, AppTask appTask)
        {
            if (ioc.IsLocalFile())
            {
                Launch(act, ioc.Path, appTask);
                return;
            }

            Intent i = new Intent(act, typeof(PasswordActivity));

            PutIoConnectionToIntent(ioc, i);
            i.SetFlags(ActivityFlags.ForwardResult);

            appTask.ToIntent(i);

            act.StartActivity(i);
        }
예제 #18
0
        public static void Launch(Activity act, PwGroup pw, AppTask appTask)
        {
            Intent i = new Intent(act, typeof(EntryEditActivity));

            PwGroup parent = pw;
            i.PutExtra(KeyParent, parent.Uuid.ToHexString());

            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
예제 #19
0
        public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags? flags = null)
        {
            Intent i = new Intent(act, typeof(EntryActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());
            i.PutExtra(KeyRefreshPos, pos);

            if (flags != null)
                i.SetFlags((ActivityFlags) flags);

            appTask.ToIntent(i);
            if (flags != null && (((ActivityFlags) flags) | ActivityFlags.ForwardResult) == ActivityFlags.ForwardResult)
                act.StartActivity(i);
            else
                act.StartActivityForResult(i, 0);
        }