Added a method in Java file which may be overridden for custom messages.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 05 May 2013 12:53:57 +0200
changeset 71461968d3a85e35
parent 7145 4552268486f2
child 7147 370f207f24ec
Added a method in Java file which may be overridden for custom messages.
android-project/src/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Sun May 05 12:50:34 2013 +0200
     1.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Sun May 05 12:53:57 2013 +0200
     1.3 @@ -114,6 +114,19 @@
     1.4      static final int COMMAND_UNUSED = 2;
     1.5      static final int COMMAND_TEXTEDIT_HIDE = 3;
     1.6  
     1.7 +    protected static final int COMMAND_USER = 0x8000;
     1.8 +
     1.9 +    /**
    1.10 +     * This method is called by SDL if SDL did not handle a message itself.
    1.11 +     * This happens if a received message contains an unsupported command.
    1.12 +     * Method can be overwritten to handle Messages in a different class.
    1.13 +     * @param msg the Message which was not handled.
    1.14 +     * @return if the Message was handled in method.
    1.15 +     */
    1.16 +    protected boolean onUnhandledMessage(Message msg) {
    1.17 +        return false;
    1.18 +    }
    1.19 +
    1.20      /**
    1.21       * A Handler class for Messages from native SDL applications.
    1.22       * It uses current Activities as target (e.g. for the title).
    1.23 @@ -143,6 +156,11 @@
    1.24                      imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
    1.25                  }
    1.26                  break;
    1.27 +
    1.28 +            default:
    1.29 +                if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg)) {
    1.30 +                    Log.e(TAG, "error handling message, command is " + msg.arg1);
    1.31 +                }
    1.32              }
    1.33          }
    1.34      }