Beispiel #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (Root != null)
                {
                    Root.ValueChanged -= HandleValueChangedEvent;
                }
                if (_observer != null)
                {
                    _observer.Changed     -= ObserverOnChanged;
                    _observer.Invalidated -= ObserverOnChanged;
                    _observer.Dispose();
                    _observer = null;
                }
                if (_dialogAdapter != null)
                {
                    _dialogAdapter.DeregisterListView();
                    _dialogAdapter.Dispose();
                    _dialogAdapter = null;
                }
                if (_list != null)
                {
                    _list.Dispose();
                    _list = null;
                }

                //lists can take up a huge numer of gref's, force a cleanup here as soon as we don't need these any longer
                GC.Collect(0);
            }
            base.Dispose(disposing);
        }
Beispiel #2
0
        protected void Init(IAttributeSet attrs, int defStyleRes)
        {
            var @params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            _list = new DividerAwareLinearLayout(this.Context, null);
            _list.LayoutParameters = @params;
            _list.Orientation      = Orientation.Vertical;
            AddFocusable();
            AddView(_list);

            LinearDialogStyleableResource.Initialise();

            TypedArray a = Context.ObtainStyledAttributes(attrs, LinearDialogStyleableResource.LinearDialogScrollViewStylableGroupId, defStyleRes, 0);

            if (LinearDialogStyleableResource.LinearDialogScrollViewDivider > -1)
            {
                _list.DividerDrawable = a.GetDrawable(LinearDialogStyleableResource.LinearDialogScrollViewDivider);
            }
            if (LinearDialogStyleableResource.LinearDialogScrollViewShowDividers > -1)
            {
                _list.ShowDividers = a.GetInt(LinearDialogStyleableResource.LinearDialogScrollViewShowDividers, DividerAwareLinearLayout.SHOW_DIVIDER_NONE);
            }
            if (LinearDialogStyleableResource.LinearDialogScrollDividerPadding > -1)
            {
                _list.DividerPadding = a.GetDimensionPixelSize(LinearDialogStyleableResource.LinearDialogScrollDividerPadding, 0);
            }
            if (LinearDialogStyleableResource.LinearDialogScrollDividerHeight > -1)
            {
                _list.DividerHeight = a.GetDimensionPixelSize(LinearDialogStyleableResource.LinearDialogScrollDividerHeight, 0);
            }
            if (LinearDialogStyleableResource.LinearDialogScrollItemBackgroundDrawable > -1)
            {
                ItemBackgroundDrawable = a.GetDrawable(LinearDialogStyleableResource.LinearDialogScrollItemBackgroundDrawable);
            }

            a.Recycle();
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (Root != null)
                {
                    Root.ValueChanged -= HandleValueChangedEvent;
                }
                if (_observer != null)
                {
                    _observer.Changed -= ObserverOnChanged;
                    _observer.Invalidated -= ObserverOnChanged;
                    _observer.Dispose();
                    _observer = null;
                }
                if (_dialogAdapter != null)
                {
                    _dialogAdapter.DeregisterListView();
                    _dialogAdapter.Dispose();
                    _dialogAdapter = null;
                }
                if (_list != null)
                {
                    _list.Dispose();
                    _list = null;
                }

                //lists can take up a huge numer of gref's, force a cleanup here as soon as we don't need these any longer
                GC.Collect(0);
            }
            base.Dispose(disposing);
        }
        protected void Init(IAttributeSet attrs, int defStyleRes)
        {
            var @params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            _list = new DividerAwareLinearLayout(this.Context, null);
            _list.LayoutParameters = @params;
            _list.Orientation = Orientation.Vertical;
            AddFocusable();
            AddView(_list);

            LinearDialogStyleableResource.Initialise();

            TypedArray a = Context.ObtainStyledAttributes(attrs, LinearDialogStyleableResource.LinearDialogScrollViewStylableGroupId, defStyleRes, 0);
            if (LinearDialogStyleableResource.LinearDialogScrollViewDivider > -1)
                _list.DividerDrawable = a.GetDrawable(LinearDialogStyleableResource.LinearDialogScrollViewDivider);
            if (LinearDialogStyleableResource.LinearDialogScrollViewShowDividers > -1)
                _list.ShowDividers = a.GetInt(LinearDialogStyleableResource.LinearDialogScrollViewShowDividers, DividerAwareLinearLayout.SHOW_DIVIDER_NONE);
            if (LinearDialogStyleableResource.LinearDialogScrollDividerPadding > -1)
                _list.DividerPadding = a.GetDimensionPixelSize(LinearDialogStyleableResource.LinearDialogScrollDividerPadding, 0);
            if (LinearDialogStyleableResource.LinearDialogScrollDividerHeight > -1)
                _list.DividerHeight = a.GetDimensionPixelSize(LinearDialogStyleableResource.LinearDialogScrollDividerHeight, 0);
            if (LinearDialogStyleableResource.LinearDialogScrollItemBackgroundDrawable > -1)
                ItemBackgroundDrawable = a.GetDrawable(LinearDialogStyleableResource.LinearDialogScrollItemBackgroundDrawable);

            a.Recycle();
        }