Reputation: 3527
How can I move from the options of a system dialog box like this for example with Google Glass XE16?
With XE12 I was able to move from the options swiping forward and back. but after the update to XE16 it doesn't work anymore.
I'm only able to select the first option that is focused (in this case Cancel).
UPDATE: XE17 - Still the same issue
Upvotes: 4
Views: 652
Reputation: 1804
If this is your own app, whether it's in native GDK code or code ported from some Android app, you can follow the steps below to support the navigation of listview, buttons, etc and non-GDK UI components:
GestureDetector mGestureDetector;
mGestureDetector = createGestureDetector(this);
in onCreate
;List item
private GestureDetector createGestureDetector(Context context) {
GestureDetector gestureDetector = new GestureDetector(context);
gestureDetector.setBaseListener( new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if (gesture == Gesture.TAP) {
process(mListView.getSelectedItem());
return true;
} else if (gesture == Gesture.SWIPE_RIGHT) {
mListView.setSelection(mListView.getSelectedItemPosition()+1);
return true;
} else if (gesture == Gesture.SWIPE_LEFT) {
mListView.setSelection(mListView.getSelectedItemPosition()-1);
return true;
}
return false;
}
});
return gestureDetector;
}
// this method is required for tap on touchpad to work!
public boolean onGenericMotionEvent(MotionEvent event) {
if (mGestureDetector != null) {
return mGestureDetector.onMotionEvent(event);
}
return false;
}
A complete working sample is available at https://github.com/xjefftang/launchy/commit/66f17bd5bf920800ce277df5eeb6ea912b877692
Upvotes: 2