Пример #1
0
        protected override void OnDetached()
        {
            var renderer = Container as IVisualElementRenderer;
            if (renderer?.Element != null) {    // Disposeされているかの判定
                _view.Click -= OnClick;
                _view.Touch -= View_Touch;
                _view.LongClick -= OnLongClick;
                if (_useRipple) {
                    RemoveRipple();
                }
            }
            _command = null;
            _commandParameter = null;
            _longCommand = null;
            _longCommandParameter = null;
            _orgDrawable = null;
            _view = null;

            _rippleListener?.Dispose();
            _rippleListener = null;
            _rippleOverlay?.Dispose();
            _rippleOverlay = null;
            _layer?.Dispose();
            _layer = null;
            _ripple?.Dispose();
            _ripple = null;
        }
Пример #2
0
        protected override void OnDetached()
        {
            var renderer = Container as IVisualElementRenderer;

            if (renderer?.Element != null)
            {
                NativeButton.Background                = OrgBackground;
                NativeButton.StateListAnimator         = OrgStateListAnimator;
                NativeButton.SupportBackgroundTintList = OrgBackgroundTint;
            }
            Colors.Dispose();
            Shape.Dispose();
            Inset.Dispose();
            Ripple.Dispose();

            FormsButton          = null;
            NativeButton         = null;
            OrgBackground        = null;
            OrgStateListAnimator = null;
            OrgBackgroundTint    = null;

            Colors = null;
            Shape  = null;
            Ripple = null;
            Inset  = null;
        }
Пример #3
0
        protected override void OnDetached()
        {
            if (IsDisposed)
            {
                return;
            }

            Container.RemoveView(viewOverlay);
            viewOverlay.Pressed    = false;
            viewOverlay.Foreground = null;
            viewOverlay.Dispose();
            Container.LayoutChange -= ViewOnLayoutChange;

            if (timer != null)
            {
                timer.Elapsed -= OnTimerEvent;
                timer.Stop();
                timer.Close();
            }

            if (EnableRipple)
            {
                ripple?.Dispose();
            }

            View.Touch -= OnTouch;
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    _backgroundDrawable?.Dispose();
                    _backgroundDrawable = null;
                    _defaultDrawable?.Dispose();
                    _defaultDrawable = null;
                    _rippleDrawable?.Dispose();
                    _rippleDrawable = null;
                    if (BorderElement != null)
                    {
                        BorderElement.PropertyChanged -= BorderElementPropertyChanged;
                        BorderElement = null;
                    }

                    if (_renderer != null)
                    {
                        _renderer.ElementChanged -= OnElementChanged;
                        _renderer = null;
                    }
                }
                _disposed = true;
            }
        }
Пример #5
0
 protected override void OnDetached()
 {
     try
     {
         _effect.Control         = null;
         _effect                 = null;
         Container.LayoutChange -= LayoutChange;
         if (Container != null)
         {
             Container.Touch -= OnTouch;
         }
         if (Control != null)
         {
             Control.Touch -= OnTouch;
         }
         if (_viewOverlay != null)
         {
             Container.RemoveView(_viewOverlay);
             _viewOverlay.Pressed    = false;
             _viewOverlay.Foreground = null;
             _viewOverlay.Dispose();
             _ripple?.Dispose();
         }
     }
     catch (ObjectDisposedException)
     {
         //suppress exception
     }
     _isHoverSupported = false;
 }
        protected override void OnDetached()
        {
            if (!IsDisposed)
            {
                NativeButton.Background        = OrgBackground;
                NativeButton.StateListAnimator = OrgStateListAnimator;
                System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing");
            }
            Colors.Dispose();
            Shape.Dispose();
            Inset.Dispose();
            Ripple.Dispose();

            FormsButton          = null;
            NativeButton         = null;
            OrgBackground        = null;
            OrgStateListAnimator = null;

            Colors = null;
            Shape  = null;
            Ripple = null;
            Inset  = null;
            System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely");

            base.OnDetached();
        }
Пример #7
0
        private void RemoveRipple()
        {
            if (_viewOverlay != null)
            {
                _viewOverlay.Foreground = null;
            }

            _ripple?.Dispose();
            _ripple = null;
        }
Пример #8
0
        protected override void OnDetached()
        {
            if (effect?.Element == null)
            {
                return;
            }

            try
            {
                if (accessibilityManager != null && accessibilityListener != null)
                {
                    accessibilityManager.RemoveAccessibilityStateChangeListener(accessibilityListener);
                    accessibilityManager.RemoveTouchExplorationStateChangeListener(accessibilityListener);
                    accessibilityListener.Dispose();
                    accessibilityManager  = null;
                    accessibilityListener = null;
                }

                if (View != null)
                {
                    View.LayoutChange -= OnLayoutChange;
                    View.Touch        -= OnTouch;
                    View.Click        -= OnClick;

                    if (XCT.SdkInt >= (int)BuildVersionCodes.M && View.Foreground == ripple)
                    {
                        View.Foreground = null;
                    }
                }

                effect.Element = null;
                effect         = null;

                if (rippleView != null)
                {
                    rippleView.Pressed    = false;
                    rippleView.Background = null;
                    Group?.RemoveView(rippleView);
                    rippleView.Dispose();
                    rippleView = null;
                }

                ripple?.Dispose();
                ripple = null;
            }
            catch (ObjectDisposedException)
            {
                // Suppress exception
            }
            isHoverSupported = false;
        }
Пример #9
0
 public void OnDetached()
 {
     _track.Dispose();
     _thumb.Dispose();
     _background.Dispose();
     _background    = null;
     _orgBackground = null;
     _orgThumb      = null;
     _orgTrack      = null;
     _track         = null;
     _thumb         = null;
     _aSwitch       = null;
     _element       = null;
 }
Пример #10
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                CellBase.PropertyChanged   -= CellPropertyChanged;
                CellParent.PropertyChanged -= ParentPropertyChanged;
                CellButton1.Click          -= CellButton1_Click;
                CellButton2.Click          -= CellButton2_Click;
                CellButton3.Click          -= CellButton3_Click;

                if (CellBase.Section != null)
                {
                    CellBase.Section.PropertyChanged -= SectionPropertyChanged;
                    CellBase.Section = null;
                }

                CellTitle?.Dispose();
                CellTitle = null;
                CellTitleContent?.Dispose();
                CellTitleContent = null;
                CellAccessory?.Dispose();
                CellAccessory = null;
                CellButton1?.Dispose();
                CellButton1 = null;
                CellButton2?.Dispose();
                CellButton2 = null;
                CellButton3?.Dispose();
                CellButton3 = null;
                CellButtonContent?.Dispose();
                CellButtonContent = null;
                CellContent?.Dispose();
                CellContent = null;
                Cell        = null;

                _iconTokenSource?.Dispose();
                _iconTokenSource = null;
                _Context         = null;

                _backgroundColor?.Dispose();
                _backgroundColor = null;
                _selectedColor?.Dispose();
                _selectedColor = null;
                _ripple?.Dispose();
                _ripple = null;

                Background?.Dispose();
                Background = null;
            }
            base.Dispose(disposing);
        }
Пример #11
0
        protected override void OnDetached()
        {
            if (effect?.Element == null)
            {
                return;
            }

            try
            {
                if (accessibilityManager != null)
                {
                    accessibilityManager.RemoveAccessibilityStateChangeListener(accessibilityListener);
                    accessibilityManager.RemoveTouchExplorationStateChangeListener(accessibilityListener);
                    accessibilityListener.Dispose();
                    accessibilityManager = null;
                    accessibilityManager = null;
                }

                if (View != null)
                {
                    View.LayoutChange -= LayoutChange;
                    View.Touch        -= OnTouch;
                    View.Click        -= OnClick;
                }

                effect.Element = null;
                effect         = null;

                if (viewOverlay != null)
                {
                    if (Group != null)
                    {
                        Group.RemoveView(viewOverlay);
                    }

                    viewOverlay.Pressed    = false;
                    viewOverlay.Foreground = null;
                    viewOverlay.Dispose();
                    ripple?.Dispose();
                }
            }
            catch (ObjectDisposedException)
            {
                // Suppress exception
            }
            isHoverSupported = false;
        }
Пример #12
0
        protected override void OnDetached()
        {
            if (_effect?.Control == null)
            {
                return;
            }
            try
            {
                if (_accessibilityManager != null)
                {
                    _accessibilityManager.RemoveAccessibilityStateChangeListener(_accessibilityListener);
                    _accessibilityManager.RemoveTouchExplorationStateChangeListener(_accessibilityListener);
                    _accessibilityListener.Dispose();
                    _accessibilityManager = null;
                    _accessibilityManager = null;
                }

                if (View != null)
                {
                    View.LayoutChange -= LayoutChange;
                    View.Touch        -= OnTouch;
                    View.Click        -= OnClick;
                }

                _effect.Control = null;
                _effect         = null;

                if (_viewOverlay != null)
                {
                    if (Group != null)
                    {
                        Group.RemoveView(_viewOverlay);
                    }

                    _viewOverlay.Pressed    = false;
                    _viewOverlay.Foreground = null;
                    _viewOverlay.Dispose();
                    _ripple?.Dispose();
                }
            }
            catch (ObjectDisposedException)
            {
                //suppress exception
            }
            _isHoverSupported = false;
        }
Пример #13
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)
            {
                CellBase.PropertyChanged   -= CellPropertyChanged;
                CellParent.PropertyChanged -= ParentPropertyChanged;

                if (CellBase.Section != null)
                {
                    CellBase.Section.PropertyChanged -= SectionPropertyChanged;
                    CellBase.Section = null;
                }

                HintLabel?.Dispose();
                HintLabel = null;
                TitleLabel?.Dispose();
                TitleLabel = null;
                DescriptionLabel?.Dispose();
                DescriptionLabel = null;
                IconView?.SetImageDrawable(null);
                IconView?.SetImageBitmap(null);
                IconView?.Dispose();
                IconView = null;
                ContentStack?.Dispose();
                ContentStack = null;
                AccessoryStack?.Dispose();
                AccessoryStack = null;
                Cell           = null;

                _iconTokenSource?.Dispose();
                _iconTokenSource = null;
                _Context         = null;

                _backgroundColor?.Dispose();
                _backgroundColor = null;
                _selectedColor?.Dispose();
                _selectedColor = null;
                _ripple?.Dispose();
                _ripple = null;

                Background?.Dispose();
                Background = null;
            }
            base.Dispose(disposing);
        }
Пример #14
0
        protected override void OnDetached()
        {
            if (IsDisposed)
            {
                return;
            }

            Container.RemoveView(_viewOverlay);
            _viewOverlay.Pressed    = false;
            _viewOverlay.Foreground = null;
            _viewOverlay.Dispose();
            Container.LayoutChange -= ViewOnLayoutChange;

            if (EnableRipple)
            {
                _ripple?.Dispose();
            }

            TouchCollector.Delete(View, OnTouch);
        }
Пример #15
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             _backgroundDrawable?.Dispose();
             _backgroundDrawable = null;
             _defaultDrawable?.Dispose();
             _defaultDrawable = null;
             _rippleDrawable?.Dispose();
             _rippleDrawable = null;
             if (_button != null)
             {
                 _button.PropertyChanged -= ButtonPropertyChanged;
                 _button = null;
             }
             _nativeButton = null;
         }
         _disposed = true;
     }
 }
Пример #16
0
        protected override void OnDetached()
        {
            if (!IsDisposed)
            {
                NativeButton.Background        = OrgBackground;
                NativeButton.StateListAnimator = OrgStateListAnimator;
            }
            Colors.Dispose();
            Shape.Dispose();
            Inset.Dispose();
            Ripple.Dispose();

            FormsButton          = null;
            NativeButton         = null;
            OrgBackground        = null;
            OrgStateListAnimator = null;

            Colors = null;
            Shape  = null;
            Ripple = null;
            Inset  = null;
        }
Пример #17
0
        protected override void OnDetached()
        {
            if (!IsClickable)
            {
                if (view != null)
                {
                    view.Touch -= OnOverlayTouch;
                    view.RemoveOnLayoutChangeListener(fastListener);
                }

                if (fastListener != null)
                {
                    fastListener.Dispose();
                    fastListener = null;
                }

                if (rippleOverlay != null)
                {
                    rippleOverlay.Dispose();
                    rippleOverlay = null;
                }
            }
            else
            {
                if (view != null)
                {
                    view.Touch     -= OnViewTouch;
                    view.Background = orgDrawable;
                }

                orgDrawable = null;
            }

            ripple?.Dispose();
            ripple = null;

            view = null;
        }
Пример #18
0
 void RemoveRipple()
 {
     _viewOverlay.Foreground = null;
     _ripple?.Dispose();
     _ripple = null;
 }