ThirdEye Head Motion Gaze UI Controls Documentation

Developer guide

Introduction

Welcome to ThirdEye UI Controls developer guide. By the end of this guide you will know how to listen for actions performed by the UI Controls and implement your own custom logic based on them.
UI Controls was designed in such a way so that you, the third-party developer, have to do as little as possible to integrate its interactions into your app.
That is why everything is managed by functionality already implemented into Android and there is no external library needed.

Depending on the action, there are two ways UI Controls communicates with the Android system and by extension with your app.

  • For the clicks performed on the UI Menu’s buttons and for the cursor’s movement and position, UI Controls broadcasts Intents.
  • For all the other clicks, you handle the events as you normally would if you developed for any regular Android device.

Intents

UI Controls broadcasts Intents as follows:

Description Name Extras
Cursor movement thirdeye.uicontrols.action.CURSOR_MOVED (int) x

(int) y

Home button pressed thirdeye.uicontrols.action.HOME_PRESSED
Back button pressed thirdeye.uicontrols.action.BACK_PRESSED
Scroll up button pressed thirdeye.uicontrols.action.SCROLLED_UP
Scroll down button pressed thirdeye.uicontrols.action.SCROLLED_DOWN
Zoom in button pressed thirdeye.uicontrols.action.ZOOMED_IN
Zoom out button pressed thirdeye.uicontrols.action.ZOOMED_OUT
UI Settings opened thirdeye.uicontrols.action.UI_SETTINGS_OPENED
UI Settings closed thirdeye.uicontrols.action.UI_SETTINGS_CLOSED
Task Manager button pressed thirdeye.uicontrols.action.TASK_MANAGER_PRESSED
UI Menu visible thirdeye.uicontrols.action.UI_MENU_VISIBLE
UI Menu hidden thirdeye.uicontrols.action.UI_MENU_HIDDEN

 

The way to use these follows the Android guidelines for using Broadcasts. For more info on how to use Broadcasts, read here https://developer.android.com/guide/components/broadcasts

IntentFilter filter = new IntentFilter("thirdeye.uicontrols.action.UI_MENU_VISIBLE");
filter.addAction("thirdeye.uicontrols.action.CURSOR_MOVED");
BroadcastReceiver receiver = new BroadcastReceiver() {
   @Override
   public void onReceive(Context context, Intent intent) {
   if(intent.getAction().equals("thirdeye.uicontrols.action.UI_MENU_VISIBLE")) {
      //do something
   }
   else if(intent.getAction().equals("thirdeye.uicontrols.action.CURSOR_MOVED")){
      int x = intent.getIntExtra("x", 0);
      int y = intent.getIntExtra("y", 0);
         //do something more
   }
 }
};
registerReceiver(receiver, new IntentFilter(filter));
Important: Make sure to unregister any receivers when not necessary(e.g. onPause), otherwise the receivers continue listening and consuming resources even if the activities are in the background. When you need them again(e.g. onResume) just register them again
@Override
protected void onPause() {
   super.onPause();
   unregisterReceiver(receiver);
}
@Override
protected void onResume() {
   super.onResume();
   registerReceiver(receiver, filter);
}

Clicks

They work exactly like simulating a finger tap on a touchscreen device, so you handle these as you would if you developed for any regular Android device.
Note:
UI Controls uses the UI Thread to draw its elements. Keep that in mind when developing your own applications.
Since the UI Thread manages everything that is drawn on the Android screen, overloading it will manifest as the cursor lagging. It’s best to keep any long
running and heavy operations in background threads and only use the UI Thread when needed, e.g. updating GUI.
0