@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); blanket = (ImageView) findViewById(R.id.blanket); onPage = false; gestureManager = GestureManager.getInstance(this); gestureManager.setListener(this); // onScanActionSelected(); }
@Override protected void onDestroy() { super.onDestroy(); // We don't want any callbacks when the Activity is gone, so unregister the listener. // gestureManager.destroyListener(); if (isFinishing()) { // The Activity is finishing, so shutdown the Hub. This will disconnect from the Myo. gestureManager.finishHub(); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { blanket.setVisibility(View.GONE); logo_img.setVisibility(View.VISIBLE); onPage = true; // Check which request we're responding to if (requestCode == 1 || requestCode == 2) { gestureManager.setListener(this); } }
// every mouse state and detection called here. // to cater for future self-created display. public void setMouseState(int x, int y, int mode) { GestureManager.setMouseState(x, y, mode, mouseState); if (viewer.getInMotion(false)) { /*String mouseGesture = ""; mouseGesture += "Mouse Mode: " + mouseState.getMouseMode() + "\n"; mouseGesture += "Mouse Start Position: X-Pos=" + mouseState.getStartPosX() + " Y-Pos=" + mouseState.getStartPosY() + "\n"; mouseGesture += "Mouse End Position: X-Pos=" + mouseState.getEndPosX() + " Y-Pos=" + mouseState.getEndPosY() + "\n";*/ // System.out.println(mouseGesture); mouseState.clearState(); } if (minimizeMode && mode == 16640) { // when mouse drag stopped. System.out.println("Entering minimizing stage..."); minimizeModel(); } }