Esempio n. 1
0
        private PwGroupView(GroupBaseActivity act, PwGroup pw)
            : base(act)
        {
            _groupBaseActivity = act;

            View gv = Inflate(act, Resource.Layout.group_list_entry, null);

            _textview = (TextView)gv.FindViewById(Resource.Id.group_text);
            float size = PrefsUtil.GetListTextSize(act);

            _textview.TextSize = size;

            _label          = (TextView)gv.FindViewById(Resource.Id.group_label);
            _label.TextSize = size - 8;

            Database db = App.Kp2a.FindDatabaseForElement(pw);

            gv.FindViewById(Resource.Id.group_icon_bkg).Visibility = db.DrawableFactory.IsWhiteIconSet ? ViewStates.Visible : ViewStates.Gone;

            gv.FindViewById(Resource.Id.icon).Visibility       = ViewStates.Visible;
            gv.FindViewById(Resource.Id.check_mark).Visibility = ViewStates.Invisible;

            PopulateView(gv, pw);

            LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);

            AddView(gv, lp);
        }
        private PwEntryView(GroupBaseActivity groupActivity, PwEntry pw, int pos) : base(groupActivity)
        {
            _groupActivity = groupActivity;

            View ev = Inflate(groupActivity, Resource.Layout.entry_list_entry, null);

            _textView          = (TextView)ev.FindViewById(Resource.Id.entry_text);
            _textView.TextSize = PrefsUtil.GetListTextSize(groupActivity);


            ev.FindViewById(Resource.Id.entry_icon_bkg).Visibility = App.Kp2a.GetDb().DrawableFactory.IsWhiteIconSet ?  ViewStates.Visible : ViewStates.Gone;

            _textviewDetails          = (TextView)ev.FindViewById(Resource.Id.entry_text_detail);
            _textviewDetails.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity);

            _textgroupFullPath          = (TextView)ev.FindViewById(Resource.Id.group_detail);
            _textgroupFullPath.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity);

            _showDetail = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean(
                groupActivity.GetString(Resource.String.ShowUsernameInList_key),
                Resources.GetBoolean(Resource.Boolean.ShowUsernameInList_default));

            _showGroupFullPath = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean(
                groupActivity.GetString(Resource.String.ShowGroupnameInSearchResult_key),
                Resources.GetBoolean(Resource.Boolean.ShowGroupnameInSearchResult_default));

            _isSearchResult = _groupActivity is keepass2android.search.SearchResults;


            PopulateView(ev, pw, pos);

            LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

            AddView(ev, lp);
        }
Esempio n. 3
0
        private PwEntryView(GroupBaseActivity groupActivity, PwEntry pw, int pos) : base(groupActivity)
        {
            _groupActivity = groupActivity;

            View ev = Inflate(groupActivity, Resource.Layout.entry_list_entry, null);

            _textView          = (TextView)ev.FindViewById(Resource.Id.entry_text);
            _textView.TextSize = PrefsUtil.GetListTextSize(groupActivity);

            Database db;

            try
            {
                db = App.Kp2a.FindDatabaseForElement(pw);
            }
            catch (Exception e)
            {
                //for some reason, since Android 12 we get here when the database is reloaded (after making remote changes and selecting sync)
                //we can just ignore this.
                Console.WriteLine(e);
                return;
            }


            ev.FindViewById(Resource.Id.entry_icon_bkg).Visibility = db.DrawableFactory.IsWhiteIconSet ?  ViewStates.Visible : ViewStates.Gone;

            _textviewDetails          = (TextView)ev.FindViewById(Resource.Id.entry_text_detail);
            _textviewDetails.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity);

            _textgroupFullPath          = (TextView)ev.FindViewById(Resource.Id.group_detail);
            _textgroupFullPath.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity);

            _showDetail = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean(
                groupActivity.GetString(Resource.String.ShowUsernameInList_key),
                Resources.GetBoolean(Resource.Boolean.ShowUsernameInList_default));

            _showGroupFullPath = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean(
                groupActivity.GetString(Resource.String.ShowGroupnameInSearchResult_key),
                Resources.GetBoolean(Resource.Boolean.ShowGroupnameInSearchResult_default));

            _isSearchResult = _groupActivity is keepass2android.search.SearchResults;


            PopulateView(ev, pw, pos);

            LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

            AddView(ev, lp);
        }