adjust UI
This commit is contained in:
66
Gallery.Share/Views/GalleryPage.xaml.cs
Normal file
66
Gallery.Share/Views/GalleryPage.xaml.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Gallery.Resources.UI;
|
||||
using Gallery.Util;
|
||||
using Gallery.Util.Interface;
|
||||
using Gallery.Util.Model;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Gallery.Views
|
||||
{
|
||||
public partial class GalleryPage : GalleryCollectionPage
|
||||
{
|
||||
private int currentPage;
|
||||
|
||||
public GalleryPage(IGallerySource source) : base(source)
|
||||
{
|
||||
Resources.Add("cardView", GetCardViewTemplate());
|
||||
InitializeComponent();
|
||||
|
||||
currentPage = 1;
|
||||
}
|
||||
|
||||
protected override ActivityIndicator LoadingIndicator => activityLoading;
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
if (currentPage != 1 && Gallery == null)
|
||||
{
|
||||
currentPage = 1;
|
||||
}
|
||||
base.OnAppearing();
|
||||
}
|
||||
|
||||
protected override async Task<GalleryItem[]> DoloadGalleryData(bool force)
|
||||
{
|
||||
var result = await source.GetRecentItemsAsync(currentPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override IEnumerable<GalleryItem> DoGetGalleryList(GalleryItem[] data, out int tag)
|
||||
{
|
||||
tag = currentPage;
|
||||
return data;
|
||||
}
|
||||
|
||||
private void FlowLayout_MaxHeightChanged(object sender, HeightEventArgs e)
|
||||
{
|
||||
SetOffset(e.ContentHeight - scrollView.Bounds.Height - SCROLL_OFFSET);
|
||||
}
|
||||
|
||||
protected override bool CheckRefresh()
|
||||
{
|
||||
currentPage++;
|
||||
#if DEBUG
|
||||
Log.Print($"loading page: {currentPage}");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ScrollView_Scrolled(object sender, ScrolledEventArgs e)
|
||||
{
|
||||
var y = e.ScrollY;
|
||||
OnScrolled(y);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user