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);
        }
예제 #2
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);
        }