protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _scroller?.Dispose();
                _scroller = null;

                RecyclerView.RemoveOnScrollListener(_scrollListener);
                _scrollListener?.Dispose();
                _scrollListener = null;

                Adapter?.Dispose();
                Adapter = null;

                LayoutManager?.Dispose();
                LayoutManager = null;

                ((IListViewController)Element).ScrollToRequested -= OnScrollToRequested;
            }

            _disposed = true;
            base.Dispose(disposing);
        }
Exemple #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _layoutManager?.Dispose();
                _childAdapter?.Dispose();
                NameView?.Dispose();
                ProductRecyclerView?.Dispose();
            }

            base.Dispose(disposing);
        }
Exemple #3
0
        public void LinearLayoutManagerConstructor()
        {
            tlog.Debug(tag, $"LinearLayoutManagerConstructor START");

            var testingTarget = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <LinearLayoutManager>(testingTarget, "should be an instance of testing target class!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutManagerConstructor END (OK)");
        }
Exemple #4
0
        public void LinearLayoutManagerFirstCompleteVisibleItemPosition()
        {
            tlog.Debug(tag, $"LinearLayoutManagerFirstCompleteVisibleItemPosition START");

            var testingTarget = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <LinearLayoutManager>(testingTarget, "should be an instance of testing target class!");
            Assert.AreEqual(testingTarget.FirstCompleteVisibleItemPosition, -1, "should be equal to 0.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutManagerFirstCompleteVisibleItemPosition END (OK)");
        }
Exemple #5
0
        public void LinearLayoutManagerCanScrollVertically()
        {
            tlog.Debug(tag, $"LinearLayoutManagerCanScrollVertically START");

            var testingTarget = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <LinearLayoutManager>(testingTarget, "should be an instance of testing target class!");
            Assert.IsFalse(testingTarget.CanScrollVertically(), "should be false.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutManagerCanScrollVertically END (OK)");
        }
Exemple #6
0
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _parentPage.Appearing -= ParentPageAppearing;
         _adapter?.Dispose();
         _adapter = null;
         _layoutManager?.Dispose();
         _layoutManager = null;
         _simpleCallback?.Dispose();
         _simpleCallback = null;
         _itemTouchhelper?.Dispose();
         _itemTouchhelper = null;
     }
     base.Dispose(disposing);
 }
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <VirtualListView> e)
        {
            base.OnElementChanged(e);

            // Clean up old
            if (e.OldElement != null)
            {
                // Unsubscribe from event handlers and cleanup any resources
                if (recyclerView?.Parent is ViewGroup vg)
                {
                    vg.RemoveView(recyclerView);
                }

                recyclerView.SetAdapter(null);
                recyclerView.Dispose();
                recyclerView = null;
                adapter.Dispose();
                adapter = null;
                layoutManager.Dispose();
                layoutManager = null;
            }

            // Setup new
            if (e.NewElement != null)
            {
                // Create the native control
                if (Control == null)
                {
                    recyclerView  = new RecyclerView(Context);
                    layoutManager = new LinearLayoutManager(Context);
                    //layoutManager.Orientation = LinearLayoutManager.Horizontal;

                    var templateSelector = CreateTemplateSelector();

                    adapter = new RvAdapter(Context, e.NewElement.Adapter);
                    adapter.TemplateSelector = templateSelector;
                    adapter.Element          = e.NewElement;

                    recyclerView.SetLayoutManager(layoutManager);
                    recyclerView.SetAdapter(adapter);
                    recyclerView.LayoutParameters = new LayoutParams(
                        LayoutParams.MatchParent, LayoutParams.MatchParent);

                    SetNativeControl(recyclerView);
                }
            }
        }
        public void OrientationHelperGetTotalSpaceChange()
        {
            tlog.Debug(tag, $"OrientationHelperGetTotalSpaceChange START");

            var testingTarget = new LinearLayoutManager(LinearLayoutManager.VERTICAL);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <LinearLayoutManager>(testingTarget, "should be an instance of testing target class!");

            try
            {
                testingTarget.orientationHelper.GetTotalSpaceChange();
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"OrientationHelperGetTotalSpaceChange END (OK)");
        }