private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _topRuler.AtTopOf(ContentView), _topRuler.AtRightOf(ContentView, 0), _topRuler.AtLeftOf(ContentView, 0), _topRuler.Height().EqualTo(1), _bottomRuler.AtBottomOf(ContentView), _bottomRuler.AtRightOf(ContentView), _bottomRuler.AtLeftOf(ContentView), _bottomRuler.Height().EqualTo(1), _avatar.AtTopOf(ContentView, 10), _avatar.AtLeftOf(ContentView, 10), _avatar.Height().EqualTo(50), _avatar.Width().EqualTo(50), _avatar.AtBottomOf(ContentView, 10), _displayName.WithSameCenterY(_avatar), _displayName.ToRightOf(_avatar, 10) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _imageView.AtLeftOf(ContentView, 14), _imageView.AtTopOf(ContentView, 10), _imageView.AtBottomOf(ContentView, 10), _imageView.Width().EqualTo(30), _imageView.Height().EqualTo(30), _text.ToRightOf(_imageView, 10), _text.WithSameCenterY(_imageView), _text.ToLeftOf(_arrow, 10), _arrow.WithSameCenterY(ContentView), _arrow.AtRightOf(ContentView, 14), _arrow.Height().EqualTo(15), _arrow.Width().EqualTo(9), _topRuler.AtTopOf(ContentView), _topRuler.AtLeftOf(ContentView), _topRuler.AtRightOf(ContentView), _topRuler.Height().EqualTo(1) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _imageView.AtTopOf(ContentView), _imageView.AtLeftOf(ContentView), _imageView.AtBottomOf(ContentView), _imageView.AtRightOf(ContentView) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _imageView.AtTopOf(ContentView, 10), _imageView.AtLeftOf(ContentView, 10), _imageView.AtBottomOf(ContentView, 10), _imageView.AtRightOf(ContentView, 10), _imageView.Height().EqualTo(80), _imageView.Width().EqualTo(80) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _topRulerRightConstraint = _topBorder.AtRightOf(ContentView, 14).ToLayoutConstraints().First(); _topRulerLeftConstraint = _topBorder.AtLeftOf(ContentView, 14).ToLayoutConstraints().First(); ContentView.AddConstraint(_topRulerLeftConstraint); ContentView.AddConstraint(_topRulerRightConstraint); ContentView.AddConstraints( _topBorder.AtTopOf(ContentView), _topBorder.Height().EqualTo(1), _avatar.AtLeftOf(ContentView, 14), _avatar.WithSameCenterY(ContentView), _avatar.Height().EqualTo(45), _avatar.Width().EqualTo(45), _displayName.WithSameCenterY(_avatar).Plus(-13), _displayName.ToRightOf(_avatar, 10), _timeAgo.AtRightOf(ContentView, 14), _timeAgo.WithSameCenterY(_displayName).Plus(1), _timeAgo.ToRightOf(_displayName, 14), _unreadContainer.Below(_timeAgo, 5), _unreadContainer.AtRightOf(ContentView, 30), _unreadContainer.Width().EqualTo(20), _unreadContainer.Height().EqualTo(20), _numberUnread.WithSameCenterX(_unreadContainer), _numberUnread.WithSameCenterY(_unreadContainer), _lastMessage.Below(_displayName, 3), _lastMessage.WithSameLeft(_displayName), _lastMessage.ToLeftOf(_timeAgo), _bottomBorder.AtBottomOf(ContentView), _bottomBorder.AtLeftOf(ContentView), _bottomBorder.AtRightOf(ContentView), _bottomBorder.Height().EqualTo(1) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _logo.AtLeftOf(ContentView, 14), _logo.WithSameCenterY(ContentView), _logo.Height().EqualTo(40), _logo.Width().EqualTo(40), _name.ToRightOf(_logo, 14), _name.AtRightOf(ContentView, 14), _name.WithSameCenterY(_logo).Minus(3), _bottomRuler.AtBottomOf(ContentView), _bottomRuler.AtRightOf(ContentView, 14), _bottomRuler.AtLeftOf(ContentView, 14), _bottomRuler.Height().EqualTo(1) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _avatar.AtTopOf(ContentView, 10), _avatar.AtLeftOf(ContentView, 10), _avatar.Height().EqualTo(30), _avatar.Width().EqualTo(30), DisplayName.WithSameTop(_avatar), DisplayName.ToRightOf(_avatar, 10), _timeAgo.WithSameBottom(DisplayName), _timeAgo.ToRightOf(DisplayName, 10), Message.Below(DisplayName, 5), Message.WithSameLeft(DisplayName), Message.AtRightOf(ContentView, 10), Message.AtBottomOf(ContentView, 10) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _bottomRulerLeftConstraint = _bottomRuler.AtLeftOf(ContentView, 14).ToLayoutConstraints().First(); _bottomRulerRightConstraint = _bottomRuler.AtRightOf(ContentView, 14).ToLayoutConstraints().First(); ContentView.AddConstraint(_bottomRulerLeftConstraint); ContentView.AddConstraint(_bottomRulerRightConstraint); ContentView.AddConstraints( _avatar.AtTopOf(ContentView, 14), _avatar.AtLeftOf(ContentView, 14), _avatar.Height().EqualTo(35), _avatar.Width().EqualTo(35), _displayName.WithSameTop(_avatar).Minus(2), _displayName.Height().EqualTo(20), _displayName.ToRightOf(_avatar, 13), _timeAgo.ToRightOf(_displayName, 7), _timeAgo.WithSameBottom(_displayName), //_timeAgo.AtLeftOf(ContentView, 14), Text.Below(_displayName, 3), Text.ToLeftOf(_contextButton, 10), Text.ToRightOf(_avatar, 10), _contextButton.AtRightOf(ContentView, 10), _contextButton.AtTopOf(ContentView, 5), _contextButton.Width().EqualTo(30), _contextButton.Height().EqualTo(30), _bottomRuler.Height().EqualTo(1), _bottomRuler.AtBottomOf(ContentView) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _avatar.AtTopOf(ContentView, 14), _avatar.AtLeftOf(ContentView, 14), _avatar.Height().EqualTo(30), _avatar.Width().EqualTo(30), _displayName.WithSameTop(_avatar), _displayName.ToRightOf(_avatar, 10), _timeAgo.ToRightOf(_displayName, 6), _timeAgo.WithSameBottom(_displayName), //_timeAgo.AtLeftOf(ContentView, 14), _text.Below(_displayName, 5), _text.WithSameLeft(_displayName), _text.AtRightOf(ContentView, 14), _extraText.Below(_text, 10), _extraText.WithSameLeft(_text), _extraText.AtRightOf(ContentView, 14), _bottomRuler.Below(_extraText, 10), _bottomRuler.WithSameLeft(ContentView), _bottomRuler.WithSameRight(ContentView), _bottomRuler.Height().EqualTo(1), _bottomRuler.AtBottomOf(ContentView), _backgroundColor.AtLeftOf(ContentView), _backgroundColor.AtTopOf(ContentView), _backgroundColor.AtRightOf(ContentView), _backgroundColor.AtBottomOf(ContentView) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); // Backpanel bottom constraint for usage in detailsview _backPanelBottomConstraint = _backPanel.AtBottomOf(ContentView, 0).WithIdentifier("BackPanelBottomToView").ToLayoutConstraints().First(); // Main image constraints _mainImageHeightConstraint = _mainImage.Height().EqualTo(0).WithIdentifier("MainImageHeightConstraint").ToLayoutConstraints().First(); _mainImageBottomSpacingConstraint = _mainImage.Above(_leftSubImage, 3).WithIdentifier("MainImageAboveLeftSub").ToLayoutConstraints().First(); // Sub image constraints _subImageSpacingConstraint = _leftSubImage.Above(_ruler, 8).WithIdentifier("LeftSubImageAboveRuler").ToLayoutConstraints().First(); _subImageHeightConstraint = _leftSubImage.Height().EqualTo(50).WithIdentifier("LeftSubHeight").ToLayoutConstraints().First(); ContentView.AddConstraint(_backPanelBottomConstraint); ContentView.AddConstraint(_mainImageHeightConstraint); ContentView.AddConstraint(_mainImageBottomSpacingConstraint); ContentView.AddConstraint(_subImageSpacingConstraint); ContentView.AddConstraint(_subImageHeightConstraint); ContentView.AddConstraints( // TOP _backPanel.AtTopOf(ContentView, 5).WithIdentifier("BackPanelAtTopContentView"), _backPanel.AtRightOf(ContentView, 0).WithIdentifier("BackPanelAtRightOfContentView"), _backPanel.AtLeftOf(ContentView, 0).WithIdentifier("BackPanelAtLeftOfContentView"), _topBorder.AtTopOf(_backPanel).WithIdentifier("TopBorderAtTopOfBackpanel"), _topBorder.AtLeftOf(_backPanel).WithIdentifier("TopBorderAtLeftOfBackpanel"), _topBorder.AtRightOf(_backPanel).WithIdentifier("TopBorderAtRightOfBackpanel"), _topBorder.Height().EqualTo(1).WithIdentifier("TopBorderHeightEqualTo1"), _avatarImageView.Below(_topBorder, 14).WithIdentifier("AvatarImageBelowTopBorder"), _avatarImageView.AtLeftOf(_backPanel, 14).WithIdentifier("AvatarImageAtLeftOfBackPanel"), _avatarImageView.Height().EqualTo(45).WithIdentifier("AvatarImageHeightEquealTo"), _avatarImageView.Width().EqualTo(45).WithIdentifier("AvatarImageWidthEqualTo"), _displayName.Bottom().EqualTo().CenterYOf(_avatarImageView).Minus(1.5f).WithIdentifier("DisplayNameBottomEqualtoCenterYOfAvatarImage"), _displayName.ToRightOf(_avatarImageView, 10).WithIdentifier("DisplayNameToRightOfAvatarImage"), _displayName.ToLeftOf(_contextButton, 13), _timeAgo.Below(_displayName, 3).WithIdentifier("TimeAgoBelowDisplayName"), _timeAgo.WithSameLeft(_displayName).WithIdentifier("TimeAgoWithSameLeftDisplayName"), _timeAgo.WithSameRight(_displayName).WithIdentifier("TimeAgoWithSameRightDisplayName"), _postText.Below(_avatarImageView, 8).WithIdentifier("PostTextBelowAvatarImage"), _postText.AtLeftOf(_backPanel, 11).WithIdentifier("PostTextAtLeftOfBackPanel"), _postText.AtRightOf(_backPanel, 14).WithIdentifier("PostTextAtRightOfBackPanel"), _contextButton.AtRightOf(_backPanel, 10), _contextButton.AtTopOf(_backPanel, 5), _contextButton.Width().EqualTo(30), _contextButton.Height().EqualTo(30), // CONTENT _mainImage.AtLeftOf(_backPanel).WithIdentifier("MainImageAtLeftOfBackPanel"), _mainImage.AtRightOf(_backPanel).WithIdentifier("MainImageAtRightOfBackPanel"), // INFORMATION _dateBackPanel.AtTopOf(_mainImage, 20).WithIdentifier("DateBackPanelAtTopOfContentView"), _dateBackPanel.AtRightOf(_mainImage, 20).WithIdentifier("DateBackPanelAtRightOfContentView"), _dateBackPanel.Width().EqualTo(90).WithIdentifier("DateBackPanelWidth"), _dateBackPanel.Height().EqualTo(25).WithIdentifier("DateBackPanelHeight"), _date.WithSameCenterY(_dateBackPanel).WithIdentifier("DateAtRightOfContentView"), _date.WithSameCenterX(_dateBackPanel).WithIdentifier("DateAtBottomOfContentView"), _infoContainerPlaceholder.AtTopOf(_mainImage), _infoContainerPlaceholder.AtLeftOf(_mainImage), _infoContainerPlaceholder.AtRightOf(_mainImage), _infoContainerPlaceholder.AtBottomOf(_mainImage), _infoContainer.AtLeftOf(_infoContainerPlaceholder).WithIdentifier("InfoContainerAtLeftOfBackground"), _infoContainer.AtRightOf(_infoContainerPlaceholder).WithIdentifier("InforContainerAtRightOfBackground"), _infoContainer.WithSameCenterY(_infoContainerPlaceholder), _title.AtLeftOf(_infoContainer, 20).WithIdentifier("NameAtLeftOfBackgorund"), _title.AtRightOf(_infoContainer, 20).WithIdentifier("NameAtRightBackground"), _title.AtTopOf(_infoContainer, 4), _time.Below(_title, 5).WithIdentifier("TimeAboveLocation"), _time.AtLeftOf(_infoContainer, 20).WithIdentifier("TimeAtLeftOfBackground"), _time.AtRightOf(_infoContainer, 20).WithIdentifier("TimeAtRightOfBackground"), _location.Below(_time, 3), _location.AtBottomOf(_infoContainer), _location.AtLeftOf(_infoContainer, 20), _location.AtRightOf(_infoContainer, 20), // --------------------------------------------- _leftSubImage.AtLeftOf(_backPanel).WithIdentifier("LeftSubImageAtLeftOfBackPanel"), _rightSubImage.WithSameTop(_leftSubImage).WithIdentifier("RightSubImageWithSameTopLeftSub"), _rightSubImage.WithSameWidth(_leftSubImage).WithIdentifier("RightSubImageWithSameWidthLeftSub"), _rightSubImage.AtRightOf(_backPanel).WithIdentifier("RightSubImageAtRightOfBackPanel"), _rightSubImage.ToRightOf(_leftSubImage, 3).WithIdentifier("RightSubImageToRightOfLeftSub"), _rightSubImage.WithSameHeight(_leftSubImage).WithIdentifier("RightSubImageWithSameHeightLeftSub"), // BOTTOM _ruler.Above(_commentButton).WithIdentifier("RulerBelowContentContainer"), _ruler.Height().EqualTo(1).WithIdentifier("RulerHeightEqualTo1"), _ruler.WithSameLeft(_avatarImageView).WithIdentifier("RulerWithSameLeftAvatarImage"), _ruler.WithSameRight(_displayName).WithIdentifier("RulerWithSameRightDisplayName"), _commentButton.Above(_bottomBorder).WithIdentifier("CommentButtonBelowRuler"), _commentButton.WithSameLeft(_avatarImageView).WithIdentifier("CommentWithSameLeftAvatarImage"), _commentButton.Height().EqualTo(50).WithIdentifier("CommentButtonHeightEqualTo"), _likeButton.WithSameCenterY(_commentButton).WithIdentifier("LikeButtonWithSameCenterYCommentButton"), _likeButton.ToRightOf(_commentButton, 15).WithIdentifier("LikeButtonToRightOfCommentButton"), _likeButton.WithSameHeight(_commentButton).WithIdentifier("LikeButtonWithSameHeightCommentButton"), _bottomBorder.AtBottomOf(_backPanel).WithIdentifier("BottomBorderAtBottomOfBackPanel"), _bottomBorder.AtLeftOf(_backPanel).WithIdentifier("BottomBorderAtLeftOfBackPanel"), _bottomBorder.AtRightOf(_backPanel).WithIdentifier("BottomBorderAtRightOfBackPanel"), _bottomBorder.Height().EqualTo(1).WithIdentifier("BottomBorderHeightEqualTo1") ); }
private void SetupNotificationView() { // Setup subviews _notificationViewContainer = new UIView { BackgroundColor = Appearance.Colors.NatificationPanel, Frame = new CGRect(0, -64, View.Frame.Width, 64) }; _avatar = new AvatarImageView(); _displayName = new UILabel { TextColor = iOS.Appearance.Colors.White, Font = Appearance.Fonts.LatoBoldWithSize(14), Lines = 1 }; _text = new UILabel { TextColor = iOS.Appearance.Colors.White, Font = Appearance.Fonts.LatoWithSize(11.86f), Lines = 1, LineBreakMode = UILineBreakMode.TailTruncation }; _bottomSwipHandle = new UIView { BackgroundColor = Appearance.Colors.White }; _bottomSwipHandle.Layer.CornerRadius = 2.0f; // Gesture recognizers _tap = new UITapGestureRecognizer(gesture => { if (AppDelegate.MainWindow.RootViewController.VisibleViewController().IsChatConversation()) { var chatConversation = (ChatConversationView)AppDelegate.MainWindow.RootViewController.VisibleViewController(); var viewModel = chatConversation.DataContext as ChatConversationViewModel; if (viewModel != null && viewModel.Id != _conversationId) { chatConversation.DismissViewController(false, OpenChatView); } return; } if (AppDelegate.MainWindow.RootViewController.VisibleViewController() is ImageZoomView) { var imageZoom = (ImageZoomView)AppDelegate.MainWindow.RootViewController.VisibleViewController(); imageZoom.DismissModalViewController(false); } if (AppDelegate.MainWindow.RootViewController.VisibleViewController() is UserView) { var userView = (UserView)AppDelegate.MainWindow.RootViewController.VisibleViewController(); userView.DismissModalViewController(false); } OpenChatView(); }) { NumberOfTapsRequired = 1 }; _swipe = new UISwipeGestureRecognizer(() => { HideNotification(); }) { Direction = UISwipeGestureRecognizerDirection.Up }; // Add gestures to views _notificationViewContainer.AddGestureRecognizer(_tap); _notificationViewContainer.AddGestureRecognizer(_swipe); _avatar.AddGestureRecognizer(_tap); _avatar.AddGestureRecognizer(_swipe); _displayName.AddGestureRecognizer(_tap); _displayName.AddGestureRecognizer(_swipe); _text.AddGestureRecognizer(_tap); _text.AddGestureRecognizer(_swipe); _bottomSwipHandle.AddGestureRecognizer(_swipe); // Enable user interaction _notificationViewContainer.UserInteractionEnabled = true; _avatar.UserInteractionEnabled = true; _displayName.UserInteractionEnabled = true; _text.UserInteractionEnabled = true; _bottomSwipHandle.UserInteractionEnabled = true; View.UserInteractionEnabled = true; // Add subviews to container _notificationViewContainer.AddSubviews(_avatar, _displayName, _text, _bottomSwipHandle); // Setup constraints _notificationViewContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _notificationViewContainer.AddConstraints( _avatar.AtLeftOf(_notificationViewContainer, 10), _avatar.WithSameCenterY(_notificationViewContainer), _avatar.Width().EqualTo(40), _avatar.Height().EqualTo(40), _displayName.ToRightOf(_avatar, 10), _displayName.AtRightOf(_notificationViewContainer, 10), _displayName.WithSameCenterY(_avatar).Minus(8), _text.WithSameCenterY(_avatar).Plus(8), _text.WithSameLeft(_displayName), _text.WithSameRight(_displayName), _bottomSwipHandle.AtBottomOf(_notificationViewContainer, 2), _bottomSwipHandle.WithSameCenterX(_notificationViewContainer), _bottomSwipHandle.Width().EqualTo(20), _bottomSwipHandle.Height().EqualTo(5) ); // Add container to viewdontroller View.AddSubviews(_notificationViewContainer); // Setup timer for hiding _timer = new Timer(3000) { AutoReset = false }; _timer.Elapsed += (sender, args) => { UIApplication.SharedApplication.InvokeOnMainThread(HideNotification); }; }