Skip to content

Instantly share code, notes, and snippets.

View erikkerber's full-sized avatar
📱
One of the "OK" ones

Erik Kerber erikkerber

📱
One of the "OK" ones
View GitHub Profile
@erikkerber
erikkerber / ResourceHelper.cs
Created July 31, 2012 13:32
MonoDroid Resource to FileSystem management
using System;
using System.Collections.Generic;
using Android.Content.Res;
using System.Resources;
using System.IO;
using Android.Content;
using Android.App;
namespace AndroidSandbox
{
// Ensures the shake is strong enough on at least two axes before declaring it a shake.
// "Strong enough" means "greater than a client-supplied threshold" in G's.
static BOOL L0AccelerationIsShaking(UIAcceleration* last, UIAcceleration* current, double threshold) {
double
deltaX = fabs(last.x - current.x),
deltaY = fabs(last.y - current.y),
deltaZ = fabs(last.z - current.z);
return
(deltaX > threshold && deltaY > threshold) ||