Exemplo n.º 1
0
        void mMainView_Click(object sender, EventArgs e)
        {
            int position = _recyclerView.GetChildPosition((Android.Views.View)sender);
            var item     = Items.Cast <object> ().ElementAt(position);

            Element.InvokeItemSelectedEvent(this, item);
        }
Exemplo n.º 2
0
        public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
        {
            var firstVisibleView     = recyclerView.GetChildAt(0);
            var firstVisiblePosition = recyclerView.GetChildPosition(firstVisibleView);
            var visibleRange         = recyclerView.ChildCount;
            var lastVisiblePosition  = firstVisiblePosition + visibleRange;
            var itemCount            = recyclerView.GetAdapter().ItemCount;
            var position             = default(int);

            if (firstVisiblePosition == 0)
            {
                position = 0;
            }
            else if (lastVisiblePosition == itemCount - 1)
            {
                position = itemCount - 1;
            }
            else
            {
                position = firstVisiblePosition;
            }

            var proportion = position / (float)itemCount;

            FastScrollerLayout.SetPosition(FastScrollerLayout.Height * proportion);
        }
Exemplo n.º 3
0
            public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
            {
                View firstVisibleView     = recyclerView.GetChildAt(0);
                int  firstVisiblePosition = recyclerView.GetChildPosition(firstVisibleView);
                int  visibleRange         = recyclerView.ChildCount;
                int  lastVisiblePosition  = firstVisiblePosition + visibleRange;
                int  itemCount            = recyclerView.GetAdapter().ItemCount;
                int  position;

                if (firstVisiblePosition == 0)
                {
                    position = 0;
                }
                else if (lastVisiblePosition == itemCount - 1)
                {
                    position = itemCount - 1;
                }
                else
                {
                    position = firstVisiblePosition;
                }

                float proportion = (float)position / (float)itemCount;

                this.scroll.setPosition(scroll.height * proportion);
            }
Exemplo n.º 4
0
 public bool OnInterceptTouchEvent(RecyclerView rv, MotionEvent e)
 {
     View child = rv.FindChildViewUnder(e.GetX(), e.GetY());
     if (child != null && clickListener != null && gestureDetector.OnTouchEvent(e))
     {
         clickListener.OnClick(child, rv.GetChildPosition(child));
     }
     return false;
 }
Exemplo n.º 5
0
            void mMainView_Click(object sender, EventArgs e)
            {
                int position = mRecyclerView.GetChildPosition((View)sender);

                // THIS LINE OF CODE IS GARBAGE K? ......int indexPosition = (mStudyGroup.Count - 1) - position;
                Console.WriteLine("CLicked Study Group:" + mStudyGroup[position]._id + "Opening edit menu");


                //test
                thisFrag.createFragment(mStudyGroup[position], false);
            }
Exemplo n.º 6
0
        public bool OnInterceptTouchEvent(RecyclerView view, MotionEvent e)
        {
            var childView = view.FindChildViewUnder(e.GetX(), e.GetY());

            if (childView == null || !_getstureDetector.OnTouchEvent(e))
            {
                return(false);
            }
            var handler = ItemClickEvent;

            handler?.Invoke(this, new ItemClickEvent(childView, view.GetChildPosition(childView)));
            return(false);
        }
Exemplo n.º 7
0
 public RecyclerTouchListener(Context context, RecyclerView recyclerView, IOnClickListener clickListener)
 {
     this.clickListener = clickListener;
     var gestureListener = new GenericOnGestureListener();
     gestureListener.ActionOnLongPress = (e) =>
     {
         View child = recyclerView.FindChildViewUnder(e.GetX(), e.GetY());
         if (child != null && clickListener != null)
         {
             clickListener.OnLongClick(child, recyclerView.GetChildPosition(child));
         }
     };
     gestureListener.FuncOnSingleTapUp = (e) => true;
     gestureDetector = new GestureDetector(context, gestureListener);
 }
Exemplo n.º 8
0
		public override void GetItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
		{
			base.GetItemOffsets (outRect, view, parent, state);

			if (mDivider == null) {
				return;
			}
			if (parent.GetChildPosition (view) < 1) {
				return;
			}
			if (GetOrientation (parent) == LinearLayoutManager.Vertical) {
				outRect.Top = mDivider.IntrinsicHeight;
			} else {
				outRect.Left = mDivider.IntrinsicWidth;
			}
		}
Exemplo n.º 9
0
        public override void GetItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
        {
            base.GetItemOffsets(outRect, view, parent, state);

            if (mDivider == null)
            {
                return;
            }
            if (parent.GetChildPosition(view) < 1)
            {
                return;
            }
            if (GetOrientation(parent) == LinearLayoutManager.Vertical)
            {
                outRect.Top = mDivider.IntrinsicHeight;
            }
            else
            {
                outRect.Left = mDivider.IntrinsicWidth;
            }
        }
Exemplo n.º 10
0
            public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
            {
                View firstVisibleView 	= recyclerView.GetChildAt(0);
                int firstVisiblePosition = recyclerView.GetChildPosition(firstVisibleView);
                int visibleRange 		= recyclerView.ChildCount;
                int lastVisiblePosition = firstVisiblePosition + visibleRange;
                int itemCount 			= recyclerView.GetAdapter().ItemCount;
                int position;

                if(firstVisiblePosition==0)
                    position=0;
                else if(lastVisiblePosition==itemCount-1)
                    position = itemCount-1;
                else
                    position = firstVisiblePosition;

                float proportion=(float)position/(float)itemCount;
                this.scroll.setPosition(scroll.height*proportion);
            }