optimize animation
This commit is contained in:
@ -17,7 +17,7 @@
|
|||||||
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
||||||
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
|
<ActivityIndicator x:Name="activityLoading" Margin="0, -40, 0, 0"
|
||||||
HeightRequest="40"
|
HeightRequest="40"
|
||||||
IsRunning="{Binding IsLoading}"
|
IsRunning="{Binding IsLoading}"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
|
@ -12,7 +12,7 @@ namespace Pixiview.Illust
|
|||||||
{
|
{
|
||||||
public partial class FavoritesPage : FavoriteIllustCollectionPage
|
public partial class FavoritesPage : FavoriteIllustCollectionPage
|
||||||
{
|
{
|
||||||
private const int STEP = 24;
|
private const int STEP = 20;
|
||||||
|
|
||||||
private int startIndex;
|
private int startIndex;
|
||||||
private int nextIndex;
|
private int nextIndex;
|
||||||
|
@ -200,7 +200,7 @@ namespace Pixiview.Illust
|
|||||||
lastUpdated = LastUpdated;
|
lastUpdated = LastUpdated;
|
||||||
|
|
||||||
var indicator = LoadingIndicator;
|
var indicator = LoadingIndicator;
|
||||||
if (indicator == null)
|
if (indicator == null || isBottom)
|
||||||
{
|
{
|
||||||
if (isBottom)
|
if (isBottom)
|
||||||
{
|
{
|
||||||
@ -212,35 +212,28 @@ namespace Pixiview.Illust
|
|||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
}
|
}
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
Task.Run(() => DoLoadIllusts(force, isBottom));
|
Device.StartTimer(TimeSpan.FromMilliseconds(48), () =>
|
||||||
#else
|
#else
|
||||||
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Task.Run(() => DoLoadIllusts(force, isBottom));
|
Task.Run(() => DoLoadIllusts(force, isBottom));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var offset = 16 - IndicatorMarginTop;
|
|
||||||
indicator.Margin = new Thickness(0, loadingOffset - offset, 0, offset);
|
|
||||||
if (isBottom)
|
|
||||||
{
|
|
||||||
IsBottomLoading = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InvalidateCollection();
|
InvalidateCollection();
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
}
|
|
||||||
|
var offset = 16 - IndicatorMarginTop;
|
||||||
indicator.Animate("margin", top =>
|
indicator.Animate("margin", top =>
|
||||||
{
|
{
|
||||||
indicator.Margin = new Thickness(0, top, 0, offset);
|
indicator.Margin = new Thickness(0, top, 0, offset);
|
||||||
},
|
},
|
||||||
loadingOffset - offset, 16 - offset, easing: Easing.CubicOut, finished: (v, r) =>
|
loadingOffset - offset, 16 - offset, easing: Easing.CubicOut, finished: (v, r) =>
|
||||||
{
|
{
|
||||||
Task.Run(() => DoLoadIllusts(force, isBottom));
|
_ = Task.Run(() => DoLoadIllusts(force, isBottom));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,9 +246,17 @@ namespace Pixiview.Illust
|
|||||||
var indicator = LoadingIndicator;
|
var indicator = LoadingIndicator;
|
||||||
if (indicator == null || bottom)
|
if (indicator == null || bottom)
|
||||||
{
|
{
|
||||||
Illusts = collection;
|
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
IsBottomLoading = false;
|
IsBottomLoading = false;
|
||||||
|
#if __IOS__
|
||||||
|
Device.StartTimer(TimeSpan.FromMilliseconds(48), () =>
|
||||||
|
#else
|
||||||
|
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Illusts = collection;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -266,17 +267,18 @@ namespace Pixiview.Illust
|
|||||||
},
|
},
|
||||||
16 - offset, loadingOffset - offset, easing: Easing.CubicIn, finished: (v, r) =>
|
16 - offset, loadingOffset - offset, easing: Easing.CubicIn, finished: (v, r) =>
|
||||||
{
|
{
|
||||||
|
indicator.Margin = new Thickness(0, v, 0, offset);
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
IsBottomLoading = false;
|
IsBottomLoading = false;
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
Illusts = collection;
|
Device.StartTimer(TimeSpan.FromMilliseconds(48), () =>
|
||||||
#else
|
#else
|
||||||
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Illusts = collection;
|
Illusts = collection;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
||||||
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ActivityIndicator x:Name="activityLoading" Margin="0, 66, 0, 0"
|
<ActivityIndicator x:Name="activityLoading" Margin="0, 10, 0, 0"
|
||||||
HeightRequest="40"
|
HeightRequest="40"
|
||||||
IsRunning="{Binding IsLoading}"
|
IsRunning="{Binding IsLoading}"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
||||||
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
|
<ActivityIndicator x:Name="activityLoading" Margin="0, -40, 0, 0"
|
||||||
HeightRequest="40"
|
HeightRequest="40"
|
||||||
IsRunning="{Binding IsLoading}"
|
IsRunning="{Binding IsLoading}"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<ScrollView x:Name="scrollView" HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
<ScrollView x:Name="scrollView" HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
|
<ActivityIndicator x:Name="activityLoading" Margin="0, -40, 0, 0"
|
||||||
HeightRequest="40"
|
HeightRequest="40"
|
||||||
IsRunning="{Binding IsLoading}"
|
IsRunning="{Binding IsLoading}"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
|
@ -286,16 +286,15 @@ namespace Pixiview.Illust
|
|||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
UserRecommendsVisible = list.Count > 0;
|
UserRecommendsVisible = list.Count > 0;
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
Users = list;
|
Device.StartTimer(TimeSpan.FromMilliseconds(48), () =>
|
||||||
Illusts = IllustCollection;
|
|
||||||
#else
|
#else
|
||||||
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
Device.StartTimer(TimeSpan.FromMilliseconds(150), () =>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Users = list;
|
Users = list;
|
||||||
Illusts = IllustCollection;
|
Illusts = IllustCollection;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
|
|
||||||
DoLoadUserRecommendsImages(list);
|
DoLoadUserRecommendsImages(list);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
||||||
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
|
<ActivityIndicator x:Name="activityLoading" Margin="0, -40, 0, 0"
|
||||||
HeightRequest="40"
|
HeightRequest="40"
|
||||||
IsRunning="{Binding IsLoading}"
|
IsRunning="{Binding IsLoading}"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
||||||
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
|
<ActivityIndicator x:Name="activityLoading" Margin="0, -40, 0, 0"
|
||||||
HeightRequest="40"
|
HeightRequest="40"
|
||||||
IsRunning="{Binding IsLoading}"
|
IsRunning="{Binding IsLoading}"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
|
Reference in New Issue
Block a user