Skip to content

Instantly share code, notes, and snippets.

@Redth
Created August 29, 2013 18:53
Show Gist options
  • Select an option

  • Save Redth/6381995 to your computer and use it in GitHub Desktop.

Select an option

Save Redth/6381995 to your computer and use it in GitHub Desktop.
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace EggsTest
{
[Activity (Label = "EggsTest", MainLauncher = true)]
public class MainActivity : Activity
{
EggsToGo.Easter easter;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
var easyEgg = new EggsToGo.CustomEgg ("Easy").WatchForSequence(EggsToGo.Command.SwipeUp(), EggsToGo.Command.SwipeUp(), EggsToGo.Command.Tap(), EggsToGo.Command.Tap());
easter = new EggsToGo.Easter (new EggsToGo.KonamiCode(), easyEgg);
easter.EggDetected += (command) => RunOnUiThread (() => AndroidHUD.AndHUD.Shared.ShowSuccess(this, "Detected Egg! " + command.Name, AndroidHUD.MaskType.Black, TimeSpan.FromSeconds(3)));
easter.CommandDetected += cmd => AndroidHUD.AndHUD.Shared.ShowToast (this, cmd.Value, AndroidHUD.MaskType.Clear, TimeSpan.FromMilliseconds (300), false);
}
public override bool OnTouchEvent (MotionEvent e)
{
easter.OnTouchEvent (e);
return base.OnTouchEvent (e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment