Back to project page MobilHackathon2014.
The source code is released under:
GNU General Public License
If you think the Android project MobilHackathon2014 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.google.android.glass.eye; //from www. j a va2 s .c o m import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; public class EyeEventReceiver extends BroadcastReceiver { private static final String TAG = "EyeEventReceiver"; private static final String WINK = "WINK"; private static final String DOUBLE_BLINK = "DOUBLE_BLINK"; /** * An interface for a listener to capture wink and double blinks */ public static interface EyeEventListener { public void onWink(); public void onBlink(); public void onDoubleBlink(); } private EyeEventListener mListener; public EyeEventReceiver(EyeEventListener listener) { mListener = listener; } public void setEyeEventListener(EyeEventListener listener) { mListener = listener; } @Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); String eyeEvent = extras.getString("gesture"); Log.d(TAG, eyeEvent + " is detected"); if (mListener != null) { if (eyeEvent.equals(EyeGesture.WINK)) { mListener.onWink(); } else if (eyeEvent.equals(EyeGesture.BLINK)) { mListener.onBlink(); } else if (eyeEvent.equals(EyeGesture.DOUBLE_BLINK)) { mListener.onDoubleBlink(); } else{ Log.i(TAG, "Unknown Gesture: \"" + eyeEvent + "\""); } } //abortBroadcast(); } }