Skip to content

Instantly share code, notes, and snippets.

Softlion (Benjamin Mayrargue) softlion

Block or report user

Report or block softlion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@softlion
softlion / RealtimeBlurView.cs
Created Feb 25, 2019
Xamarin RealtimeBlurView
View RealtimeBlurView.cs
using System;
using Android.App;
using Android.Content;
using Android.Content.Res;
using Android.Graphics;
using Android.Renderscripts;
using Android.Runtime;
using Android.Util;
using Android.Views;
using R = VfrApp.Droid.Resource;
View log vs2017.txt
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
Running restore with 8 concurrent jobs.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\AirApp.Core\AirApp.csproj.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\AirApp.Droid\AirApp.Droid.csproj.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\Company2.Toolbox\Company2.Toolbox.csproj.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\AirApp.iOS\AirApp.iOS.csproj.
The restore inputs for 'Company2.Toolbox' have not changed. No further actions are required to complete the restore.
Committing restore...
Assets file has not changed. Skipping assets file writing. Path: C:\Dev\repos\Company\Company.AirAppApp\Company2.Toolbox\obj\project.assets.json
@softlion
softlion / ParallaxHeaderBehavior.cs
Created Aug 6, 2018
A Parallax header for your RecyclerView using a CoordinatorLayour Behavior (Android Development)
View ParallaxHeaderBehavior.cs
using System;
using Android.Content;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V4.View;
using Android.Support.V4.Widget;
using Android.Support.V7.Widget;
using Android.Util;
using Android.Views;
using Object = Java.Lang.Object;
@softlion
softlion / poeditor-export.js
Created Feb 9, 2018
poeditor: export all projects/languages to resx files (or any format)
View poeditor-export.js
//Install nodejs and the npm dependencies:
//npm install node-poeditor
//npm install async-file
//npm install linq-es2015
//npm install requisition
//
//run:
//node poeditor-export.js
const token = 'you-api-token-here';
@softlion
softlion / ParallaxHeaderExtension.cs
Created Jan 5, 2018
Xamarin objc_getAssociatedObject / objc_setAssociatedObject snippet
View ParallaxHeaderExtension.cs
public class ParallaxHeader : UIView
{
public UIScrollView ScrollView { get; set; }
}
public static class ParallaxHeaderExtension
{
private static readonly NSString DescriptiveName = new NSString("Vapolia." + nameof(ParallaxHeader));
enum AssociationPolicy {
View 01-Visibility2TargetBinding.md

Abstract

Mvvmcross includes a convert which translates a boolean into an MvxVisibility enumerable, and a target binding on each platform which translates an MvxVisibility to either a View.Visibility on Android, or an inverted boolean for UIView.Hidden on iOS.

Its usage requires to use a magic string ("Visibility") 2 times in the binding description. And it supports only boolean values in the viewmodel.

And last, it is distributed as a Mvvmcross plugin, which slows down the app's startup time, and crashes the app when the "link all" build option is activated", unless you add special code to prevent it. If you forget to add the plugin, it won't crash, it won't log, and you may search for your error a long time before remembering to add the plugin.

@softlion
softlion / SvgTabbedPageRenderer.cs
Created Nov 22, 2017
SvgTabbedPageRenderer to get icons on tab on Android with Xamarin.Forms (see https://github.com/softlion/XamSvg-Samples)
View SvgTabbedPageRenderer.cs
using System;
using System.Threading;
using Android.Content;
using Android.Support.Design.Widget;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.AppCompat;
using XamSvg.Demo.Droid;
using XamSvg.XamForms;
[assembly:ExportRenderer(typeof(TabbedPage), typeof(SvgTabbedPageRenderer))]
@softlion
softlion / Interaction.cs
Created Jul 21, 2017
Better Mvvmcross Interactions
View Interaction.cs
namespace Vapolia.Mvvmcross.Interactions
{
public class InteractionConverter<TRequest, TResult> : IMvxValueConverter
{
private readonly Func<TRequest, Task<TResult>> action;
public InteractionConverter()
{
}
View AnimatedStackVisibilityTargetBinding.cs
using System;
using Foundation;
using MvvmCross.Binding;
using MvvmCross.Binding.Bindings.Target.Construction;
using MvvmCross.Binding.iOS.Target;
using MvvmCross.Platform.UI;
using UIKit;
namespace Vapolia.Ios.Lib.MvxUi
{
@softlion
softlion / Rotate180TargetBinding.cs
Created Feb 16, 2017
Mvvmcross Rotate180TargetBinding
View Rotate180TargetBinding.cs
/// <summary>
/// Usage:
/// set.Bind(AnyView).For(Rotate180TargetBinding.Name).To(vm => vm.AnyBooleanValue);
/// </summary>
public class Rotate180TargetBinding : MvxTargetBinding
{
private readonly WeakReference<UIView> weakView;
public const string Name = "Rotate180";
You can’t perform that action at this time.