Skip to content

Instantly share code, notes, and snippets.

View olexale's full-sized avatar
🎯
Focusing

Oleksandr Leushchenko olexale

🎯
Focusing
View GitHub Profile
public class AnimationNavigationControllerDelegate : UINavigationControllerDelegate
{
private TransitionAnimator _animator = new TransitionAnimator();
private int _id;
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForOperation(UINavigationController navigationController, UINavigationControllerOperation operation, UIViewController fromViewController, UIViewController toViewController)
{
if (operation == UINavigationControllerOperation.Push)
{
var image = fromViewController.View.ViewWithTag(_id);
namespace BeatlesApp
{
public class TagEffect : RoutingEffect
{
public TagEffect() : base("BeatlesApp.TagEffect") {}
public static readonly BindableProperty TagProperty =
BindableProperty.CreateAttached("Tag", typeof(int), typeof(TagEffect), 0, propertyChanged: OnTagChanged);
public static int GetTag(BindableObject view)
[assembly: ExportRenderer(typeof(NavigationPage), typeof(AnimationNavigationRenderer))]
namespace BeatlesApp.iOS
{
public class AnimationNavigationRenderer : Xamarin.Forms.Platform.iOS.NavigationRenderer
{
private AnimationNavigationControllerDelegate _delegate;
public override void ViewDidLoad()
{
base.ViewDidLoad();
public class AnimationNavigationControllerDelegate : UINavigationControllerDelegate
{
private TransitionAnimator _animator = new TransitionAnimator();
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForOperation(UINavigationController navigationController, UINavigationControllerOperation operation, UIViewController fromViewController, UIViewController toViewController)
{
return _animator;
}
}
public class TransitionAnimator : UIViewControllerAnimatedTransitioning
{
private const double _duration = 0.5;
public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
{
var containerView = transitionContext.ContainerView;
var toView = transitionContext.GetViewFor(UITransitionContext.ToViewKey);
containerView.AddSubview(toView);
class CounterStore : INotifyPropertyChanged
{
private readonly CounterReducer reducer = new CounterReducer();
private CounterState state;
public CounterStore(CounterState initialState)
{
state = initialState;
}
class CounterReducer
{
public CounterState Reduce(CounterState state, object action)
{
switch (action)
{
case IncrementAction i:
return ProcessIncrement(state);
case DecrementAction d:
return ProcessDecrement(state);
class IncrementAction { }
class DecrementAction { }
class CounterState
{
public CounterState(int count) { Count = count; }
public int Count { get; }
}
@olexale
olexale / android_sceenshot.sh
Created December 13, 2014 08:34
Android screenshot script
#!/bin/sh
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png