protected override void OnAttached() { _container = Container; _textView = new TextView(_context); _textView.SetMaxLines(1); _textView.SetMinLines(1); _textView.Ellipsize = Android.Text.TextUtils.TruncateAt.End; if (Element.IsFastRenderer()) { _container = new FrameLayout(_context); _fastListener = new FastRendererOnLayoutChangeListener(Control, _container); Control.AddOnLayoutChangeListener(_fastListener); } _container.AddView(_textView); _listener = new ContainerOnLayoutChangeListener(_textView, Element); _container.AddOnLayoutChangeListener(_listener); UpdateText(); UpdateFontSize(); UpdateTextColor(); UpdateBackgroundColor(); UpdatePadding(); UpdateLayout(_textView, Element, _container); }
protected override void OnDetached() { System.Diagnostics.Debug.WriteLine(Element.GetType().FullName); if (!IsDisposed) { _container.RemoveView(_textView); _container.RemoveOnLayoutChangeListener(_listener); if (Element.IsFastRenderer()) { Control.RemoveOnLayoutChangeListener(_fastListener); _fastListener.CleanUp(); } } _listener?.Dispose(); _listener = null; _textView.Dispose(); _textView = null; _fastListener?.Dispose(); _fastListener = null; }
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; }
protected override void OnDetached() { System.Diagnostics.Debug.WriteLine(Element.GetType().FullName); if (!IsDisposed) { _container.RemoveView(_textView); _container.RemoveOnLayoutChangeListener(_listener); if (IsFastRenderer) { Control.RemoveOnLayoutChangeListener(_fastListener); _fastListener.CleanUp(); } System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); } _listener?.Dispose(); _listener = null; _textView.Dispose(); _textView = null; _fastListener?.Dispose(); _fastListener = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); base.OnDetached(); }
protected override void OnDetached() { var renderer = Container as IVisualElementRenderer; if (renderer?.Element != null) // check is disposed { Container.RemoveOnLayoutChangeListener(_listener); } _listener.Dispose(); _listener = null; _textView.Dispose(); _textView = null; }
protected override void OnDetached() { System.Diagnostics.Debug.WriteLine(Element.GetType().FullName); if (!IsDisposed) { if (_useRipple) { RemoveRipple(); } if (_rippleOverlay != null) { _rippleOverlay.Touch -= _view_Touch; _rippleOverlay?.Dispose(); } _view.Touch -= _view_Touch; } if (_command != null) { _command.CanExecuteChanged -= CommandCanExecuteChanged; _command = null; } if (_longCommand != null) { _longCommand.CanExecuteChanged -= CommandCanExecuteChanged; _longCommand = null; } _commandParameter = null; _longCommandParameter = null; _orgDrawable = null; _view = null; _rippleListener?.Dispose(); _rippleListener = null; _rippleOverlay = null; _ripple?.Dispose(); _ripple = null; _useRipple = false; _gestureDetector?.Dispose(); _gestureDetector = null; _fastListener?.Dispose(); _fastListener = null; }
void AddRipple() { if (_ripple != null) { return; } if (Element is Layout || Element is BoxView) { _rippleOverlay = new FrameLayout(_view.Context); _rippleOverlay.LayoutParameters = new ViewGroup.LayoutParams(-1, -1); _rippleListener = new ContainerOnLayoutChangeListener(_rippleOverlay); _view.AddOnLayoutChangeListener(_rippleListener); (_view as ViewGroup).AddView(_rippleOverlay); _rippleOverlay.BringToFront(); _rippleOverlay.Foreground = CreateRipple(Color.Accent.ToAndroid()); _rippleOverlay.Clickable = true; _rippleOverlay.LongClickable = true; _view.Touch -= _view_Touch; _rippleOverlay.Touch += _view_Touch; } else if (IsFastRenderer) { if (_fastListener == null) { _fastListener = new FastRendererOnLayoutChangeListener(this); _view.AddOnLayoutChangeListener(_fastListener); _view.RequestLayout(); return; } _view.Foreground = CreateRipple(Color.Accent.ToAndroid()); _view.Touch += _view_Touch; } else { _orgDrawable = _view.Background; _view.Background = CreateRipple(Color.Accent.ToAndroid()); } }
protected override void OnAttached() { _textView = new TextView(Container.Context); _textView.SetMaxLines(1); _textView.SetMinLines(1); _textView.Ellipsize = Android.Text.TextUtils.TruncateAt.End; Container.AddView(_textView); _listener = new ContainerOnLayoutChangeListener(_textView, Element); Container.AddOnLayoutChangeListener(_listener); UpdateText(); UpdateFontSize(); UpdateTextColor(); UpdateBackgroundColor(); UpdatePadding(); Container.RequestLayout(); }
void AddRipple() { if (Element is Layout) { _rippleOverlay = new FrameLayout(Container.Context); _rippleOverlay.LayoutParameters = new ViewGroup.LayoutParams(-1, -1); _rippleListener = new ContainerOnLayoutChangeListener(_rippleOverlay); _view.AddOnLayoutChangeListener(_rippleListener); (_view as ViewGroup).AddView(_rippleOverlay); _rippleOverlay.BringToFront(); _rippleOverlay.Foreground = CreateRipple(Color.Accent.ToAndroid()); } else { _orgDrawable = _view.Background; _view.Background = CreateRipple(Color.Accent.ToAndroid()); } }