Kanzi 3.9.10
KanziNativeLibrary Class Reference

Provides control and event injection access to the native Kanzi application. More...

Static Public Member Functions

static synchronized native boolean applicationExists ()
 Checks if the native Kanzi application already exists.
 
static synchronized native void createApplication () throws IllegalThreadStateException
 Creates and initializes native Kanzi application.
 
static synchronized native void destroyApplication ()
 Destroys the running native Kanzi application.
 
static native void focusEvent (boolean focusState)
 Updates the focus state of the output View to the native Kanzi application.
 
static native void haltApplication ()
 Halts the running native Kanzi application.
 
static native void keyEvent (int buttonCode, int keyState, int modifiers, int repeatCount)
 Passes a key event to the native Kanzi application.
 
static native void orientateEvent (int orientation)
 Updates the new orientation of the output surface to the native Kanzi application.
 
static native void resizeEvent (int width, int height)
 After resize, updates the new dimensions of the output surface to the native Kanzi application.
 
static synchronized native void runApplication (Object surface) throws IllegalThreadStateException
 Starts running the native Kanzi application.
 
static native int submitTask (Object runnable)
 Submits a runnable task to Kanzi task dispatcher.
 
static native long touchEventAddCursor (long touchCursors, int id, int cursorState, float x, float y, float pressure, float area)
 Adds a touch event cursor to the set of touches in the native Kanzi application.
 
static native void touchEventCommit (int touchState, long touchCursors)
 Commits the active set of cursors in the native Kanzi application and releases the internally allocated list of cursors.
 
static native void updateContextReference (Object context)
 Updates the native side references to current Context.
 
static native void updateViewReference (Object kanziView)
 Updates the native side references to the Kanzi UI view.
 

Static Public Attributes

static final int KEY_STATE_PRESSED = 0
 
static final int KEY_STATE_RELEASED = 1
 
static final int SCREEN_ORIENTATION_LANDSCAPE = 0
 
static final int SCREEN_ORIENTATION_PORTRAIT = 1
 
static final int TOUCH_POINT_STATE_MOVED = 2
 
static final int TOUCH_POINT_STATE_PRESSED = 0
 
static final int TOUCH_POINT_STATE_RELEASED = 3
 
static final int TOUCH_POINT_STATE_STATIONARY = 1
 
static final int TOUCH_POINT_STATE_UNDEFINED = -1
 
static final int TOUCH_STATE_BEGIN = 0
 
static final int TOUCH_STATE_END = 2
 
static final int TOUCH_STATE_UPDATE = 1
 

Detailed Description

Provides control and event injection access to the native Kanzi application.

Member Function Documentation

◆ applicationExists()

static synchronized native boolean applicationExists ( )
static

Checks if the native Kanzi application already exists.

Returns
true if native application exists and false otherwise.

◆ createApplication()

static synchronized native void createApplication ( ) throws IllegalThreadStateException
static

Creates and initializes native Kanzi application.

Exceptions
IllegalThreadStateExceptionif native application already exists.

◆ destroyApplication()

static synchronized native void destroyApplication ( )
static

Destroys the running native Kanzi application.

The application can not be resumed. Use createApplication() to re-create the application.

◆ focusEvent()

static native void focusEvent ( boolean focusState)
static

Updates the focus state of the output View to the native Kanzi application.

com.rightware.kanzi.KanziView calls this method internally.

Parameters
focusStateIf com.rightware.kanzi.KanziView has focus, true, otherwise false.

◆ haltApplication()

static native void haltApplication ( )
static

Halts the running native Kanzi application.

To resume the application, call runApplication().

◆ keyEvent()

static native void keyEvent ( int buttonCode,
int keyState,
int modifiers,
int repeatCount )
static

Passes a key event to the native Kanzi application.

The KeyEvent callback of com.rightware.kanzi.KanziView calls this method internally.

Parameters
buttonCodeA key code that represents the button pressed from android.view.KeyEvent.
keyStatecom.rightware.kanzi.KanziNativeLibrary#KEY_STATE_PRESSED or com.rightware.kanzi.KanziNativeLibrary#KEY_STATE_RELEASED.
modifiersModifier key states from android.view.KeyEvent::getMetaState().
repeatCountThe key repeat count when keyState is com.rightware.kanzi.KanziNativeLibrary#KEY_STATE_PRESSED.

◆ orientateEvent()

static native void orientateEvent ( int orientation)
static

Updates the new orientation of the output surface to the native Kanzi application.

The SurfaceHolder callback of com.rightware.kanzi.KanziView calls this method internally.

Parameters
orientationcom.rightware.kanzi.KanziNativeLibrary#SCREEN_ORIENTATION_LANDSCAPE or com.rightware.kanzi.KanziNativeLibrary#SCREEN_ORIENTATION_PORTRAIT.

◆ resizeEvent()

static native void resizeEvent ( int width,
int height )
static

After resize, updates the new dimensions of the output surface to the native Kanzi application.

The SurfaceHolder callback of com.rightware.kanzi.KanziView calls this method internally.

Parameters
widthWidth of the output surface in pixels.
heightHeight of the output surface in pixels.

◆ runApplication()

static synchronized native void runApplication ( Object surface) throws IllegalThreadStateException
static

Starts running the native Kanzi application.

Parameters
surfaceA render surface from KanziView.
Exceptions
IllegalThreadStateExceptionif native application is not created or is already running.

◆ submitTask()

static native int submitTask ( Object runnable)
static

Submits a runnable task to Kanzi task dispatcher.

If the task dispatcher is not initialized, this function fails.

Parameters
runnableThe task to be run.
Returns
If run successfully, zero, otherwise non-zero.

◆ touchEventAddCursor()

static native long touchEventAddCursor ( long touchCursors,
int id,
int cursorState,
float x,
float y,
float pressure,
float area )
static

Adds a touch event cursor to the set of touches in the native Kanzi application.

You must release the returned touchCursors pointer using KanziNativeLibrary#touchEventCommit(int, long). com.rightware.kanzi.KanziView calls this method internally.

Parameters
touchCursorsA pointer to the list of currently active set of touches.
idCursor ID from android.view.MotionEvent::getPointerId(int).
cursorStatecom.rightware.kanzi.KanziNativeLibrary#TOUCH_POINT_STATE_PRESSED, com.rightware.kanzi.KanziNativeLibrary#TOUCH_POINT_STATE_STATIONARY, com.rightware.kanzi.KanziNativeLibrary#TOUCH_POINT_STATE_MOVED or com.rightware.kanzi.KanziNativeLibrary#TOUCH_POINT_STATE_RELEASED.
xX coordinate of the cursor from android.view.MotionEvent::getX().
yY coordinate of the cursor from android.view.MotionEvent::getY().
pressurePressure of the cursor from android.view.MotionEvent::getPressure().
areaArea of the cursor from }. A pointer to the list of currently active set of touches.

◆ touchEventCommit()

static native void touchEventCommit ( int touchState,
long touchCursors )
static

Commits the active set of cursors in the native Kanzi application and releases the internally allocated list of cursors.

com.rightware.kanzi.KanziView calls this method internally.

Parameters
touchStatecom.rightware.kanzi.KanziNativeLibrary#TOUCH_STATE_BEGIN, com.rightware.kanzi.KanziNativeLibrary#TOUCH_STATE_UPDATE or com.rightware.kanzi.KanziNativeLibrary#TOUCH_STATE_END.
touchCursorsA pointer to the list of currently active set of touches.

◆ updateContextReference()

static native void updateContextReference ( Object context)
static

Updates the native side references to current Context.

Parameters
contextReference to context.

◆ updateViewReference()

static native void updateViewReference ( Object kanziView)
static

Updates the native side references to the Kanzi UI view.

Parameters
kanziViewReference to output.