|
22 | 22 |
|
23 | 23 | <ContentPage.Resources> |
24 | 24 | <ResourceDictionary> |
| 25 | + <DataTemplate x:Key="LoadingLottieDataTemplate"> |
| 26 | + <lottie:AnimationView x:Name="LoadingLottie" |
| 27 | + AbsoluteLayout.LayoutFlags="PositionProportional" |
| 28 | + AbsoluteLayout.LayoutBounds="0.5, 0.4, 120, 120" |
| 29 | + HorizontalOptions="FillAndExpand" |
| 30 | + VerticalOptions="FillAndExpand" |
| 31 | + Animation="{Binding Loader.ShowLoader, Converter={StaticResource CyclicLoadingLottieConverter}}" |
| 32 | + IsPlaying="True" |
| 33 | + Loop="True" /> |
| 34 | + </DataTemplate> |
| 35 | + |
| 36 | + <DataTemplate x:Key="EmptyLottieDataTemplate"> |
| 37 | + <StackLayout AbsoluteLayout.LayoutFlags="PositionProportional" |
| 38 | + AbsoluteLayout.LayoutBounds="0.5, 0.4, 300, 180" |
| 39 | + BindingContext="{Binding Source={RelativeSource AncestorType={x:Type customViews:TaskLoaderView}}, Path=TaskLoaderNotifier}"> |
| 40 | + |
| 41 | + <lottie:AnimationView HorizontalOptions="FillAndExpand" |
| 42 | + VerticalOptions="FillAndExpand" |
| 43 | + Animation="empty_state.json" |
| 44 | + IsPlaying="True" |
| 45 | + Loop="True" /> |
| 46 | + |
| 47 | + <Label Style="{StaticResource TextBody}" |
| 48 | + HorizontalOptions="Center" |
| 49 | + VerticalOptions="Center" |
| 50 | + Text="{loc:Translate Empty_Screen}" |
| 51 | + TextColor="White" /> |
| 52 | + <Button Style="{StaticResource TextBody}" |
| 53 | + HeightRequest="40" |
| 54 | + Margin="0,20,0,0" |
| 55 | + Padding="25,0" |
| 56 | + HorizontalOptions="Center" |
| 57 | + BackgroundColor="{StaticResource TopElementBackground}" |
| 58 | + Command="{Binding ReloadCommand}" |
| 59 | + Text="{loc:Translate ErrorButton_Retry}" |
| 60 | + TextColor="White" /> |
| 61 | + </StackLayout> |
| 62 | + </DataTemplate> |
| 63 | + |
| 64 | + <DataTemplate x:Key="ErrorLottieDataTemplate"> |
| 65 | + <StackLayout AbsoluteLayout.LayoutFlags="PositionProportional" |
| 66 | + AbsoluteLayout.LayoutBounds="0.5, 0.4, 300, 180" |
| 67 | + BindingContext="{Binding Source={RelativeSource AncestorType={x:Type customViews:TaskLoaderView}}, Path=TaskLoaderNotifier}"> |
| 68 | + |
| 69 | + <lottie:AnimationView HorizontalOptions="FillAndExpand" |
| 70 | + VerticalOptions="FillAndExpand" |
| 71 | + Animation="{Binding Error, Converter={StaticResource ExceptionToLottieConverter}}" |
| 72 | + IsPlaying="True" |
| 73 | + Loop="True" /> |
| 74 | + |
| 75 | + <Label Style="{StaticResource TextBody}" |
| 76 | + HorizontalOptions="Center" |
| 77 | + VerticalOptions="Center" |
| 78 | + Text="{Binding Error, Converter={StaticResource ExceptionToErrorMessageConverter}}" |
| 79 | + TextColor="White" /> |
| 80 | + <Button Style="{StaticResource TextBody}" |
| 81 | + HeightRequest="40" |
| 82 | + Margin="0,20,0,0" |
| 83 | + Padding="25,0" |
| 84 | + HorizontalOptions="Center" |
| 85 | + BackgroundColor="{StaticResource TopElementBackground}" |
| 86 | + Command="{Binding ReloadCommand}" |
| 87 | + Text="{loc:Translate ErrorButton_Retry}" |
| 88 | + TextColor="White" /> |
| 89 | + </StackLayout> |
| 90 | + </DataTemplate> |
| 91 | + |
25 | 92 | <Style x:Key="TaskLoaderStyle" TargetType="customViews:TaskLoaderView"> |
26 | 93 | <Setter Property="AccentColor" Value="{StaticResource AccentColor}" /> |
27 | 94 | <Setter Property="FontFamily" Value="{StaticResource FontAtariSt}" /> |
|
34 | 101 | <Setter Property="BackgroundColor" Value="{StaticResource LightGreyBackground}" /> |
35 | 102 | <Setter Property="NotificationBackgroundColor" Value="{StaticResource TosWindows}" /> |
36 | 103 | <Setter Property="NotificationTextColor" Value="{StaticResource TextPrimaryColor}" /> |
| 104 | + |
| 105 | + <Setter Property="LoadingView" Value="{StaticResource LoadingLottieDataTemplate}" /> |
| 106 | + <Setter Property="EmptyView" Value="{StaticResource EmptyLottieDataTemplate}" /> |
| 107 | + <Setter Property="ErrorView" Value="{StaticResource ErrorLottieDataTemplate}" /> |
37 | 108 | </Style> |
| 109 | + |
38 | 110 | </ResourceDictionary> |
39 | 111 | </ContentPage.Resources> |
40 | 112 |
|
|
64 | 136 | ValueFontFamily="{StaticResource FontAtariSt}" /> |
65 | 137 | </Frame> |
66 | 138 |
|
| 139 | + <!-- All lottie views are specified in DataTemplates and Style above --> |
67 | 140 | <customViews:TaskLoaderView Grid.Row="2" |
68 | 141 | Style="{StaticResource TaskLoaderStyle}" |
69 | 142 | TaskLoaderNotifier="{Binding Loader}"> |
70 | | - <customViews:TaskLoaderView.LoadingView> |
71 | | - <lottie:AnimationView x:Name="LoadingLottie" |
72 | | - AbsoluteLayout.LayoutFlags="PositionProportional" |
73 | | - AbsoluteLayout.LayoutBounds="0.5, 0.4, 120, 120" |
74 | | - HorizontalOptions="FillAndExpand" |
75 | | - VerticalOptions="FillAndExpand" |
76 | | - Animation="{Binding Loader.ShowLoader, Converter={StaticResource CyclicLoadingLottieConverter}}" |
77 | | - AutoPlay="True" |
78 | | - Loop="True" /> |
79 | | - </customViews:TaskLoaderView.LoadingView> |
80 | | - |
81 | | - <customViews:TaskLoaderView.EmptyView> |
82 | | - <StackLayout AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5, 0.4, 300, 180"> |
83 | | - |
84 | | - <lottie:AnimationView HorizontalOptions="FillAndExpand" |
85 | | - VerticalOptions="FillAndExpand" |
86 | | - Animation="empty_state.json" |
87 | | - AutoPlay="True" |
88 | | - Loop="True" /> |
89 | | - |
90 | | - <Label Style="{StaticResource TextBody}" |
91 | | - HorizontalOptions="Center" |
92 | | - VerticalOptions="Center" |
93 | | - Text="{loc:Translate Empty_Screen}" |
94 | | - TextColor="White" /> |
95 | | - <Button Style="{StaticResource TextBody}" |
96 | | - HeightRequest="40" |
97 | | - Margin="0,20,0,0" |
98 | | - Padding="25,0" |
99 | | - HorizontalOptions="Center" |
100 | | - BackgroundColor="{StaticResource TopElementBackground}" |
101 | | - Command="{Binding Loader.ReloadCommand}" |
102 | | - Text="{loc:Translate ErrorButton_Retry}" |
103 | | - TextColor="White" /> |
104 | | - </StackLayout> |
105 | | - </customViews:TaskLoaderView.EmptyView> |
106 | | - |
107 | | - <customViews:TaskLoaderView.ErrorView> |
108 | | - <StackLayout AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5, 0.4, 300, 180"> |
109 | | - |
110 | | - <lottie:AnimationView HorizontalOptions="FillAndExpand" |
111 | | - VerticalOptions="FillAndExpand" |
112 | | - Animation="{Binding Loader.Error, Converter={StaticResource ExceptionToLottieConverter}}" |
113 | | - AutoPlay="True" |
114 | | - Loop="True" /> |
115 | | - |
116 | | - <Label Style="{StaticResource TextBody}" |
117 | | - HorizontalOptions="Center" |
118 | | - VerticalOptions="Center" |
119 | | - Text="{Binding Loader.Error, Converter={StaticResource ExceptionToErrorMessageConverter}}" |
120 | | - TextColor="White" /> |
121 | | - <Button Style="{StaticResource TextBody}" |
122 | | - HeightRequest="40" |
123 | | - Margin="0,20,0,0" |
124 | | - Padding="25,0" |
125 | | - HorizontalOptions="Center" |
126 | | - BackgroundColor="{StaticResource TopElementBackground}" |
127 | | - Command="{Binding Loader.ReloadCommand}" |
128 | | - Text="{loc:Translate ErrorButton_Retry}" |
129 | | - TextColor="White" /> |
130 | | - </StackLayout> |
131 | | - </customViews:TaskLoaderView.ErrorView> |
132 | | - |
133 | 143 | <RefreshView Command="{Binding Loader.RefreshCommand}" |
134 | 144 | IsRefreshing="{Binding Loader.ShowRefresher}" |
135 | 145 | RefreshColor="{StaticResource AccentColor}"> |
|
0 commit comments