Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions GitTrends/Pages/Onboarding/BaseOnboardingContentPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ class OnboardingIndicatorView : IndicatorView
public OnboardingIndicatorView(in int position)
{
Position = position;

IsEnabled = false;

SelectedIndicatorColor = Color.White;
IndicatorColor = Color.White.MultiplyAlpha(0.25);

Margin = new Thickness(30, 0, 0, 0);

#if AppStore
Expand Down
8 changes: 6 additions & 2 deletions GitTrends/Pages/Trends/BaseTrendsContentPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class BaseTrendsContentPage : BaseContentPage
public BaseTrendsContentPage(in Color indicatorColor,
in IMainThread mainThread,
in int carouselPositionIndex,
in IAnalyticsService analyticsService) : base(analyticsService, mainThread, false)
in IAnalyticsService analyticsService) : base(analyticsService, mainThread, true)
{
Content = new Grid
{
Expand Down Expand Up @@ -58,14 +58,18 @@ public TrendsIndicatorView(in int position, in Color indicatorColor)
{
Position = position;

IndicatorSize = 8;

IsEnabled = false;

SelectedIndicatorColor = indicatorColor;
IndicatorColor = Color.FromHex("#BFBFBF");
AutomationId = TrendsPageAutomationIds.IndicatorView;

IndicatorSize = 8;

this.Center();


SetBinding(CountProperty, new Binding(nameof(TrendsCarouselPage.PageCount),
source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(TrendsCarouselPage))));
}
Expand Down
1 change: 1 addition & 0 deletions GitTrends/Pages/WelcomePage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public WelcomePage(IAppInfo appInfo,

Content = new Grid
{
Padding = 8,
RowSpacing = 24,

RowDefinitions = Rows.Define(
Expand Down
44 changes: 26 additions & 18 deletions GitTrends/Views/Base/EmptyDataView.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using Xamarin.Forms;
using Xamarin.Forms.Markup;
using static GitTrends.MarkupExtensions;
using static Xamarin.Forms.Markup.GridRowsColumns;

namespace GitTrends
{
class EmptyDataView : AbsoluteLayout
class EmptyDataView : Grid
{
public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(EmptyDataView), string.Empty);
public static readonly BindableProperty DescriptionProperty = BindableProperty.Create(nameof(Description), typeof(string), typeof(EmptyDataView), string.Empty);
Expand All @@ -14,28 +16,34 @@ public EmptyDataView(in string imageSource, in string automationId) : this(autom
ImageSource = imageSource;
}

//Workaround for https://github.com/xamarin/Xamarin.Forms/issues/10551
public EmptyDataView(in string automationId)
{
AutomationId = automationId;

var stackLayout = new StackLayout
{
Spacing = 24,
Children =
{
new TextLabel
(
new Span().Bind(Span.TextProperty, nameof(Title), source: this),
new Span().Bind(Span.TextProperty, nameof(Description), source: this)
),
new EmptyStateImage(ImageSource).Bind(Image.SourceProperty, nameof(ImageSource), source: this)
}
};

//Workaround for https://github.com/xamarin/Xamarin.Forms/issues/10551
Children.Add(stackLayout, new Rectangle(.5, .5, -1, -1), AbsoluteLayoutFlags.PositionProportional);
this.Center();

Margin = 8;
Padding = 12;
RowSpacing = 24;

RowDefinitions = Rows.Define(
(Row.Text, StarGridLength(1)),
(Row.Image, StarGridLength(2)));

Children.Add(new TextLabel
(
new Span().Bind(Span.TextProperty, nameof(Title), source: this),
new Span().Bind(Span.TextProperty, nameof(Description), source: this)
).Row(Row.Text));

Children.Add(new EmptyStateImage(ImageSource)
.Row(Row.Image).Top()
.Bind(Image.SourceProperty, nameof(ImageSource), source: this));
}

enum Row { Text, Image }

public string Title
{
get => (string)GetValue(TitleProperty);
Expand Down Expand Up @@ -69,7 +77,7 @@ public TextLabel(in Span title, in Span description)
Spans =
{
title,
new Span { Text = "\n" },
new Span { Text = "\n" }.Font(24),
description
}
};
Expand Down
10 changes: 5 additions & 5 deletions GitTrends/Views/Repository/BaseRepositoryDataTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public CardView(in IEnumerable<View> dataTemplateChildren, in RepositoryViewMode
(CardViewRow.BottomPadding, AbsoluteGridLength(BottomPadding))),

ColumnDefinitions = Columns.Define(
(CardViewColumn.LeftPadding, AbsoluteGridLength(16)),
(CardViewColumn.LeftPadding, AbsoluteGridLength(_isSmallScreen ? 8 : 16)),
(CardViewColumn.Card, Star),
(CardViewColumn.RightPadding, AbsoluteGridLength(16))),
(CardViewColumn.RightPadding, AbsoluteGridLength(_isSmallScreen ? 8 : 16))),

Children =
{
Expand All @@ -81,7 +81,7 @@ class CardViewFrame : MaterialFrame
{
public CardViewFrame(in IEnumerable<View> dataTemplateChildren, in Repository repository)
{
Padding = new Thickness(16, 16, 12, 8);
Padding = _isSmallScreen ? new Thickness(8, 16, 6, 8) : new Thickness(16, 16, 12, 8);
CornerRadius = 4;
HasShadow = false;
Elevation = 4;
Expand All @@ -106,8 +106,8 @@ public ContentGrid(in IEnumerable<View> dataTemplateChildren, in Repository repo
(Row.Statistics, AbsoluteGridLength(_statisticsRowHeight)));

ColumnDefinitions = Columns.Define(
(Column.Avatar, AbsoluteGridLength(_circleImageHeight)),
(Column.AvatarPadding, AbsoluteGridLength(_isSmallScreen ? 8 : 16)),
(Column.Avatar, AbsoluteGridLength(_isSmallScreen ? _circleImageHeight - 4 : _circleImageHeight)),
(Column.AvatarPadding, AbsoluteGridLength(_isSmallScreen ? 4 : 16)),
(Column.Trending, StarGridLength(1)),
(Column.Emoji1, AbsoluteGridLength(_emojiColumnSize)),
(Column.Statistic1, AbsoluteGridLength(_statsColumnSize)),
Expand Down