File tree Expand file tree Collapse file tree 3 files changed +85
-9
lines changed
Expand file tree Collapse file tree 3 files changed +85
-9
lines changed Original file line number Diff line number Diff line change 77using Bible . Alarm . Views . General ;
88using Bible . Alarm . ViewModels ;
99using Bible . Alarm . ViewModels . Shared ;
10- #nullable enable
1110
1211namespace Bible . Alarm ;
1312
Original file line number Diff line number Diff line change 66 xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
77 BackgroundColor =" White"
88 Title =" Bible Alarm" >
9+ <ContentPage .Resources>
10+ <Style x : Key =" DotStyle" TargetType =" Label" >
11+ <Setter Property =" FontSize" Value =" 48" />
12+ <Setter Property =" TextColor" Value =" SlateBlue" />
13+ <Setter Property =" HorizontalOptions" Value =" Center" />
14+ <Setter Property =" VerticalOptions" Value =" Center" />
15+ </Style >
16+ </ContentPage .Resources>
917 <ContentPage .Content>
1018 <Grid >
1119 <StackLayout
1220 HorizontalOptions =" Center"
1321 Orientation =" Vertical"
14- VerticalOptions =" Center" >
22+ VerticalOptions =" Center"
23+ Spacing =" 20" >
1524 <ActivityIndicator
1625 IsRunning =" True"
1726 Color =" SlateBlue"
18- WidthRequest =" 100 "
19- HeightRequest =" 100 " >
27+ WidthRequest =" 80 "
28+ HeightRequest =" 80 " >
2029 <ActivityIndicator .Scale>
2130 <OnPlatform x : TypeArguments =" x:Double" >
2231 <OnPlatform .Platforms>
2736 </OnPlatform >
2837 </ActivityIndicator .Scale>
2938 </ActivityIndicator >
30- < Label
31- Text = " Loading... "
32- FontSize = " Large "
39+
40+ <!-- Animated loading dots -->
41+ < HorizontalStackLayout
3342 HorizontalOptions =" Center"
34- Margin =" 0,20,0,0"
35- TextColor =" SlateBlue" />
43+ Spacing =" 8" >
44+ <Label
45+ x : Name =" Dot1"
46+ Text =" ●"
47+ Style =" {StaticResource DotStyle}"
48+ Opacity =" 0.3" />
49+ <Label
50+ x : Name =" Dot2"
51+ Text =" ●"
52+ Style =" {StaticResource DotStyle}"
53+ Opacity =" 0.3" />
54+ <Label
55+ x : Name =" Dot3"
56+ Text =" ●"
57+ Style =" {StaticResource DotStyle}"
58+ Opacity =" 0.3" />
59+ </HorizontalStackLayout >
3660 </StackLayout >
3761 </Grid >
3862 </ContentPage .Content>
Original file line number Diff line number Diff line change 1+ using System . Timers ;
2+ using Microsoft . Maui . ApplicationModel ;
3+
14namespace Bible . Alarm . Views . General ;
25
36[ XamlCompilation ( XamlCompilationOptions . Compile ) ]
47public partial class LoadingPage : ContentPage
58{
9+ private readonly System . Timers . Timer _animationTimer ;
10+ private int _currentDot = 0 ;
11+
612 public LoadingPage ( )
713 {
814 InitializeComponent ( ) ;
15+
16+ // Start animated dots
17+ _animationTimer = new System . Timers . Timer ( 500 ) ; // Change dot every 500ms
18+ _animationTimer . Elapsed += OnTimerElapsed ;
19+ _animationTimer . AutoReset = true ;
20+ _animationTimer . Start ( ) ;
21+
22+ // Initialize first dot
23+ UpdateDots ( ) ;
24+ }
25+
26+ private void OnTimerElapsed ( object ? sender , ElapsedEventArgs e )
27+ {
28+ MainThread . BeginInvokeOnMainThread ( ( ) =>
29+ {
30+ _currentDot = ( _currentDot + 1 ) % 3 ;
31+ UpdateDots ( ) ;
32+ } ) ;
33+ }
34+
35+ private void UpdateDots ( )
36+ {
37+ // Reset all dots to low opacity
38+ Dot1 . Opacity = 0.3 ;
39+ Dot2 . Opacity = 0.3 ;
40+ Dot3 . Opacity = 0.3 ;
41+
42+ // Highlight current dot
43+ switch ( _currentDot )
44+ {
45+ case 0 :
46+ Dot1 . Opacity = 1.0 ;
47+ break ;
48+ case 1 :
49+ Dot2 . Opacity = 1.0 ;
50+ break ;
51+ case 2 :
52+ Dot3 . Opacity = 1.0 ;
53+ break ;
54+ }
55+ }
56+
57+ protected override void OnDisappearing ( )
58+ {
59+ base . OnDisappearing ( ) ;
60+ _animationTimer ? . Stop ( ) ;
61+ _animationTimer ? . Dispose ( ) ;
962 }
1063}
1164
You can’t perform that action at this time.
0 commit comments