Exemple #1
0
        public void BindDataToView(Card card, bool editable, NSIndexPath indexPath, bool reloadImages)
        {
            if (card == null)
            {
                return;
            }

            BackgroundColor = ColorUtils.FromHexString(card.BorderColor, UIColor.White);

            UserDisplayNameTextField.Text        = card.UserDisplayName;
            UserDisplayNameTextField.Placeholder = (editable) ? Strings.Basic.your_name : String.Empty;
            UserDisplayNameTextField.Enabled     = editable;
            UserDisplayNameTextField.RemoveTarget(null, null, UIControlEvent.EditingChanged);
            UserDisplayNameTextField.EditingChanged += (sender, e) =>
            {
                card.UpdateStringProperty(() => card.UserDisplayName, UserDisplayNameTextField.Text.Trim());
                DealWithTextFieldborder(UserDisplayNameTextField, card, editable);
                NSNotificationCenter.DefaultCenter.PostNotificationName(Strings.InternalNotifications.notification_card_editing_changed, null);
            };
            UserDisplayNameTextField.RemoveTarget(null, null, UIControlEvent.EditingDidEndOnExit);
            UserDisplayNameTextField.EditingDidEndOnExit += (sender, e) =>
            {
                UserDisplayNameTextField.ResignFirstResponder();
            };
            DealWithTextFieldborder(UserDisplayNameTextField, card, editable);

            TitleTextField.Text        = card.Title;
            TitleTextField.Enabled     = editable;
            TitleTextField.Placeholder = (editable) ? Strings.Basic.title : String.Empty;
            TitleTextField.RemoveTarget(null, null, UIControlEvent.EditingChanged);
            TitleTextField.EditingChanged += (sender, e) =>
            {
                card.UpdateStringProperty(() => card.Title, TitleTextField.Text.Trim());
                DealWithTextFieldborder(TitleTextField, card, editable);
                NSNotificationCenter.DefaultCenter.PostNotificationName(Strings.InternalNotifications.notification_card_editing_changed, null);
            };
            TitleTextField.RemoveTarget(null, null, UIControlEvent.EditingDidEndOnExit);
            TitleTextField.EditingDidEndOnExit += (sender, e) =>
            {
                TitleTextField.ResignFirstResponder();
            };
            DealWithTextFieldborder(TitleTextField, card, editable);

            if (reloadImages)
            {
                HeaderImageButton.SetImageWithCustomCache(card.GetRemoteHeaderUrlCached(), "NoProfile", "NoProfile", card.RemoteHeaderURL);
            }
            HeaderImageButton.Layer.MasksToBounds    = true;
            HeaderImageButton.Layer.CornerRadius     = HeaderImageButton.Frame.Size.Width / 2;
            HeaderImageButton.ClipsToBounds          = false;
            HeaderImageButton.UserInteractionEnabled = editable;

            CollectionView.RegisterNibForCell(UINib.FromName("MyCardsCollectionViewCell", NSBundle.MainBundle), MyCardsCollectionViewCell.Key);
            CollectionView.ContentInset   = new UIEdgeInsets(0, 8, 0, 8);
            CollectionView.WeakDataSource = new MyCardsTableViewCellCollectionViewDataSource(card);
            CollectionView.WeakDelegate   = new MyCardsTableViewCellCollectionViewDelegateFlowLayout();

            if (CollectionViewTapGesture == null)
            {
                CollectionViewTapGesture = new UITapGestureRecognizer((obj) =>
                {
                    NSNotificationCenter.DefaultCenter.PostNotificationName(Strings.InternalNotifications.notification_collection_view_tapped, indexPath);
                });
            }
            CollectionView.RemoveGestureRecognizer(CollectionViewTapGesture);
            CollectionView.AddGestureRecognizer(CollectionViewTapGesture);

            NoOutletsButton.Hidden = !(card.Outlets == null || card.Outlets.Count == 0);
        }
Exemple #2
0
 public void AnimateTextUserNameLabel(string text, double delay, Action completed)
 {
     UserDisplayNameTextField.AnimateText(text, delay, completed);
 }