Ejemplo n.º 1
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);
            ContentView.Opaque = true;

            TitleLabel.TextColor = Theme.MainTitleColor;
            TimeLabel.TextColor = UIColor.Gray;
            ContentLabel.TextColor = Theme.MainTextColor;
            DefaultContentConstraintSize = ContentConstraint.Constant;

            this.OneWayBind(ViewModel, x => x.Name, x => x.TitleLabel.Text);
            this.OneWayBind(ViewModel, x => x.Description, x => x.ContentLabel.Text);
            this.OneWayBind(ViewModel, x => x.Time, x => x.TimeLabel.Text);

            this.WhenAnyValue(x => x.ViewModel)
                .Where(x => x != null)
                .SubscribeSafe(x => ContentConstraint.Constant = string.IsNullOrEmpty(x.Description) ? 0f : DefaultContentConstraintSize);

            this.WhenAnyValue(x => x.ViewModel.Avatar)
                .Where(_ => !_isFakeCell)
                .Subscribe(x => MainImageView.SetAvatar(x));
        }
Ejemplo 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          = UIColor.Gray;
            ContentLabel.TextColor       = Theme.CurrentTheme.MainTextColor;
            DefaultContentConstraintSize = ContentConstraint.Constant;

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                TitleLabel.Text            = x.Name;
                TimeLabel.Text             = x.Date;
                ContentLabel.Text          = x.Description;
                ContentLabel.Hidden        = string.IsNullOrWhiteSpace(x.Description);
                ContentConstraint.Constant = ContentLabel.Hidden ? 0 : DefaultContentConstraintSize;
                MainImageView.SetAvatar(x.Avatar);
            });
        }
Ejemplo n.º 3
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;
            TimeLabel.TextColor          = Theme.MainSubtitleColor;
            ContentLabel.TextColor       = Theme.MainTextColor;
            DefaultContentConstraintSize = ContentConstraint.Constant;

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                MainImageView.SetAvatar(x.Avatar);
                TitleLabel.Text            = x.Title;
                ContentLabel.Text          = x.Description;
                TimeLabel.Text             = x.UpdatedAt.UtcDateTime.Humanize();
                ContentConstraint.Constant = string.IsNullOrEmpty(x.Description) ? 0f : DefaultContentConstraintSize;
            });
        }
Ejemplo n.º 4
0
 public void Set(string title, string description, DateTimeOffset time, GitHubAvatar avatar)
 {
     TitleLabel.Text            = title;
     ContentLabel.Text          = description;
     TimeLabel.Text             = time.Humanize();
     ContentConstraint.Constant = string.IsNullOrEmpty(description) ? 0f : DefaultContentConstraintSize;
     MainImageView.SetAvatar(avatar);
 }
Ejemplo n.º 5
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;
            TimeLabel.TextColor  = Theme.MainTextColor;

            this.WhenActivated(d => {
                d(this.OneWayBind(ViewModel, x => x.Title, x => x.TitleLabel.Text));
                d(this.OneWayBind(ViewModel, x => x.Details, x => x.TimeLabel.Text));
                d(this.WhenAnyValue(x => x.ViewModel.Avatar).Subscribe(x => MainImageView.SetAvatar(x)));
            });
        }
Ejemplo n.º 6
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.MainSubtitleColor;

            this.WhenAnyValue(x => x.ViewModel)
            .Subscribe(x =>
            {
                TitleLabel.Text = x?.Title;
                TimeLabel.Text  = x?.CreatedOn;
                MainImageView.SetAvatar(x?.Avatar);
            });
        }
Ejemplo n.º 7
0
 public void Set(string title, DateTimeOffset time, GitHubAvatar avatar)
 {
     TitleLabel.Text = title;
     TimeLabel.Text  = time.Humanize();
     MainImageView.SetAvatar(avatar);
 }