protected virtual void RebuildLayoutDueToScrollViewSizeChange()
        {
            MarkViewsHoldersForRebuild(_VisibleItems);
            ClearCachedRecyclableItems();

            Canvas.ForceUpdateCanvases();

            _Collocation.InitIfNeeded(this);

            _InternalState.CacheScrollViewInfo();             // update vp size etc.
            _ItemsDesc.maxVisibleItemsSeenSinceLastScrollViewSizeChange = 0;
            _ItemsDesc.destroyedItemsSinceLastScrollViewSizeChange      = 0;

            Refresh();
        }
Esempio n. 2
0
        /// <summary>
        /// <para>Called mainly when it's detected that the scroll view's size has changed. Marks everything for a layout rebuild and then calls Canvas.ForceUpdateCanvases(). </para>
        /// <para>IMPORTANT: Make sure to override <see cref="AbstractViewsHolder.MarkForRebuild"/> in your views holder implementation if you have child layout groups and call LayoutRebuilder.MarkForRebuild() on them</para>
        /// </summary>
        protected virtual void RebuildLayoutDueToScrollViewSizeChange()
        {
            //float viewportSizeBefore = _InternalState.viewportSize;

            MarkViewsHoldersForRebuild(_VisibleItems);
            //MarkViewsHoldersForRebuild(_RecyclableItems);
            ClearCachedRecyclableItems();

            Canvas.ForceUpdateCanvases();

            _Params.InitIfNeeded(this);
            if (_Params.Snapper)
            {
                _Params.Snapper.Adapter = this;
            }

            _InternalState.CacheScrollViewInfo();             // update vp size etc.
            _ItemsDesc.maxVisibleItemsSeenSinceLastScrollViewSizeChange = 0;
            _ItemsDesc.destroyedItemsSinceLastScrollViewSizeChange      = 0;
            //_InternalState.layoutRebuildPendingDueToScrollViewSizeChangeEvent = false;

            //float viewportSizeChange = _InternalState.viewportSize - viewportSizeBefore;

            Refresh();

            //if (_InternalState.lastComputeVisibilityHadATwinPass)
            //{
            //	// This fixes some items not appearing after rotation to portrait (in the chat demo)
            //	ComputeVisibilityForCurrentPosition(false, true, true, -.1f);
            //	ComputeVisibilityForCurrentPosition(true, true, true, .1f);
            //}

            //_InternalState.layoutIsBeingRebuildDueToScrollViewSizeChangeEvent = false;

            //_InternalState.OnItemsCountChanged(_ItemsDesc.itemsCount, false);
            //ComputeVisibilityForCurrentPosition(true, true, true);
            //if (!_CorrectedPositionInCurrentComputeVisibilityPass)
            //	CorrectPositionsOfVisibleItems(true);

            //Refresh();
        }