Пример #1
0
  // Key events
  @Override
  public boolean onKey(View v, int keyCode, KeyEvent event) {
    // Dispatch the different events depending on where they come from
    // Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD
    // So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as
    // KEYBOARD

    if ((event.getSource() & InputDevice.SOURCE_GAMEPAD) != 0
        || (event.getSource() & InputDevice.SOURCE_DPAD) != 0) {
      if (event.getAction() == KeyEvent.ACTION_DOWN) {
        if (SDLActivity.onNativePadDown(event.getDeviceId(), keyCode) == 0) {
          return true;
        }
      } else if (event.getAction() == KeyEvent.ACTION_UP) {
        if (SDLActivity.onNativePadUp(event.getDeviceId(), keyCode) == 0) {
          return true;
        }
      }
    }

    if ((event.getSource() & InputDevice.SOURCE_KEYBOARD) != 0) {
      if (event.getAction() == KeyEvent.ACTION_DOWN) {
        // Log.v("SDL", "key down: " + keyCode);
        SDLActivity.onNativeKeyDown(keyCode);
        return true;
      } else if (event.getAction() == KeyEvent.ACTION_UP) {
        // Log.v("SDL", "key up: " + keyCode);
        SDLActivity.onNativeKeyUp(keyCode);
        return true;
      }
    }

    return false;
  }
Пример #2
0
  // Key events
  public boolean onKey(View v, int keyCode, KeyEvent event) {

    if (event.getAction() == KeyEvent.ACTION_DOWN) {
      // Log.v("SDL", "key down: " + keyCode);
      SDLActivity.onNativeKeyDown(keyCode);
      return true;
    } else if (event.getAction() == KeyEvent.ACTION_UP) {
      // Log.v("SDL", "key up: " + keyCode);
      SDLActivity.onNativeKeyUp(keyCode);
      return true;
    }

    return false;
  }
Пример #3
0
  // Key events
  @Override
  public boolean onKey(View v, int keyCode, KeyEvent event) {

    // Urho3D: let the home & volume keys be handled by the system
    if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
        || keyCode == KeyEvent.KEYCODE_VOLUME_UP
        || keyCode == KeyEvent.KEYCODE_HOME) return false;

    if (event.getAction() == KeyEvent.ACTION_DOWN) {
      // Log.v("SDL", "key down: " + keyCode);
      SDLActivity.onNativeKeyDown(keyCode);
      return true;
    } else if (event.getAction() == KeyEvent.ACTION_UP) {
      // Log.v("SDL", "key up: " + keyCode);
      SDLActivity.onNativeKeyUp(keyCode);
      return true;
    }

    return false;
  }
Пример #4
0
  @Override
  public boolean sendKeyEvent(KeyEvent event) {

    /*
     * This handles the keycodes from soft keyboard (and IME-translated
     * input from hardkeyboard)
     */
    int keyCode = event.getKeyCode();
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
      if (event.isPrintingKey()) {
        commitText(String.valueOf((char) event.getUnicodeChar()), 1);
      }
      SDLActivity.onNativeKeyDown(keyCode);
      return true;
    } else if (event.getAction() == KeyEvent.ACTION_UP) {

      SDLActivity.onNativeKeyUp(keyCode);
      return true;
    }
    return super.sendKeyEvent(event);
  }
Пример #5
0
  @Override
  public boolean onKey(View v, int keyCode, KeyEvent event) {

    // This handles the hardware keyboard input
    if (event.isPrintingKey()) {
      if (event.getAction() == KeyEvent.ACTION_DOWN) {
        ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
      }
      return true;
    }

    if (event.getAction() == KeyEvent.ACTION_DOWN) {
      SDLActivity.onNativeKeyDown(keyCode);
      return true;
    } else if (event.getAction() == KeyEvent.ACTION_UP) {
      SDLActivity.onNativeKeyUp(keyCode);
      return true;
    }

    return false;
  }
                public boolean onKey(DialogInterface dialoginterface, int i, KeyEvent keyevent)
                {
                    boolean flag;
                    Log.d("smali", "Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList$ReservationDetail$3;->onKey(Landroid/content/DialogInterface;ILandroid/view/KeyEvent;)Z");
                    flag = true;
                    i;
                    JVM INSTR tableswitch 4 4: default 32
                //                               4 38;
                       goto _L1 _L2
_L1:
                    flag = false;
_L4:
                    return flag;
_L2:
                    if(keyevent.getAction() == flag && Log.d(ReservationDetail.this) != null)
                        Log.d(ReservationDetail.this).dismiss();
                    if(true) goto _L4; else goto _L3
Пример #7
0
 @Override
 public boolean onKeyPreIme(int keyCode, KeyEvent event) {
   // As seen on StackOverflow: http://stackoverflow.com/questions/7634346/keyboard-hide-event
   // FIXME: Discussion at http://bugzilla.libsdl.org/show_bug.cgi?id=1639
   // FIXME: This is not a 100% effective solution to the problem of detecting if the keyboard is
   // showing or not
   // FIXME: A more effective solution would be to change our Layout from AbsoluteLayout to
   // Relative or Linear
   // FIXME: And determine the keyboard presence doing this:
   // http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android
   // FIXME: An even more effective way would be if Android provided this out of the box, but where
   // would the fun be in that :)
   if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
     if (SDLActivity.mTextEdit != null && SDLActivity.mTextEdit.getVisibility() == View.VISIBLE) {
       SDLActivity.onNativeKeyboardFocusLost();
     }
   }
   return super.onKeyPreIme(keyCode, event);
 }
Пример #8
0
 public boolean onKeyDown(int KeyCode, KeyEvent event) {
   super.onKeyDown(KeyCode, event);
   if (event.getAction() == KeyEvent.ACTION_DOWN) {
     switch (KeyCode) {
       case KeyEvent.KEYCODE_DPAD_LEFT:
         x -= 15;
         invalidate();
         return true;
       case KeyEvent.KEYCODE_DPAD_RIGHT:
         x += 15;
         invalidate();
         return true;
       case KeyEvent.KEYCODE_DPAD_UP:
         y -= 15;
         invalidate();
         return true;
       case KeyEvent.KEYCODE_DPAD_DOWN:
         y += 15;
         invalidate();
         return true;
     }
   }
   return false;
 }