Sharpnado 1.4.0: Drag and Drop and Refresh!

Lib Version
Sharpnado.Presentation.Forms
Sharpnado.Presentation.HorizontalListView

Github: https://github.com/roubachof/Sharpnado.Presentation.Forms

Sharpnado 1.4.0

Release notes

Improvements

  • added material dark theme to MaterialFrame: elevation is converted to dark background according to: Material dark theme specs
  • #85 added IsDraggable property to DraggableViewCell to prevent the dragging of chosen items
  • #91 added clicked event handler for TabButton
  • #97 updated IconImageSource property type from string to ImageSource, which means support for embedded images or font icons

Fixes

  • #94 fixed background color and shadow type update for TabHostView
  • #95 fixed UpdateTextVisibility throwing null reference exception while styling the global class
  • fixed usage of RefreshView with HorizontalListView on ios
  • fixed tintable image on ios with a lovely nasty trick
  • disabled [android] RefreshView while drag and drop is in progress

Refactoring

What is yummy?

Can now prevent some cells to be moved in drag'n'drop mode

Drag and drop in ListView is still there, but it works now better than ever with the possibilty to "lock" come cell, so they can't be moved around. Could be pretty convenient if you want to add a button in the list.

New dark theme for the Silly! app

The library sample app design has been updated to a more mordern dark style. It uses the same style that the SkiaSharpnado samples.
More work will be done around theming and dark mode in the library in the upcoming months, so stay tuned :)

<DataTemplate x:Key="AddSillyDudeItem">  
    <renderedViews:DraggableViewCell x:Name="DraggableViewCell" IsDraggable="False">
        <renderedViews:MaterialFrame Elevation="4">
            <Button HeightRequest="40"
                    Padding="0"
                    HorizontalOptions="Center"
                    VerticalOptions="Center"
                    BackgroundColor="Transparent"
                    Command="{Binding OnItemTappedCommand}"
                    FontFamily="{StaticResource FontSemiBold}"
                    FontSize="15"
                    Text="ADD A DUDE"
                    TextColor="{StaticResource Accent}" />
        </renderedViews:MaterialFrame>
    </renderedViews:DraggableViewCell>
</DataTemplate>  

RefreshView support

Some incompatilities have been raised with the RefreshView both on android and ios platforms. Those ones have been fixed and the HorizontalListView is now fully compatible with the new RefreshView. You can find an example in the Silly! app here: https://github.com/roubachof/Xamarin-Forms-Practices/blob/master/SillyCompany.Mobile.Practices/Presentation/Views/SillyInfiniteGridPeoplePage.xaml.

TaskLoaderView 2.0

Sharpnado.Presentation.Forms now includes TaskLoaderView 2.0

  • Handles error with custom messages and icons
  • Handles empty states
  • Show snackbar errors for refresh scenarios (if data is already shown)
  • Handles retry with button
  • Support Xamarin.Forms.Skeleton
  • Can override any state views with your own custom ones

Library is now using the TaskMonitor

With the TaskMonitor as the backbone of all Sharpnado's lib, you can now configure all your monitored tasks globally.

  • Global configuration for custom statistics and errors handlers:
TaskMonitorConfiguration.LogStatistics = true;  
TaskMonitorConfiguration.StatisticsHandler = (taskMonitor, timeSpan) =>  
{
    // ... Your custom stats handler
};

TaskMonitorConfiguration.ErrorHandler = (taskMonitor, message, exception) =>  
{
    // ... Your custom error handler (call to appcenter crash service etc...)
};
  • Global configuration for enabling default statistics and errors handlers:
TaskMonitorConfiguration.LogStatistics = true;

public static void DefaultExceptionTracer(ITaskMonitor taskMonitor, string message, Exception exception)  
{
    Trace.WriteLine(ExceptionTracerFormatter(taskMonitor, message, exception));
}

public static void DefaultStatisticsTracer(ITaskMonitor taskMonitor, TimeSpan taskExecutionTime)  
{
    Trace.WriteLine(StatisticsTracerFormatter(taskMonitor, taskExecutionTime));
}

Output:

TaskMonitor|ERROR|013|Error in wrapped task  
Exception:System.Exception: Fault  
   at Sharpnado.Tasks.Tests.TaskMonitorTest.DelayFaultAsync() in D:\Dev\Sharpnado\src\TaskMonitor\Sharpnado.TaskMonitor.Tests\TaskMonitorTest.cs:line 262
   at Sharpnado.Tasks.TaskMonitorBase.MonitorTaskAsync(Task task) in D:\Dev\Sharpnado\src\TaskMonitor\Sharpnado.TaskMonitor\TaskMonitorBase.cs:line 186
TaskMonitor|STATS|013|NominalFaultTestTask => Status: IsFaulted, Executed in 246,55870000000002 ms