Ejemplo n.º 1
0
            public ViewHolder(View itemView, ClipAdapter adpt, List <Topic> options) : base(itemView)
            {
                this.options = options;
                view         = itemView;
                this.adpt    = adpt;
                //itemView.Click += ItemView_Click;
                if (itemView.FindViewById <ImageButton>(Resource.Id.choosebtn) != null)
                {
                    itemView.FindViewById <ImageButton>(Resource.Id.choosebtn).Click += ViewHolder_Click;
                }

                if (view.FindViewById <ImageView>(Resource.Id.image) != null)
                {
                    view.FindViewById <ImageView>(Resource.Id.image).Click += ItemView_Click;
                }

                if (itemView.FindViewById <RecyclerView>(Resource.Id.list) != null)
                {
                    var rv = itemView.FindViewById <RecyclerView>(Resource.Id.list);
                    rv.SetLayoutManager(new LinearLayoutManager(adpt.context, LinearLayoutManager.Horizontal, false));
                    chips = new ChipAdapter(adpt.context, true);
                    rv.SetAdapter(chips);
                }
            }
Ejemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view;

            if (ChooserMode == ClipViewMode.INGEST)
            {
                view = inflater.Inflate(Resource.Layout.clips_list_themes, container, false);
            }
            else
            {
                view = inflater.Inflate(Resource.Layout.clips_list, container, false);
            }

            view.FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh).Refresh += MyEditsFragment_Refresh;

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

            if (ChooserMode == ClipViewMode.EDITING)
            {
                cols = 3;
            }

            listAdapter = new ClipAdapter(Activity, new Dictionary <string, List <MediaItem> >(), ChooserMode, Bootlegger.BootleggerClient.CurrentEvent.topics.ToList());

            listAdapter.OnPreview += _adatper_OnPreview;
            listAdapter.OnChosen  += ListAdapter_OnChosen;

            var mLayoutManager = new GridLayoutManager(Activity, cols);

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

            view.FindViewById <View>(Resource.Id.emptytext).Visibility = ViewStates.Gone;

            var listView = view.FindViewById <RecyclerView>(Resource.Id.allclips);

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

            listView = view.FindViewById <RecyclerView>(Resource.Id.allclips);
            listView.HasFixedSize = true;

            theview = view;

            if (ChooserMode == ClipViewMode.INGEST)
            {
                view.FindViewById <FloatingActionButton>(Resource.Id.continuebtn).Click += AllClipsFragment_Click;
            }
            else if (ChooserMode == ClipViewMode.EDITING)
            {
                //setup filters for topics:


                var rv = view.FindViewById <RecyclerView>(Resource.Id.list);
                rv.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false));

                var chips = new ChipAdapter(Activity, false);
                chips.Update(Bootlegger.BootleggerClient.CurrentEvent.topics.ToList(), null);
                rv.SetAdapter(chips);
                chips.OnTopicFilterChanged += Chips_OnTopicFilterChanged;

                view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.filtertoolbar).SetTitle(Resource.String.selectavideotoinsert);

                view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.filtertoolbar).InflateMenu(Resource.Menu.selectclip);
                view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.filtertoolbar).MenuItemClick += AllClipsFragment_MenuItemClick;
            }
            else
            {
                view.FindViewById(Resource.Id.filtertoolbar).Visibility = ViewStates.Gone;
            }

            listView.AddOnScrollListener(new PausableScrollListener(Context, listAdapter));

            return(view);
        }
Ejemplo n.º 3
0
 public MySpanSizeLookup(ClipAdapter adapter, int collumns)
 {
     this.adapter  = adapter;
     this.collumns = collumns;
 }