Exemplo n.º 1
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            MainImageView.Layer.MasksToBounds = true;
            MainImageView.Layer.CornerRadius  = MainImageView.Frame.Height / 2f;
            ContentView.Opaque = true;

            SeparatorInset               = new UIEdgeInsets(0, TitleLabel.Frame.Left, 0, 0);
            TitleLabel.TextColor         = Theme.MainTitleColor;
            DetailsLabel.TextColor       = UIColor.Gray;
            DefaultContentConstraintSize = DetailsConstraint.Constant;

            this.OneWayBind(ViewModel, x => x.Title, x => x.TitleLabel.Text);

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                if (string.IsNullOrEmpty(x.ImageUrl))
                {
                    MainImageView.Image = Images.LoginUserUnknown;
                }
                else
                {
                    MainImageView.SetImage(new NSUrl(x.ImageUrl), Images.LoginUserUnknown);
                }

                DetailsLabel.Text          = "Created " + x.Created.UtcDateTime.Humanize();
                DetailsConstraint.Constant = string.IsNullOrEmpty(DetailsLabel.Text) ? 0f : DefaultContentConstraintSize;
            });
        }
Exemplo n.º 2
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            MainImageView.Layer.MasksToBounds = true;
            MainImageView.Layer.CornerRadius  = MainImageView.Frame.Height / 2f;
            SeparatorInset               = new UIEdgeInsets(0, TitleLabel.Frame.Left, 0, 0);
            TitleLabel.TextColor         = Theme.CurrentTheme.MainTitleColor;
            TimeLabel.TextColor          = Theme.CurrentTheme.MainSubtitleColor;
            ContentLabel.TextColor       = Theme.CurrentTheme.MainTextColor;
            DefaultContentConstraintSize = ContentConstraint.Constant;

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                if (x.ImageUrl == null)
                {
                    MainImageView.Image = Images.LoginUserUnknown;
                }
                else
                {
                    MainImageView.SetImage(new NSUrl(x.ImageUrl), Images.LoginUserUnknown);
                }
                TitleLabel.Text            = x.Title;
                ContentLabel.Text          = x.Description;
                TimeLabel.Text             = x.UpdatedAt.ToDaysAgo();
                ContentConstraint.Constant = string.IsNullOrEmpty(x.Description) ? 0f : DefaultContentConstraintSize;
            });
        }
Exemplo n.º 3
0
        public void Bind(string title, string time, Avatar avatar, UIImage placeholderImage)
        {
            TitleLabel.Text = title;
            TimeLabel.Text  = time;
            var avatarUrl = avatar?.ToUrl();

            if (avatarUrl == null)
            {
                MainImageView.Image = placeholderImage;
            }
            else
            {
                MainImageView.SetImage(new NSUrl(avatarUrl), placeholderImage);
            }
        }
        public void Bind(string title, string time, Avatar avatar)
        {
            TitleLabel.Text = title;
            TimeLabel.Text  = time;
            var avatarUrl = avatar?.ToUrl(64);

            if (avatarUrl == null)
            {
                MainImageView.Image = Images.Avatar;
            }
            else
            {
                MainImageView.SetImage(new NSUrl(avatarUrl), Images.Avatar);
            }
        }
Exemplo n.º 5
0
        public void Bind(string name, string description, string time, UIImage logoImage, string logoUri)
        {
            TitleLabel.Text            = name;
            TimeLabel.Text             = time;
            ContentLabel.Text          = description;
            ContentLabel.Hidden        = string.IsNullOrWhiteSpace(description);
            ContentConstraint.Constant = ContentLabel.Hidden ? 0 : DefaultContentConstraintSize;

            if (logoUri == null)
            {
                MainImageView.Image = logoImage;
            }
            else
            {
                MainImageView.SetImage(new NSUrl(logoUri), logoImage);
            }
        }
Exemplo n.º 6
0
        public void Bind(string name, string description, string time, Avatar avatar)
        {
            TitleLabel.Text            = name;
            TimeLabel.Text             = time;
            ContentLabel.Text          = description;
            ContentLabel.Hidden        = string.IsNullOrWhiteSpace(description);
            ContentConstraint.Constant = ContentLabel.Hidden ? 0 : DefaultContentConstraintSize;

            var logoUri = avatar.ToUri(64);

            if (logoUri == null)
            {
                MainImageView.Image = Images.Avatar;
            }
            else
            {
                MainImageView.SetImage(new NSUrl(logoUri.AbsoluteUri), Images.Avatar);
            }
        }
Exemplo n.º 7
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            MainImageView.Layer.MasksToBounds = true;
            MainImageView.Layer.CornerRadius  = MainImageView.Frame.Height / 2f;
            ContentView.Opaque = true;

            SeparatorInset       = new UIEdgeInsets(0, TitleLabel.Frame.Left, 0, 0);
            TitleLabel.TextColor = Theme.CurrentTheme.MainTitleColor;
            TimeLabel.TextColor  = Theme.CurrentTheme.MainTextColor;

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                MainImageView.SetImage(new NSUrl(x.ImageUrl), Images.LoginUserUnknown);
                TitleLabel.Text = x.Title;
                TimeLabel.Text  = x.Details;
            });
        }
Exemplo n.º 8
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            MainImageView.Layer.MasksToBounds = true;
            MainImageView.Layer.CornerRadius  = MainImageView.Frame.Height / 2f;
            SeparatorInset               = new UIEdgeInsets(0, TitleLabel.Frame.Left, 0, 0);
            TitleLabel.TextColor         = UIColor.FromRGB(0, 64, 128);
            TimeLabel.TextColor          = UIColor.Gray;
            ContentLabel.TextColor       = UIColor.FromRGB(41, 41, 41);
            DefaultContentConstraintSize = ContentConstraint.Constant;

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                MainImageView.SetImage(new NSUrl(x.ImageUrl), Images.LoginUserUnknown);
                TitleLabel.Text            = x.Name;
                ContentLabel.Text          = x.Description;
                TimeLabel.Text             = x.Time.ToDaysAgo();
                ContentConstraint.Constant = string.IsNullOrEmpty(x.Description) ? 0f : DefaultContentConstraintSize;
            });
        }