This repository has been archived by the owner on May 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGalleryPage.scrollView.ux
96 lines (96 loc) · 4.02 KB
/
GalleryPage.scrollView.ux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!-- Gallery ScrollView -->
<ScrollView ux:Name="scrollView" AllowedScrollDirections="Vertical" SnapMinTransform="false">
<Desaturate ux:Name="desaturateEffect" Amount="0" />
<StackPanel Y="50">
<Panel ux:Name="topPanel" Y="-10" Height="0" MinHeight="0" Padding="0,10,0,5">
<Image ux:Name="topDownImage" File="Assets/Images/ArrowDown.png" Color="#fff" Height="16" Opacity="0"/>
<Spinner ux:Name="topSpinner" Width="20" Height="20" StrokeWidth="2" Visibility="Hidden" />
<WhileTrue Value="{IsReloading}">
<Change topPanel.MinHeight="30" Duration="0" DurationBack="0.3" Easing="CircularIn" />
<Change topSpinner.Visibility="Visible" Duration="0" DurationBack="0" />
<Change topSpinner.IsEnabled="true" Duration="0" DurationBack="0" />
</WhileTrue>
</Panel>
<Panel>
<ColumnLayout ux:Name="columnLayout" Orientation="Vertical" ColumnSize="150" Sizing="Fill" ItemSpacing="5" ColumnSpacing="5" />
<Each Items="{feed}">
<Panel Aspect="{image_aspect}" BoxSizing="FillAspect" Background="#212831">
<LayoutAnimation>
<Move Vector="1" Duration="0.4" RelativeTo="PositionChange" Easing="CircularInOut" />
</LayoutAnimation>
<ImageView ux:Name="image" ImageUrl="{image_url}" ImageMemoryPolicy="UnloadUnused">
<WhileLoaded>
<Set IsImageLoaded.Value="true" />
<Set image.Opacity="0" />
<Change image.Opacity="1" Duration="0.2" Easing="CircularIn" />
</WhileLoaded>
<WhileCacheLoaded Bypass="Never">
<Set IsImageLoaded.Value="true" />
</WhileCacheLoaded>
<WhileFailed>
<Set IsImageFailed.Value="true" />
</WhileFailed>
</ImageView>
<WhilePressed>
<Scale Factor="0.98" Duration="0.4" Easing="QuadraticInOut" />
</WhilePressed>
<WhileTrue ux:Name="IsImageFailed">
<Clicked>
<RaiseUserEvent EventName="Error">
<UserEventArg Name="message" StringValue="Error Loading Image" />
</RaiseUserEvent>
</Clicked>
</WhileTrue>
<WhileTrue ux:Name="IsImageLoaded">
<Clicked>
<!-- Current image -->
<Callback Handler="{SelectPhoto}" />
<Set Target="Image.Value" Value="image" />
<Set Target="placeholderImage.Source" Value="{Property image.Source}" />
<!-- UI sync -->
<Set Target="hiresPhoto.ImageUrl" Value="{photo_url}" />
<Set Target="nameText.Value" Value="{name}" />
<Set Target="avatarImage.Url" Value="{avatar_url}" />
<Set Target="launchUri.Uri" Value="{user_url}" />
<Set Target="votesCountText.Value" Value="{votes_count}" />
<!-- Trigger layout change -->
<Set zoomMove.RelativeNode="image" />
<Set zoomScale.RelativeNode="image" />
<Set detailsMode.Value="true" Delay="0.05" />
</Clicked>
</WhileTrue>
</Panel>
</Each>
</Panel>
<Panel ux:Name="bottomPanel" Height="40">
<Spinner ux:Name="bottomSpinner" Width="20" Height="20" StrokeWidth="2" Visibility="Hidden" />
<WhileTrue Value="{IsLoadingMore}">
<Change bottomSpinner.IsEnabled="true" Duration="0" DurationBack="0" />
<Change bottomSpinner.Visibility="Visible" Duration="0" DurationBack="0" />
</WhileTrue>
</Panel>
</StackPanel>
<WhileCount Items="{feed}" GreaterThan="0">
<!-- Reload trigger -->
<ScrollingAnimation Range="SnapMin">
<Change topPanel.Height="150" Duration="1" />
<Change topDownImage.Opacity="1" Duration="0.4" Delay="0.1" />
</ScrollingAnimation>
<PullToReload IsLoading="{IsReloading}" ReloadHandler="{Reload}">
<State ux:Binding="Loading">
<Change topDownImage.Visibility="Hidden" Duration="0" />
</State>
</PullToReload>
</WhileCount>
<!-- Load more trigger -->
<WhileFalse Value="{IsLoadingMore}">
<WhileScrollable ScrollDirections="Down" Invert="true">
<Callback Handler="{LoadMore}" />
</WhileScrollable>
</WhileFalse>
<!-- Loading/empty view -->
<WhileEmpty Items="{feed}">
<Set scrollView.ScrollPosition="0" />
<Change loadingPanel.Visibility="Visible" />
</WhileEmpty>
</ScrollView>