public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            theview = inflater.Inflate(Resource.Layout.myclips, container, false);

            _adapter = new MyClipsAdapter(Activity, Bootlegger.BootleggerClient.UploadQueueEditing, Bootlegger.BootleggerClient.MyMediaEditing);
            _adapter.OnRefreshClips += _adapter_OnRefreshClips;
            _adapter.OnUpload       += _adapter_OnUpload;

            _adapter.HasStableIds = true;

            var listView = theview.FindViewById <RecyclerView>(Resource.Id.myclips);

            var cols = Activity.Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape ? 3 : 2;

            var mLayoutManager = new GridLayoutManager(Activity, cols);

            spanLookup = new MySpanSizeLookup(_adapter, cols);
            mLayoutManager.SetSpanSizeLookup(spanLookup);

            listView.SetLayoutManager(mLayoutManager);
            listView.SetAdapter(_adapter);
            listView.SetItemAnimator(null);

            theview.FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh).Refresh += MyClipsFragment_Refresh;

            _adapter.OnDelete  += _adapter_OnDelete;
            _adapter.OnPreview += _adapter_OnPreview;

            listView.AddOnScrollListener(new PausableScrollListener(Context, _adapter));
            return(theview);
        }
Beispiel #2
0
            public ViewHolder(View itemView, MyClipsAdapter adpt) : base(itemView)
            {
                view      = itemView;
                this.adpt = adpt;

                if (view.FindViewById <ImageButton>(Resource.Id.deletebtn) != null)
                {
                    view.FindViewById <ImageButton>(Resource.Id.deletebtn).Click += ViewHolder_Click;
                    view.Click += ViewHolder_Click1;
                }

                if (view.FindViewById(Resource.Id.syncnow) != null)
                {
                    adpt.OnSyncStatusChanged += Adpt_OnSyncStatusChanged;
                    view.FindViewById <Button>(Resource.Id.syncnow).Click += (obj, args) =>
                    {
                        //initiate sync:
                        adpt.FireRefreshClips();
                    };
                }

                if (view.FindViewById(Resource.Id.uploadbtn) != null)
                {
                    view.FindViewById <Button>(Resource.Id.uploadbtn).Click += (o, e) => { adpt.FireUpload(); };
                }
            }
 public MySpanSizeLookup(MyClipsAdapter adapter, int collumns)
 {
     this.adapter  = adapter;
     this.collumns = collumns;
 }