change: scroll back to top when refreshing

This commit is contained in:
Tsanie Lily 2020-05-16 19:20:16 +08:00
parent 2cdfe70429
commit 350ef14647
6 changed files with 14 additions and 7 deletions

View File

@ -14,7 +14,7 @@
IconImageSource="{DynamicResource FontIconShare}"/>
</ContentPage.ToolbarItems>
<Grid>
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
<ScrollView x:Name="scrollView" HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
<StackLayout>
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
HeightRequest="40"

View File

@ -74,8 +74,13 @@ namespace Pixiview.Illust
StartLoad(force);
}
private void Refresh_Clicked(object sender, EventArgs e)
private async void Refresh_Clicked(object sender, EventArgs e)
{
if (IsLoading)
{
return;
}
await scrollView.ScrollToAsync(0, -topOffset, true);
flag = false;
lastUpdated = default;
StartLoad(true);

View File

@ -12,8 +12,8 @@
IconImageSource="{DynamicResource FontIconRefresh}"/>
</ContentPage.ToolbarItems>
<Grid>
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never"
Scrolled="ScrollView_Scrolled">
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
<StackLayout>
<ActivityIndicator x:Name="activityLoading" Margin="0, 66, 0, 0"
HeightRequest="40"

View File

@ -53,12 +53,13 @@ namespace Pixiview.Illust
return Stores.LoadIllustData(force);
}
private void Refresh_Clicked(object sender, EventArgs e)
private async void Refresh_Clicked(object sender, EventArgs e)
{
if (IsLoading)
{
return;
}
await scrollView.ScrollToAsync(0, -topOffset, true);
StartLoad(true);
}

View File

@ -12,7 +12,7 @@
IconImageSource="{DynamicResource FontIconRefresh}"/>
</ContentPage.ToolbarItems>
<Grid>
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
<ScrollView x:Name="scrollView" HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
<StackLayout>
<ActivityIndicator x:Name="activityLoading" Margin="0, 16, 0, 0"
HeightRequest="40"

View File

@ -337,12 +337,13 @@ namespace Pixiview.Illust
}
}
private void Refresh_Clicked(object sender, EventArgs e)
private async void Refresh_Clicked(object sender, EventArgs e)
{
if (IsLoading)
{
return;
}
await scrollView.ScrollToAsync(0, -topOffset, true);
StartLoad(true);
}
}