Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c687fa5
Swipe To Refresh
PureWeen Aug 9, 2019
c50d061
pull in pull to refresh
PureWeen Aug 9, 2019
bdd91b7
api changes
PureWeen Aug 12, 2019
c952aa8
Added RefreshView CoreGallery and Gallery Samples (using ScrollView, …
jsuarezruiz Aug 14, 2019
79c7ed2
Code refactoring in RefreshViewRenderer (iOS)
jsuarezruiz Aug 14, 2019
903092c
Updated RefreshView Android Renderer
jsuarezruiz Aug 16, 2019
1270f4c
Fixed RefreshView Android samples in Core Gallery
jsuarezruiz Aug 20, 2019
4a1a809
Added initial RefreshView UWP implementation
jsuarezruiz Aug 20, 2019
929e77a
Added another UWP RefreshView renderer using WinUI NuGet controls (Re…
jsuarezruiz Aug 20, 2019
245c149
- additional linker settings
PureWeen Aug 20, 2019
7f10c46
- uwp fixes
PureWeen Aug 20, 2019
f2da551
- disable SkipMicrosoftUIXamlCheckTargetPlatformVersion check
PureWeen Aug 20, 2019
52d3024
Update .nuspec/Xamarin.Forms.targets
PureWeen Aug 20, 2019
0bc92ac
Limited RefreshView in Android to support only content using scroll.
jsuarezruiz Aug 21, 2019
527581f
Fixed Visualizer colors in UWP RefreshView
jsuarezruiz Aug 21, 2019
a725607
Added UWP RefreshPullDirection Platform Specific
jsuarezruiz Aug 21, 2019
aacebc2
Small changes in code syntax in iOS renderer.
jsuarezruiz Aug 21, 2019
18981ce
Removed some unnecessary curly braces .
jsuarezruiz Aug 21, 2019
11e039e
Register effect provider in iOS RefreshView
jsuarezruiz Aug 21, 2019
30045d6
Changes in RefreshView UWP Dispose
jsuarezruiz Aug 21, 2019
76a197a
Added conditional code to manage the refresh control differently if i…
jsuarezruiz Aug 22, 2019
5acfa5e
Fixed error in Android Core Gallery (Linker)
jsuarezruiz Aug 23, 2019
18179e8
Changes disposing the Android renderer
jsuarezruiz Aug 23, 2019
a6f5959
- fix SkipMicrosoftUIXamlCheckTargetPlatformVersion so it can be turn…
PureWeen Aug 25, 2019
fc17193
Removed UWP RefreshView renderer and Platform Specific
jsuarezruiz Aug 28, 2019
f059a47
- remove winui from nuspec
PureWeen Aug 28, 2019
0a6d10a
- remove skip checks from targets
PureWeen Aug 28, 2019
d08ebe7
- remove XamlControlsResources
PureWeen Aug 28, 2019
07a4841
- remove skip check on UAP platform
PureWeen Aug 28, 2019
9c7453b
Revert changes in Android Core Gallery manifiest
jsuarezruiz Aug 29, 2019
5cda37d
Revert unnecessary space in UAP Platform csproj
jsuarezruiz Aug 29, 2019
44465ea
Removed unnecessary new line in UWP Resources
jsuarezruiz Aug 29, 2019
86dd08d
Simplified RefreshView iOS Renderer.
jsuarezruiz Aug 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Stubs/Xamarin.Forms.Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ internal class _PageRenderer { }
[RenderWith (typeof (PhoneMasterDetailRenderer))]
#endif
internal class _MasterDetailPageRenderer { }
#if !TIZEN4_0
[RenderWith(typeof(RefreshViewRenderer))]
#endif
internal class _RefreshViewRenderer { }
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<AppxBundle>Always</AppxBundle>
<RuntimeIdentifiers>win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot</RuntimeIdentifiers>
<GenerateAppxPackageOnBuild>False</GenerateAppxPackageOnBuild>
<SkipMicrosoftUIXamlCheckTargetPlatformVersion>true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
Expand Down
3 changes: 3 additions & 0 deletions Xamarin.Forms.Controls/CoreGallery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
using Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries;
using Xamarin.Forms.Controls.Issues;
using Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries;

namespace Xamarin.Forms.Controls
{
Expand Down Expand Up @@ -337,6 +338,8 @@ public override string ToString()
new GalleryPageFactory(() => new ProgressBarCoreGalleryPage(), "ProgressBar Gallery"),
new GalleryPageFactory(() => new MaterialProgressBarGallery(), "ProgressBar & Slider Gallery (Material)"),
new GalleryPageFactory(() => new MaterialActivityIndicatorGallery(), "ActivityIndicator Gallery (Material)"),
new GalleryPageFactory(() => new RefreshViewGallery(), "RefreshView Gallery"),
new GalleryPageFactory(() => new RefreshViewCoreGalleryPage(), "RefreshView Core Gallery"),
new GalleryPageFactory(() => new ScrollGallery(), "ScrollView Gallery"),
new GalleryPageFactory(() => new ScrollGallery(ScrollOrientation.Horizontal), "ScrollView Gallery Horizontal"),
new GalleryPageFactory(() => new ScrollGallery(ScrollOrientation.Both), "ScrollView Gallery 2D"),
Expand Down
14 changes: 13 additions & 1 deletion Xamarin.Forms.Controls/CoreGalleryPages/CoreGalleryPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ internal CoreGalleryPage()

Build(Layout);

Content = new ScrollView { AutomationId = "GalleryScrollView", Content = Layout };
if (SupportsScroll)
Content = new ScrollView { AutomationId = "GalleryScrollView", Content = Layout };
else
{
var content = new Grid { AutomationId = "GalleryScrollView" };
content.Children.Add(Layout);
Content = content;
}
}

protected virtual void InitializeElement(T element) { }
Expand Down Expand Up @@ -229,6 +236,11 @@ protected virtual bool SupportsFocus
get { return true; }
}

protected virtual bool SupportsScroll
{
get { return true; }
}

protected void Add(ViewContainer<T> viewContainer)
{
_viewContainers.Add(viewContainer);
Expand Down
120 changes: 120 additions & 0 deletions Xamarin.Forms.Controls/CoreGalleryPages/RefreshViewCoreGalleyPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
using System;
using System.Windows.Input;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls
{
[Preserve(AllMembers = true)]
internal class RefreshViewCoreGalleryPage : CoreGalleryPage<RefreshView>
{
protected override bool SupportsFocus
{
get { return false; }
}

protected override bool SupportsScroll
{
get { return false; }
}

protected override void InitializeElement(RefreshView element)
{
base.InitializeElement(element);

BindingContext = new RefreshCoreGalleryViewModel();

element.Content = CreateContent();
element.SetBinding(RefreshView.CommandProperty, "RefreshCommand");
element.SetBinding(RefreshView.IsRefreshingProperty, "IsRefreshing");
}

protected override void Build(StackLayout stackLayout)
{
base.Build(stackLayout);

var refreshColorContainer = new ViewContainer<RefreshView>(Test.RefreshView.RefreshColor, new RefreshView
{
Content = CreateContent(),
RefreshColor = Color.Red
});

refreshColorContainer.View.SetBinding(RefreshView.CommandProperty, "RefreshCommand");
refreshColorContainer.View.SetBinding(RefreshView.IsRefreshingProperty, "IsRefreshing");

Add(refreshColorContainer);
}

ScrollView CreateContent()
{
var scrollView = new ScrollView
{
BackgroundColor = Color.Green,
HeightRequest = 250
};

var content = new Grid();

var refreshLabel = new Label
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TextColor = Color.White
};

refreshLabel.SetBinding(Label.TextProperty, "Info");
content.Children.Add(refreshLabel);
scrollView.Content = content;

return scrollView;
}
}

[Preserve(AllMembers = true)]
public class RefreshCoreGalleryViewModel : BindableObject
{
const int RefreshDuration = 1;

private bool _isRefresing;
private string _info;

public RefreshCoreGalleryViewModel()
{
Info = "RefreshView (Pull To Refresh)";
}

public bool IsRefreshing
{
get { return _isRefresing; }
set
{
_isRefresing = value;
OnPropertyChanged();
}
}

public string Info
{
get { return _info; }
set
{
_info = value;
OnPropertyChanged();
}
}

public ICommand RefreshCommand => new Command(ExecuteRefresh);

private void ExecuteRefresh()
{
IsRefreshing = true;

Device.StartTimer(TimeSpan.FromSeconds(RefreshDuration), () =>
{
IsRefreshing = false;
Info = "Refreshed (Pull To Refresh again)";
return false;
});
}
}
}
2 changes: 1 addition & 1 deletion Xamarin.Forms.Controls/GalleryPages/GalleryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public static class GalleryBuilder
public static Button NavButton(string galleryName, Func<ContentPage> gallery, INavigation nav)
{
var automationId = System.Text.RegularExpressions.Regex.Replace(galleryName, " |\\(|\\)", string.Empty);
var button = new Button { Text = $"{galleryName}", AutomationId = automationId, FontSize = 10, HeightRequest = 30 };
var button = new Button { Text = $"{galleryName}", AutomationId = automationId, FontSize = 10, HeightRequest = Device.RuntimePlatform == Device.Android ? 40 : 30 };
button.Clicked += (sender, args) => { nav.PushAsync(gallery()); };
return button;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries.RefreshCollectionViewGallery"
Title="CollectionView (Pull To Refresh)">
<ContentPage.Content>
<RefreshView
IsRefreshing="{Binding IsRefreshing}"
RefreshColor="Pink"
Command="{Binding RefreshCommand}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<CollectionView
ItemsSource="{Binding Items}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView
Grid.Column="0"
Color="{Binding Color}"
HeightRequest="48"/>
<Label
Grid.Column="1"
Text="{Binding Name}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries
{
[Preserve(AllMembers = true)]
public partial class RefreshCollectionViewGallery : ContentPage
{
public RefreshCollectionViewGallery()
{
InitializeComponent();
BindingContext = new RefreshViewModel();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries.RefreshLayoutGallery"
Title="Layout (Pull To Refresh)">
<ContentPage.Resources>
<ResourceDictionary>

<DataTemplate x:Key="RefreshItemTemplate">
<Grid
HeightRequest="100"
WidthRequest="100">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<BoxView
Grid.Row="0"
Color="{Binding Color}"/>
<Label
Grid.Row="1"
Text="{Binding Name}"/>
</Grid>
</DataTemplate>

</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<RefreshView
IsRefreshing="{Binding IsRefreshing}"
RefreshColor="Red"
Command="{Binding RefreshCommand}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<StackLayout
Padding="6">
<Label
FontSize="Medium"
FontAttributes="Bold"
Text="The Content of a RefreshView must be a scrollable control, such as ScrollView, CollectionView, ListView, etc."/>
<Label
FontSize="Small"
Text="Setting the Content to a control like Grid will result in undefined behavior."/>
</StackLayout>
</RefreshView>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries
{
[Preserve(AllMembers = true)]
public partial class RefreshLayoutGallery : ContentPage
{
public RefreshLayoutGallery()
{
InitializeComponent();
BindingContext = new RefreshViewModel();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries.RefreshListViewGallery"
Title="ListView (Pull To Refresh)">
<ContentPage.Content>
<StackLayout>
<Button
Text="Trigger Refresh"
Command="{Binding RefreshCommand}"/>
<RefreshView
IsRefreshing="{Binding IsRefreshing}"
BackgroundColor="Red"
RefreshColor="Yellow"
Command="{Binding RefreshCommand}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<ListView
ItemsSource="{Binding Items}"
Header = "Header"
Footer = "Footer"
HasUnevenRows="True"
SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView
Grid.Column="0"
Color="{Binding Color}"
HeightRequest="48"/>
<Label
Grid.Column="1"
Text="{Binding Name}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</RefreshView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.GalleryPages.RefreshViewGalleries
{
[Preserve(AllMembers = true)]
public partial class RefreshListViewGallery : ContentPage
{
public RefreshListViewGallery()
{
InitializeComponent();
BindingContext = new RefreshViewModel();
}
}
}
Loading