Esempio n. 1
0
        protected override void OnAttachedToWindow()
        {
            base.OnAttachedToWindow();

            for (var i = 0; i < ChildCount; i++)
            {
                var child = GetChildAt(i);
                if (!IsViewInDrawer(child))
                {
                    continue;
                }

                Log.Debug(Tag, "at {0}", i);
                var foldingNavigationLayout = new BaseFoldingLayout(Context)
                {
                    AnchorFactor  = 1,
                    NumberOfFolds = _numberOfFolds
                };
                RemoveView(child);
                foldingNavigationLayout.AddView(child);
                var layoutParams = child.LayoutParameters;
                AddView(foldingNavigationLayout, i, layoutParams);
            }

            DrawerSlide += (s, e) =>
            {
                var foldingLayout = e.DrawerView as BaseFoldingLayout;
                if (foldingLayout == null)
                {
                    return;
                }

                foldingLayout.FoldFactor = 1 - e.SlideOffset;
            };
        }
Esempio n. 2
0
        private void InitView(Context context, IAttributeSet attrs)
        {
            var ta    = context.ObtainStyledAttributes(attrs, Resource.Styleable.FoldingLayout);
            var folds = ta.GetInt(Resource.Styleable.FoldingLayout_numberOfFolds,
                                  _numberOfFolds);

            if (folds > 0 && folds < 8)
            {
                _numberOfFolds = folds;
            }
            else
            {
                _numberOfFolds = 2;
            }
            ta.Recycle();

            _baseFoldingLayout = new BaseFoldingLayout(context)
            {
                NumberOfFolds = _numberOfFolds,
                AnchorFactor  = 0
            };
        }
        private void InitView(Context context, IAttributeSet attrs)
        {
            var ta = context.ObtainStyledAttributes(attrs, Resource.Styleable.FoldingLayout);
            var folds = ta.GetInt(Resource.Styleable.FoldingLayout_numberOfFolds,
                    _numberOfFolds);
            if (folds > 0 && folds < 8)
                _numberOfFolds = folds;
            else
                _numberOfFolds = 2;
            ta.Recycle();

            _baseFoldingLayout = new BaseFoldingLayout(context)
            {
                NumberOfFolds = _numberOfFolds,
                AnchorFactor = 0
            };
        }