コード例 #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.edits_list, container, false);

            //create adapter for edits:

            _adapter = new EditAdapter(Activity, Bootlegger.BootleggerClient.MyEdits, Bootlegger.BootleggerClient.CurrentEvent);
            _adapter.HasStableIds = true;
            _adapter.OnShare     += _adapter_OnShare;
            _adapter.OnEdit      += _adapter_OnEdit;
            _adapter.OnPreview   += _adapter_OnPreview;
            _adapter.OnDelete    += _adapter_OnDelete;
            //_adapter.OnRestart += _adapter_OnRestart;
            _adapter.OnRefresh += _adapter_OnRefresh;

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



            var listView       = view.FindViewById <RecyclerView>(Resource.Id.alledits);
            int cols           = Activity.Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape ? 2 : 1;
            var mLayoutManager = new GridLayoutManager(Activity, cols);

            mLayoutManager.SetSpanSizeLookup(new MySpanSizeLookup(_adapter, cols));
            //var mLayoutManager = new GridLayoutManager(container.Context,2);
            listView.SetLayoutManager(mLayoutManager);
            listView.SetAdapter(_adapter);
            theview = view;

            //listView.ScrollChange += ListView_ScrollChange;
            //RecyclerView.ItemAnimator animator = listView.GetItemAnimator();

            //if (animator is SimpleItemAnimator)
            //{
            //    ((SimpleItemAnimator)animator).SupportsChangeAnimations = false;
            //}

            listView.SetItemAnimator(null);

            listView.AddOnScrollListener(new PausableScrollListener(Context, _adapter));
            return(view);
        }
コード例 #2
0
            public ViewHolder(View itemView, EditAdapter adpt) : base(itemView)
            {
                view      = itemView;
                this.adpt = adpt;
                //view.Click += View_Click;

                if (view.FindViewById <ImageButton>(Resource.Id.popup) != null)
                {
                    view.FindViewById <ImageButton>(Resource.Id.popup).Click += ViewHolder_Click3;
                    if (adpt.CurrentEvent == null)
                    {
                        view.FindViewById <ImageButton>(Resource.Id.popup).Visibility = ViewStates.Gone;
                    }
                }

                //if (view.FindViewById<ImageButton>(Resource.Id.sharebtn)!=null)
                //    view.FindViewById<ImageButton>(Resource.Id.sharebtn).Click += ViewHolder_Click;
                //if (view.FindViewById<ImageButton>(Resource.Id.deletebtn) != null)
                //    view.FindViewById<ImageButton>(Resource.Id.deletebtn).Click += ViewHolder_Click1;
                //if (view.FindViewById<ImageButton>(Resource.Id.restartbtn) != null)
                //    view.FindViewById<ImageButton>(Resource.Id.restartbtn).Click += ViewHolder_Click2;

                view.Click += View_Click;
            }
コード例 #3
0
 public MySpanSizeLookup(Activity activity, EditAdapter adapter)
 {
     this.adapter  = adapter;
     this.Activity = activity;
 }
コード例 #4
0
 public MySpanSizeLookup(EditAdapter adapter, int collumns)
 {
     this.adapter  = adapter;
     this.collumns = collumns;
 }