Kanzi Framework  3.9.0
Android application framework API
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. More...
 
static synchronized native void createApplication () throws IllegalThreadStateException
 Creates and initializes native Kanzi application. More...
 
static synchronized native void destroyApplication ()
 Destroys the running native Kanzi application. More...
 
static native void focusEvent (boolean focusState)
 Updates the focus state of the output View to the native Kanzi application. More...
 
static native void haltApplication ()
 Halts the running native Kanzi application. More...
 
static native void keyEvent (int buttonCode, int keyState, int modifiers, int repeatCount)
 Passes a key event to the native Kanzi application. More...
 
static native void orientateEvent (int orientation)
 Updates the new orientation of the output surface to the native Kanzi application. More...
 
static native void resizeEvent (int width, int height)
 After resize, updates the new dimensions of the output surface to the native Kanzi application. More...
 
static synchronized native void runApplication (Object surface) throws IllegalThreadStateException
 Starts running the native Kanzi application. More...
 
static native int submitTask (Object runnable)
 Submits a runnable task to Kanzi task dispatcher. More...
 
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. More...
 
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. More...
 
static native void updateContextReference (Object context)
 Updates the native side references to current Context. More...
 
static native void updateViewReference (Object kanziView)
 Updates the native side references to the Kanzi UI view. More...
 

Static Public Attributes

static final int CURSOR_STATE_DOWN = 0
 
static final int CURSOR_STATE_MOVE = 2
 
static final int CURSOR_STATE_STATIONARY = 1
 
static final int CURSOR_STATE_UP = 3
 
static final int KEY_STATE_DOWN = 0
 
static final int KEY_STATE_UP = 1
 
static final int SCREEN_ORIENTATION_LANDSCAPE = 0
 
static final int SCREEN_ORIENTATION_PORTRAIT = 1
 
static final int TOUCH_STATE_BEGIN = 0
 
static final int TOUCH_STATE_CONTINUE = 1
 
static final int TOUCH_STATE_END = 2
 

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.

KanziView calls this method internally.

Parameters
focusStateIf 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 KanziView calls this method internally.

Parameters
buttonCodeA key code that represents the button pressed from android.view.KeyEvent.
keyStateKanziNativeLibrary#KEY_STATE_DOWN or KanziNativeLibrary#KEY_STATE_UP.
modifiersModifier key states from android.view.KeyEvent#getMetaState().
repeatCountThe key repeat count when keyState is KanziNativeLibrary#KEY_STATE_DOWN.

◆ 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 KanziView calls this method internally.

Parameters
orientationKanziNativeLibrary#SCREEN_ORIENTATION_LANDSCAPE or 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 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). 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).
cursorStateKanziNativeLibrary#CURSOR_STATE_DOWN, KanziNativeLibrary#CURSOR_STATE_STATIONARY, KanziNativeLibrary#CURSOR_STATE_MOVE or KanziNativeLibrary#CURSOR_STATE_UP.
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.

KanziView calls this method internally.

Parameters
touchStateKanziNativeLibrary#TOUCH_STATE_BEGIN, KanziNativeLibrary#TOUCH_STATE_CONTINUE or 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.