예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            this.rvRightDown = this.FindViewById <AligningRecyclerView>(Resource.Id.rv_right_down);
            this.rvRightDown.SetAdapter(new RvRightDownAdapter(this));
            var layoutManagerRightDown = new GridLayoutManager(this, 6);

            this.rvRightDown.SetLayoutManager(layoutManagerRightDown);

            this.rvLeftDown = this.FindViewById <AligningRecyclerView>(Resource.Id.rv_left_down);
            this.rvLeftDown.SetAdapter(new RvLeftDownAdapter(this));
            var layoutManagerLeftDown = new GridLayoutManager(this, 1);

            this.rvLeftDown.SetLayoutManager(layoutManagerLeftDown);

            this.rvLeftDown.bindTo(rvRightDown);
            this.rvRightDown.bindTo(rvLeftDown);

            this.horizontalScrollViewRightTop    = this.FindViewById <MyHorizontalScrollView>(Resource.Id.hv_right_top);
            this.horizontalScrollViewRightBottom = this.FindViewById <MyHorizontalScrollView>(Resource.Id.hv_right_down);

            this.horizontalScrollViewRightTop.Configure(this.horizontalScrollViewRightBottom, this.rvRightDown);
            this.horizontalScrollViewRightBottom.Configure(this.horizontalScrollViewRightTop, this.rvRightDown);
        }
        private void handleTouchEvent(AligningRecyclerView from, MotionEvent e, AligningRecyclerView to)
        {
            var action = e.Action;
            PositionTrackingOnScrollListener thisOSL = from.mOSL;

            if (action == MotionEventActions.Down && to.ScrollState == RecyclerView.ScrollStateIdle)
            {
                mLastY = thisOSL.ScrolledY;

                from.AddOnScrollListener(new CustomScrollListener(to));
            }
            else
            {
                int scrolledY = thisOSL.ScrolledY;

                if (action == MotionEventActions.Up && mLastY == scrolledY)
                {
                    from.ClearOnScrollListeners();
                }
            }
        }
 public CustomScrollListener(AligningRecyclerView to)
 {
     this.mTo = to;
 }
예제 #4
0
 public bool isBound(AligningRecyclerView target)
 {
     return(mOSLManager.relationshipExists(new AligningRecyclerViewRelationship(this, target)));
 }
예제 #5
0
 public bool bindTo(AligningRecyclerView target)
 {
     return(!isBound(target) && mOSLManager.createRelationship(new AligningRecyclerViewRelationship(this, target)));
 }