Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 17a23ee

Browse files
jfversluispictosgithub-actions[bot]AndreiMisiukevichSkyeHoefling
authored
Develop into main for 1.2 stable (#1460)
* merge main -> dev (#1300) * Automated dotnet-format update (#1296) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * #1292 (#1301) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Andrei <andrei.misiukevich@gmail.com> * Expander: Add touch capture view + common animation length / easing properties (#1349) * Added base animation props * Added TouchCaptureView property * Updated light dismiss xml docs (#1366) * [Converter] Added IsInRangeConverter (#1158) * Added IsBetweenConverter * Renamed to IsInRangeConverter * Added Sample Page * Added IsInRangeConverterViewModel * Updated UnitTests * Cleanup * Removed RevertResult * Implemented BindableObjectExtension * Made ValueConverterExtension inherited from BindableObject Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> Co-authored-by: Andrei <andrei.misiukevich@gmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> * Drawing View (#740) * DrawingView (#468) * DrawingView control, samples, documentation * fix build issues Co-authored-by: Vladislav Antonyuk <vlad.antonyuk@outlook.com> Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * fixed codestyle on Android renderer * GTK renderer adjustments * iOS renderer adjustments * MacOS renderer adjustments * TIzen rendere adjustments * UWP renderer adjustments * WPF tests * Fixed merge conflict * Fixed wpf stackoverflow exception * fixed iOS leaks * revert toast change * removed wpf implementations * root sample page to WelcomePage * removed DrawingView ctor from MainWindow * removed drawing instructions from readme * Update README.md * Drawing View - Fix nullable, add doc to the public method (#1293) * Fix nullable, add doc to the public method. add WPF * Remove WPF renderer from the library. * Change exception message for small images, fix nullable * return null instead of exception (#1339) Co-authored-by: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com> Co-authored-by: Vladislav Antonyuk <vlad.antonyuk@outlook.com> Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> * Added IsLightDismissed to PopupDismissedEvent (#1362) * Added IsLightDismissed to PopupDismissedEvent; Fixed Dismissed event so it fires when light dismissed for UWP and Android * Removing stale comments * Added Opened event handler to set isOpen to true when Popup displays * Fixed event cleanup code to unregisterd Closing event Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> * Fix Android crashes if Bitmap is small, Fix iOS drawing in scrollView (#1421) * Add StatusBarEffect and NavigationBarEffect classes to manage their color and style (#812) * Sample Android implementation (doesn't work) * Update to Android 11 * Add OnElementPropertyChanged * Refactor GetWindow a bit * Add dummy implementations for iOS and UWP * Update Xamarin.CommunityToolkit.csproj * Update Xamarin.CommunityToolkit.csproj * Fixed get Activity property * Update PlatformBarStyle.android.cs * Remove NavigationBar bits * Make SetStatusBarColor available on API 23+ * Make StatusBar white for demo app * Rename BarStyle to Window * Fix spaces * Revert "Update to Android 11" This reverts commit 656f0d0. * Update Xamarin.CommunityToolkit.csproj * Rename Window to WindowEffect * Revert Android 11 API support * Set status bar style in app.xaml * Replaced Window with WindowEffect is other places * Remove Detached implementation * Add WindowEffectAndroid for navigation bar stuff * Refactor SetBarStyle methods * Add UWP implementation * Add iOS implemetation (not tested) * Use switch expression * Add `#region` to specify Linker Work-Around * Rename WindowEffect to StatusBarEffect * Rename WindowEffectAndroid to PlatformNavigationBarEffect * Fix nullability errors * Commit to rerun tests * Revert "Commit to rerun tests" This reverts commit f207c74. * Add sample page * Fix default is not applied on Android * Fix radiobutton name on sample page * Add android specific NavigationBar class * Remove unneeded null checks * Coverted StatusBarEffect to static class * Improve description * Update EffectIds.shared.cs * Remove unneeded activity parameter * Refactor StatusBar.uwp * Setting view model in XAML * Update NavigationBar.android.cs * Make StatusBar style setters accessible from C# * Add XML documentation * Remove unrelated code * Move constant outside the loop * Add logs if bar style is not supported * Remove LightContent case * Commit to rerun build * Revert "Commit to rerun build" This reverts commit a49e18f. * Revert "Revert "Commit to rerun build"" This reverts commit c9b3d5b. * Revert "Revert "Revert "Commit to rerun build""" This reverts commit 7152b25. * Change Debug to Trace * Replace Trace with Log * Update src/CommunityToolkit/Xamarin.CommunityToolkit/PlatformConfiguration/AndroidSpecific/NavigationBar.shared.cs Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Update src/CommunityToolkit/Xamarin.CommunityToolkit/PlatformConfiguration/AndroidSpecific/NavigationBar.shared.cs Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Revert "Update src/CommunityToolkit/Xamarin.CommunityToolkit/PlatformConfiguration/AndroidSpecific/NavigationBar.shared.cs" This reverts commit c56f02b. * Revert "Update src/CommunityToolkit/Xamarin.CommunityToolkit/PlatformConfiguration/AndroidSpecific/NavigationBar.shared.cs" This reverts commit 6d37b50. * Move enums to sepparate files * Replace linq with methods * Update UpdateStatusBarAppearance to support iOS 13 Co-Authored-By: Daniel Christmas <1112585+justadaniel@users.noreply.github.com> * View controller-based status bar appearance: No Co-Authored-By: Daniel Christmas <1112585+justadaniel@users.noreply.github.com> * Commit to rerun tests * Update EffectsGalleryViewModel.cs * Move files to Effects folder * Converted BarStyle to effects * Update sample app * Drop Windows Mobile support * Get activity from control * Update NavigationBarEffect.shared.cs * Commit to rerun tests * refactoring ios * removed UWP linker hack We don't need it for UWP since we don't have a Linker for it * Removed not needed properties * Remove not needed null checks * Remove using * Commit to rerun tests * Moved NavigationBarEffect to use the platformspecific API * Updated the sample * Fix test * Little better styling Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Daniel Christmas <1112585+justadaniel@users.noreply.github.com> Co-authored-by: Gerald Versluis <gerald@verslu.is> * Drawing view fixes (#1459) * Set default line LineColor as black, Fix ClearOnFinish * Fix SmoothPath issue, update macOS renderer, update sample * Fix tizen build * Snackbar corner radius (#1437) * Snackbar/Toast CornerRadius * iOS, macOS * UWP * WPF * Update sample, add NativeSnackBar.ios.macos.cs * Fix ios, macos corner radius * Update default corner radius to 4 ```xml <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#323232"/> <corners android:radius="4dp"/> </shape> ``` * Set CornerRadius to 10 * Set CornerRadius to 10 * Use default Corner Radius if not specified Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Andrei <andrei.misiukevich@gmail.com> Co-authored-by: Andrew Hoefling <andrewh@fileonq.com> Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Gustavo Oliveira <gu.ol@hotmail.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com> Co-authored-by: Vladislav Antonyuk <vlad.antonyuk@outlook.com> Co-authored-by: Maksym Koshovyi <maximkoshevoi61@gmail.com> Co-authored-by: Daniel Christmas <1112585+justadaniel@users.noreply.github.com>
1 parent e045b9b commit 17a23ee

File tree

85 files changed

+3643
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+3643
-211
lines changed

samples/XCT.Sample.Android/MainActivity.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ protected override void OnCreate(Bundle savedInstanceState)
1414
ToolbarResource = Resource.Layout.Toolbar;
1515

1616
base.OnCreate(savedInstanceState);
17-
18-
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
17+
1918
Essentials.Platform.Init(this, savedInstanceState);
2019
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
2120
LoadApplication(new App());

samples/XCT.Sample.Android/Xamarin.CommunityToolkit.Sample.Android.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
2121
<AndroidUseAapt2>true</AndroidUseAapt2>
2222
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
23+
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
2324
<NuGetPackageImportStamp>
2425
</NuGetPackageImportStamp>
2526
</PropertyGroup>

samples/XCT.Sample.GTK/Xamarin.CommunityToolkit.Sample.GTK.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@
102102
<None Include="app.config" />
103103
</ItemGroup>
104104
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
105-
</Project>
105+
</Project>

samples/XCT.Sample.UWP/App.xaml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Runtime.InteropServices.WindowsRuntime;
62
using Windows.ApplicationModel;
73
using Windows.ApplicationModel.Activation;
8-
using Windows.Foundation;
9-
using Windows.Foundation.Collections;
104
using Windows.UI.Xaml;
115
using Windows.UI.Xaml.Controls;
12-
using Windows.UI.Xaml.Controls.Primitives;
13-
using Windows.UI.Xaml.Data;
14-
using Windows.UI.Xaml.Input;
15-
using Windows.UI.Xaml.Media;
166
using Windows.UI.Xaml.Navigation;
177

188
namespace Xamarin.CommunityToolkit.Sample.UWP

samples/XCT.Sample.UWP/Xamarin.CommunityToolkit.Sample.UWP.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,4 @@
164164
<VisualStudioVersion>14.0</VisualStudioVersion>
165165
</PropertyGroup>
166166
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
167-
</Project>
167+
</Project>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
using System.Collections.Specialized;
2+
using System.ComponentModel;
3+
using System.Linq;
4+
using System.Windows.Controls;
5+
using System.Windows.Ink;
6+
using System.Windows.Input;
7+
using Xamarin.CommunityToolkit.Sample.WPF;
8+
using Xamarin.CommunityToolkit.UI.Views;
9+
using Xamarin.Forms;
10+
using Xamarin.Forms.Platform.WPF;
11+
12+
[assembly: ExportRenderer(typeof(DrawingView), typeof(DrawingViewRenderer))]
13+
namespace Xamarin.CommunityToolkit.Sample.WPF
14+
{
15+
public class DrawingViewRenderer : ViewRenderer<DrawingView, InkCanvas>
16+
{
17+
InkCanvas? canvas;
18+
19+
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
20+
{
21+
base.OnElementPropertyChanged(sender, e);
22+
if (e.PropertyName == DrawingView.PointsProperty.PropertyName)
23+
{
24+
canvas!.Strokes.StrokesChanged -= OnStrokesChanged;
25+
canvas.Strokes.Clear();
26+
LoadPoints();
27+
canvas.Strokes.StrokesChanged += OnStrokesChanged;
28+
}
29+
}
30+
31+
protected override void OnElementChanged(ElementChangedEventArgs<DrawingView> e)
32+
{
33+
base.OnElementChanged(e);
34+
if (Control == null && Element != null)
35+
{
36+
canvas = new InkCanvas
37+
{
38+
DefaultDrawingAttributes =
39+
{
40+
Color = Element.LineColor.ToMediaColor(),
41+
Width = Element.LineWidth,
42+
Height = Element.LineWidth
43+
},
44+
Background = Element.BackgroundColor.ToBrush()
45+
};
46+
Element.Points.CollectionChanged += OnCollectionChanged;
47+
SetNativeControl(canvas);
48+
49+
canvas.Strokes.StrokesChanged += OnStrokesChanged;
50+
Control!.PreviewMouseDown += OnPreviewMouseDown;
51+
}
52+
53+
if (e.OldElement != null)
54+
{
55+
canvas!.Strokes.StrokesChanged -= OnStrokesChanged;
56+
Element!.Points.CollectionChanged -= OnCollectionChanged;
57+
if (Control != null)
58+
Control.PreviewMouseDown -= OnPreviewMouseDown;
59+
}
60+
}
61+
62+
void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) => LoadPoints();
63+
64+
void OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
65+
{
66+
canvas!.Strokes.Clear();
67+
Element.Points.Clear();
68+
}
69+
70+
void OnStrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
71+
{
72+
Element.Points.CollectionChanged -= OnCollectionChanged;
73+
if (e.Added.Count > 0)
74+
{
75+
var points = e.Added.First().StylusPoints.Select(point => new Point(point.X, point.Y));
76+
Element.Points.Clear();
77+
foreach (var point in points)
78+
Element.Points.Add(point);
79+
80+
if (Element.Points.Count > 0)
81+
{
82+
if (Element.DrawingCompletedCommand?.CanExecute(null) ?? false)
83+
Element.DrawingCompletedCommand.Execute(Element.Points);
84+
}
85+
86+
if (Element.ClearOnFinish)
87+
{
88+
canvas!.Strokes.StrokesChanged -= OnStrokesChanged;
89+
canvas.Strokes.Clear();
90+
canvas.Strokes.StrokesChanged += OnStrokesChanged;
91+
Element.Points.Clear();
92+
}
93+
}
94+
95+
Element.Points.CollectionChanged += OnCollectionChanged;
96+
}
97+
98+
void LoadPoints()
99+
{
100+
var stylusPoints = Element?.Points.Select(point => new StylusPoint(point.X, point.Y)).ToList();
101+
if (stylusPoints is { Count: > 0 })
102+
{
103+
var stroke = new Stroke(new StylusPointCollection(stylusPoints), canvas!.DefaultDrawingAttributes);
104+
canvas.Strokes.Add(stroke);
105+
}
106+
}
107+
}
108+
}

samples/XCT.Sample.WPF/MainWindow.xaml.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using System.Windows;
7-
using System.Windows.Controls;
8-
using System.Windows.Data;
9-
using System.Windows.Documents;
10-
using System.Windows.Input;
11-
using System.Windows.Media;
12-
using System.Windows.Media.Imaging;
13-
using System.Windows.Navigation;
14-
using System.Windows.Shapes;
1+
using Xamarin.CommunityToolkit.UI.Views;
152
using Xamarin.Forms.PancakeView.Platforms.WPF;
163
using Xamarin.Forms.Platform.WPF;
174

@@ -25,7 +12,7 @@ public partial class MainWindow : FormsApplicationPage
2512
public MainWindow()
2613
{
2714
InitializeComponent();
28-
Xamarin.Forms.Forms.Init();
15+
Forms.Forms.Init();
2916
PancakeViewRenderer.Init();
3017
LoadApplication(new Xamarin.CommunityToolkit.Sample.App());
3118
}

samples/XCT.Sample.WPF/Xamarin.CommunityToolkit.Sample.WPF.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
<DependentUpon>App.xaml</DependentUpon>
6666
<SubType>Code</SubType>
6767
</Compile>
68+
<Compile Include="DrawingViewRenderer.wpf.cs">
69+
<SubType>Code</SubType>
70+
</Compile>
6871
<Compile Include="MainWindow.xaml.cs">
6972
<DependentUpon>MainWindow.xaml</DependentUpon>
7073
<SubType>Code</SubType>

samples/XCT.Sample.iOS/AppDelegate.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace Xamarin.CommunityToolkit.Sample.iOS
66
// The UIApplicationDelegate for the application. This class is responsible for launching the
77
// User Interface of the application, as well as listening (and optionally responding) to
88
// application events from iOS.
9-
[Register("AppDelegate")]
10-
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
9+
[Register(nameof(AppDelegate))]
10+
public class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
1111
{
1212
// This method is invoked when the application has loaded and is ready to run. In this
1313
// method you should instantiate the window, load the UI into it and then make the window
@@ -16,7 +16,6 @@ public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsAppli
1616
// You have 17 seconds to return from this method, or iOS will terminate your application.
1717
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
1818
{
19-
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
2019
global::Xamarin.Forms.Forms.Init();
2120
LoadApplication(new App());
2221

samples/XCT.Sample.iOS/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@
4646
<array>
4747
<string>audio</string>
4848
</array>
49+
<key>UIViewControllerBasedStatusBarAppearance</key>
50+
<false/>
4951
</dict>
5052
</plist>

0 commit comments

Comments
 (0)