From 87a5f1d6e547566cbe3a7e9c2700c654552f2f80 Mon Sep 17 00:00:00 2001 From: Alvyn Fasuyi Date: Fri, 25 Jan 2019 17:07:42 +0100 Subject: [PATCH] Added PCL projects and linked sample droid project to it --- .../XFShimmerLayoutPCLSample/App.xaml | 2 + .../XFShimmerLayoutPCLSample/App.xaml.cs | 19 + .../Models/NotifyingObject.cs | 29 ++ .../Properties/AssemblyInfo.cs | 26 + .../ViewModels/ShimmerTestPageViewModel.cs | 35 ++ .../Views/ShimmerTestPage.xaml | 222 +++++++++ .../Views/ShimmerTestPage.xaml.cs | 13 + .../XFShimmerLayoutPCLSample.csproj | 92 ++++ .../XFShimmerLayoutPCLSample/packages.config | 40 ++ .../MainActivity.cs | 1 + .../XFShimmerLayoutSample.Android.csproj | 7 +- src/XFShimmerLayout.sln | 13 + .../Controls/ShimmerLayout.cs | 450 ++++++++++++++++++ .../Extensions/CornerRadiusExtensions.cs | 41 ++ .../Extensions/SkiaExtensions.cs | 134 ++++++ .../Models/SkiaHelpers/SKExtCanvasView.cs | 36 ++ .../Models/SkiaHelpers/SKLayout.cs | 14 + .../Models/SkiaHelpers/SKVisualElement.cs | 25 + .../Properties/AssemblyInfo.cs | 26 + .../XFShimmerLayoutPCL.csproj | 66 +++ src/XFShimmerLayoutPCL/packages.config | 6 + 21 files changed, 1293 insertions(+), 4 deletions(-) create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml.cs create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Models/NotifyingObject.cs create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Properties/AssemblyInfo.cs create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/ViewModels/ShimmerTestPageViewModel.cs create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Views/ShimmerTestPage.xaml create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Views/ShimmerTestPage.xaml.cs create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/XFShimmerLayoutPCLSample.csproj create mode 100644 src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/packages.config create mode 100644 src/XFShimmerLayoutPCL/Controls/ShimmerLayout.cs create mode 100644 src/XFShimmerLayoutPCL/Extensions/CornerRadiusExtensions.cs create mode 100644 src/XFShimmerLayoutPCL/Extensions/SkiaExtensions.cs create mode 100644 src/XFShimmerLayoutPCL/Models/SkiaHelpers/SKExtCanvasView.cs create mode 100644 src/XFShimmerLayoutPCL/Models/SkiaHelpers/SKLayout.cs create mode 100644 src/XFShimmerLayoutPCL/Models/SkiaHelpers/SKVisualElement.cs create mode 100644 src/XFShimmerLayoutPCL/Properties/AssemblyInfo.cs create mode 100644 src/XFShimmerLayoutPCL/XFShimmerLayoutPCL.csproj create mode 100644 src/XFShimmerLayoutPCL/packages.config diff --git a/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml new file mode 100644 index 0000000..90013cf --- /dev/null +++ b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml.cs b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml.cs new file mode 100644 index 0000000..c2da10f --- /dev/null +++ b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/App.xaml.cs @@ -0,0 +1,19 @@ +using Xamarin.Essentials; +using Xamarin.Forms.Xaml; +using XFShimmerLayoutPCLSample.Controls; + +[assembly: XamlCompilation(XamlCompilationOptions.Compile)] +namespace XFShimmerLayoutPCLSample +{ + public partial class App + { + public App() + { + InitializeComponent(); + + ShimmerLayout.Init(DeviceDisplay.ScreenMetrics.Density); + + MainPage = new Views.ShimmerTestPage(); + } + } +} diff --git a/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Models/NotifyingObject.cs b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Models/NotifyingObject.cs new file mode 100644 index 0000000..b07450a --- /dev/null +++ b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Models/NotifyingObject.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Xamarin.Forms; + +namespace XFShimmerLayoutPCLSample.Models +{ + public class NotifyingObject : BindableObject + { + private readonly Dictionary _properties; + + public NotifyingObject() + { + _properties = new Dictionary(); + } + + #region [Notify Property Changed] + + protected virtual bool Set(ref T storage, T value, [CallerMemberName] string propertyName = null) + { + if (EqualityComparer.Default.Equals(storage, value)) return false; + + storage = value; + OnPropertyChanged(propertyName); + return true; + } + + #endregion + } +} diff --git a/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Properties/AssemblyInfo.cs b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9074093 --- /dev/null +++ b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XFShimmerLayoutPCLSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/ViewModels/ShimmerTestPageViewModel.cs b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/ViewModels/ShimmerTestPageViewModel.cs new file mode 100644 index 0000000..565a824 --- /dev/null +++ b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/ViewModels/ShimmerTestPageViewModel.cs @@ -0,0 +1,35 @@ +using System.Threading.Tasks; +using Xamarin.Forms; +using XFShimmerLayoutPCLSample.Models; + +namespace XFShimmerLayoutPCLSample.ViewModels +{ + public class ShimmerTestPageViewModel : NotifyingObject + { + private bool _isBusy; + public bool IsBusy + { + get => _isBusy; + set => Set(ref _isBusy, value); + } + + private Command _startAnimationCommand; + public Command StartAnimationCommand + { + get => _startAnimationCommand; + set => Set(ref _startAnimationCommand, value); + } + + public ShimmerTestPageViewModel() + { + StartAnimationCommand = new Command(async () => + { + IsBusy = true; + + await Task.Delay(5000); + + IsBusy = false; + }); + } + } +} diff --git a/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Views/ShimmerTestPage.xaml b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Views/ShimmerTestPage.xaml new file mode 100644 index 0000000..8033ed6 --- /dev/null +++ b/src/Sample/XFShimmerLayoutSample/XFShimmerLayoutPCLSample/Views/ShimmerTestPage.xaml @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +