Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
FreakyAli authored Sep 8, 2023
2 parents 3b66512 + bef70dc commit 348b7e7
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 83 deletions.
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
using System;
using Maui.FreakyControls.Extensions;
using Microsoft.Maui.Handlers;

namespace Maui.FreakyControls;
using System;
using Maui.FreakyControls.Extensions;
using Microsoft.Maui.Handlers;

#if ANDROID || IOS
public partial class FreakyDatePickerHandler : DatePickerHandler
{
public FreakyDatePickerHandler()
{
Mapper.AppendToMapping("FreakyDatePickerCustomization", MapDatePicker);
}

// Todo: Remove try-catch added as a quickfix for https://github.com/FreakyAli/Maui.FreakyControls/issues/76
private void MapDatePicker(IDatePickerHandler datePickerHandler, IDatePicker datePicker)
{
try
{
if (datePicker is FreakyDatePicker freakyDatePicker &&
datePickerHandler is FreakyDatePickerHandler freakyDatePickerHandler)
{
if (PlatformView != null && VirtualView != null)
{
if (freakyDatePicker.ImageSource != default(ImageSource))
{
freakyDatePickerHandler.HandleAndAlignImageSourceAsync(freakyDatePicker).RunConcurrently();
}
}
}
}
catch (Exception ex)
{
ex.TraceException();
}
}
}

#else
public partial class FreakyDatePickerHandler : DatePickerHandler
{
}
#endif
namespace Maui.FreakyControls;

#if ANDROID || IOS
public partial class FreakyDatePickerHandler : DatePickerHandler
{
public FreakyDatePickerHandler()
{
Mapper.AppendToMapping("FreakyDatePickerCustomization", MapDatePicker);
}

// Todo: Remove try-catch added as a quickfix for https://github.com/FreakyAli/Maui.FreakyControls/issues/76
private void MapDatePicker(IDatePickerHandler datePickerHandler, IDatePicker datePicker)
{
try
{
if (datePicker is FreakyDatePicker freakyDatePicker &&
datePickerHandler is FreakyDatePickerHandler freakyDatePickerHandler)
{
if (PlatformView != null && VirtualView != null)
{
if (freakyDatePicker.ImageSource != default(ImageSource))
{
freakyDatePickerHandler.HandleAndAlignImageSourceAsync(freakyDatePicker).RunConcurrently();
}
}
}
}
catch (Exception ex)
{
ex.TraceException();
}
}
}

#else
public partial class FreakyDatePickerHandler : DatePickerHandler
{
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ public sealed partial class FreakyEditorHandler : EditorHandler
public FreakyEditorHandler()
{
Mapper.AppendToMapping("FreakyEntryCustomization", MapFreakyEditor);
}

// Todo: Remove try-catch added as a quickfix for https://github.com/FreakyAli/Maui.FreakyControls/issues/76
}

// Todo: Remove try-catch added as a quickfix for https://github.com/FreakyAli/Maui.FreakyControls/issues/76
private void MapFreakyEditor(IEditorHandler editorHandler, IEditor editor)
{
try
{
if (editor is FreakyEditor feditor && editorHandler is FreakyEditorHandler freakyEditorHandler)
{
if (PlatformView != null && VirtualView != null)
{
HandleAllowCopyPaste(feditor);
}
}
}
catch (Exception ex)
{
ex.TraceException();
try
{
if (editor is FreakyEditor feditor && editorHandler is FreakyEditorHandler freakyEditorHandler)
{
if (PlatformView != null && VirtualView != null)
{
HandleAllowCopyPaste(feditor);
}
}
}
catch (Exception ex)
{
ex.TraceException();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,29 @@ public sealed partial class FreakyEntryHandler : EntryHandler
public FreakyEntryHandler()
{
Mapper.AppendToMapping("FreakyEntryCustomization", MapFreakyEntry);
}

// Todo: Remove try-catch added as a quickfix for https://github.com/FreakyAli/Maui.FreakyControls/issues/76
}

// Todo: Remove try-catch added as a quickfix for https://github.com/FreakyAli/Maui.FreakyControls/issues/76
private void MapFreakyEntry(IEntryHandler entryHandler, IEntry entry)
{
try
{
if (entry is FreakyEntry freakyEntry && entryHandler is FreakyEntryHandler freakyEntryHandler)
{
if (PlatformView != null && VirtualView != null)
{
if (freakyEntry.ImageSource != default(ImageSource))
{
freakyEntryHandler.HandleAndAlignImageSourceAsync(freakyEntry).RunConcurrently();
}
HandleAllowCopyPaste(freakyEntry);
}
}
}
catch (Exception ex)
{
ex.TraceException();
}

try
{
if (entry is FreakyEntry freakyEntry && entryHandler is FreakyEntryHandler freakyEntryHandler)
{
if (PlatformView != null && VirtualView != null)
{
if (freakyEntry.ImageSource != default(ImageSource))
{
freakyEntryHandler.HandleAndAlignImageSourceAsync(freakyEntry).RunConcurrently();
}
HandleAllowCopyPaste(freakyEntry);
}
}
}
catch (Exception ex)
{
ex.TraceException();
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion MAUI.FreakyControls/Samples/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Samples;
namespace Samples;

public partial class AppShell : Shell
{
Expand Down Expand Up @@ -26,5 +26,6 @@ public AppShell()
Routing.RegisterRoute(radioButtons, typeof(RadioButtons.RadioButtonsView));
Routing.RegisterRoute(buttons, typeof(ButtonsView.ButtonsView));
Routing.RegisterRoute(jumpList, typeof(JumpList.JumpListView));

}
}
4 changes: 3 additions & 1 deletion MAUI.FreakyControls/Samples/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using System.Windows.Input;
using Application = Microsoft.Maui.Controls.Application;
Expand All @@ -7,6 +7,7 @@ namespace Samples
{
public class MainViewModel : BaseViewModel
{

private ObservableCollection<string> items;

public MainViewModel()
Expand All @@ -25,6 +26,7 @@ public MainViewModel()
AppShell.radioButtons,
AppShell.buttons,
AppShell.jumpList

};
}

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ Add the following using statement and Initialization in your MauiProgram:
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
//Takes one argument if you would like to init Skiasharp through FreakyControls or not. (Used for RadioButton, Checkbox & SVGImageView)
//Takes one argument if you would like to init Skiasharp through FreakyControls or not. (Used for RadioButton, Checkbox & SVGImageView)
builder.InitializeFreakyControls();
return builder.Build();
}
}
Now you can use the controls in your app.

## Activity
Expand Down

0 comments on commit 348b7e7

Please sign in to comment.