Esempio n. 1
0
            //####################################################################################

            public ListFeedAttachmentAdapter(Context context, LinearLayout parent, FeedEntry entry)
            {
                _context = context;
                _entry   = entry;

                _thisPreview      = null;
                _thisPreviewRatio = -1;

                Inflate(parent);
            }
Esempio n. 2
0
            //####################################################################################

            private void Inflate(LinearLayout parent)
            {
                parent.RemoveAllViews();
                if (_entry.Attachments.Count == 0)
                {
                    return;
                }

                bool firstItem = true;

                foreach (var item in _entry.Attachments)
                {
                    if (firstItem)
                    {
                        //PreviewHolder erstellen
                        _thisPreview = new PreviewViewholder
                        {
                            CONVERTVIEW = LayoutInflater.FromContext(_context).Inflate(Resource.Layout.list_feedEntry_preview, parent, false)
                        };

                        _thisPreview.PANEL_PREVIEW         = _thisPreview.CONVERTVIEW.FindViewById(Resource.Id.panel_preview);
                        _thisPreview.PANEL_FIRSTATTACHMENT = _thisPreview.CONVERTVIEW.FindViewById(Resource.Id.panel_button);

                        _thisPreview.TXT_PREVIEWHINT = _thisPreview.CONVERTVIEW.FindViewById <TextView>(Resource.Id.txt_previewHint);

                        _thisPreview.PREVIEW_IMAGE    = _thisPreview.CONVERTVIEW.FindViewById <ImageView>(Resource.Id.img_preview);
                        _thisPreview.PREVIEW_PROGRESS = _thisPreview.CONVERTVIEW.FindViewById <ProgressBar>(Resource.Id.progress_preview);

                        _thisPreview.BTN_FIRST_ATTACHMENT             = _thisPreview.CONVERTVIEW.FindViewById <Button>(Resource.Id.btn_attachment);
                        _thisPreview.PROGRESS_FIRST_ATTACHMENT        = _thisPreview.CONVERTVIEW.FindViewById <ProgressBar>(Resource.Id.progress_working);
                        _thisPreview.PANEL_FIRSTATTACHMENT.Visibility = ViewStates.Gone;

                        _thisPreview.DIVIDER_FIRSTITEM = _thisPreview.CONVERTVIEW.FindViewById(Resource.Id.divider_firstitem);
                        if (_entry.Attachments.Count == 1)
                        {
                            _thisPreview.DIVIDER_FIRSTITEM.Visibility = ViewStates.Gone;
                        }
                        else
                        {
                            _thisPreview.DIVIDER_FIRSTITEM.Visibility = ViewStates.Visible;
                        }

                        //Preview an Events koppeln
                        CreateButton(_thisPreview.BTN_FIRST_ATTACHMENT, _thisPreview.PROGRESS_FIRST_ATTACHMENT, item);
                        CreatePreview(item);
                        parent.LayoutChange += Parent_LayoutChange;

                        //Hinzufügen
                        parent.AddView(_thisPreview.CONVERTVIEW);
                        firstItem = false;
                    }
                    else
                    {
                        //Button erstellen
                        Viewholder hold = new Viewholder
                        {
                            CONVERTVIEW = LayoutInflater.FromContext(_context).Inflate(Resource.Layout.list_feedEntry_attachment, parent, false)
                        };

                        hold.BTN_ATTACHMENT     = hold.CONVERTVIEW.FindViewById <Button>(Resource.Id.btn_attachment);
                        hold.PROGRESS_INDICATOR = hold.CONVERTVIEW.FindViewById <ProgressBar>(Resource.Id.progress_working);

                        if (item.Title.ToLower().StartsWith("visualtemplateimage"))
                        {
                            break;
                        }
                        CreateButton(hold.BTN_ATTACHMENT, hold.PROGRESS_INDICATOR, item);

                        parent.AddView(hold.CONVERTVIEW);
                    }
                    firstItem = false;
                }
            }