public async override void ViewDidLoad() { base.ViewDidLoad(); SubscribeSyncCompleted(); NavItem.Title = AppResources.Items; CancelBarButton.Title = AppResources.Cancel; TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 44; TableView.BackgroundColor = ThemeHelpers.BackgroundColor; TableView.Source = new TableSource(this); await((TableSource)TableView.Source).LoadItemsAsync(); _alreadyLoadItemsOnce = true; var storageService = ServiceContainer.Resolve <IStorageService>("storageService"); var needsAutofillReplacement = await storageService.GetAsync <bool?>( Core.Constants.AutofillNeedsIdentityReplacementKey); if (needsAutofillReplacement.GetValueOrDefault()) { await ASHelpers.ReplaceAllIdentities(); } _accountSwitchingOverlayHelper = new AccountSwitchingOverlayHelper(); AccountSwitchingBarButton.Image = await _accountSwitchingOverlayHelper.CreateAvatarImageAsync(); _accountSwitchingOverlayView = _accountSwitchingOverlayHelper.CreateAccountSwitchingOverlayView(OverlayView); }
protected override void Dispose(bool disposing) { if (disposing) { if (TableView != null) { TableView.Source?.Dispose(); } if (_accountSwitchingButton?.Image != null) { var img = _accountSwitchingButton.Image; _accountSwitchingButton.Image = null; img.Dispose(); } if (_accountSwitchingOverlayView != null && _overlayView?.Subviews != null) { foreach (var subView in _overlayView.Subviews) { subView.RemoveFromSuperview(); subView.Dispose(); } _accountSwitchingOverlayView = null; _overlayView.RemoveFromSuperview(); } _accountSwitchingOverlayHelper = null; } base.Dispose(disposing); }
public override async void ViewDidLoad() { base.ViewDidLoad(); _accountSwitchingOverlayHelper = new AccountSwitchingOverlayHelper(); AccountSwitchingBarButton.Image = await _accountSwitchingOverlayHelper.CreateAvatarImageAsync(); _accountSwitchingOverlayView = _accountSwitchingOverlayHelper.CreateAccountSwitchingOverlayView(OverlayView); }
public override async void ViewDidLoad() { base.ViewDidLoad(); _cancelButton.TintColor = ThemeHelpers.NavBarTextColor; _submitButton.TintColor = ThemeHelpers.NavBarTextColor; _accountSwitchingOverlayHelper = new AccountSwitchingOverlayHelper(); _accountSwitchingButton.Image = await _accountSwitchingOverlayHelper.CreateAvatarImageAsync(); _accountSwitchingOverlayView = _accountSwitchingOverlayHelper.CreateAccountSwitchingOverlayView(_overlayView); }
public void OnToolbarItemActivated(AccountSwitchingOverlayView accountSwitchingOverlayView, UIView containerView) { var overlayVisible = accountSwitchingOverlayView.IsVisible; if (!overlayVisible) { // So that the animation doesn't break we only care about showing it // and the hiding if done through AccountSwitchingOverlayView -> AfterHide containerView.Hidden = false; } accountSwitchingOverlayView.ToggleVisibililtyCommand.Execute(null); containerView.UserInteractionEnabled = !overlayVisible; containerView.Subviews[0].UserInteractionEnabled = !overlayVisible; }
public AccountSwitchingOverlayView CreateAccountSwitchingOverlayView(UIView containerView) { var overlay = new AccountSwitchingOverlayView() { LongPressAccountEnabled = false, AfterHide = () => { if (containerView != null) { containerView.Hidden = true; } } }; var vm = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { FromIOSExtension = true }; overlay.BindingContext = vm; overlay.IsVisible = false; var renderer = Platform.CreateRenderer(overlay.Content); renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height)); var view = renderer.NativeView; view.TranslatesAutoresizingMaskIntoConstraints = false; containerView.AddSubview(view); containerView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, view, NSLayoutAttribute.Trailing, 1f, 0f), NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, view, NSLayoutAttribute.Leading, 1f, 0f), NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, view, NSLayoutAttribute.Top, 1f, 0f), NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, view, NSLayoutAttribute.Bottom, 1f, 0f) }); containerView.Hidden = true; return(overlay); }