A view that owns the native Kanzi application and provides the output surface. More...
Classes | |
enum | State |
KanziView java-side lifecycle state. | |
Public Member Functions | |
KanziView (Context context) | |
Simple constructor to use when creating a KanziView from code. More... | |
KanziView (Context context, AttributeSet attrs) | |
Constructor that is called when inflating a KanziView from XML. More... | |
void | createNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_CREATE events. More... | |
void | destroyNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_DESTROY events. More... | |
boolean | onKeyDown (final int keyCode, KeyEvent event) |
A key down handler. More... | |
boolean | onKeyUp (final int keyCode, KeyEvent event) |
A key up handler. More... | |
boolean | onTouchEvent (final MotionEvent event) |
Handler for touches inside KanziView. More... | |
void | pauseNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_PAUSE events. More... | |
int | queueEvent (Runnable runnable) |
Submits a runnable task to Kanzi's task dispatcher. More... | |
void | registerLifecycle (Lifecycle lifecycle) |
Attaches KanziView to the given Lifecycle. More... | |
void | resumeNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_RESUME events. More... | |
void | setOrientation (int orientation) |
Handler for device/display orientation changes. More... | |
void | startNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_START events. More... | |
void | stopNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_STOP events. More... | |
void | surfaceChanged (SurfaceHolder holder, int format, int width, int height) |
This is called immediately after any structural changes (format or size) have been made to the surface. More... | |
void | surfaceCreated (SurfaceHolder holder) |
This is called immediately after the surface is first created. More... | |
void | surfaceDestroyed (SurfaceHolder holder) |
This is called immediately before a surface is being destroyed. More... | |
Protected Member Functions | |
void | onFocusChanged (boolean gainFocus, int direction, Rect previouslyFocusedRect) |
Called by the view system when the focus state of this KanziView changes. More... | |
Protected Attributes | |
State | mState = State.IDLE |
Current KanziView lifecycle state. | |
Surface | mSurface = null |
Valid Surface. More... | |
A view that owns the native Kanzi application and provides the output surface.
KanziView | ( | Context | context | ) |
KanziView | ( | Context | context, |
AttributeSet | attrs | ||
) |
void createNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_CREATE
events.
Loads the native library providing all Kanzi functionality. Initializes the context and assigns this KanziView for rendering. Creates Kanzi application which loads the Kanzi project.
void destroyNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_DESTROY
events.
Halts and destroys the Kanzi application.
|
protected |
Called by the view system when the focus state of this KanziView changes.
gainFocus | True if the KanziView has focus; false otherwise. |
direction | The direction focus has moved when requestFocus() is called to give this KanziView focus. |
previouslyFocusedRect | The rectangle, in this KanziView's coordinate system, of the previously focused view. May be null . |
boolean onKeyDown | ( | final int | keyCode, |
KeyEvent | event | ||
) |
A key down handler.
Passes the key down event to the key event handler.
keyCode | A key code that represents the button pressed, from android.view.KeyEvent. |
event | The KeyEvent object that defines the button action. |
boolean onKeyUp | ( | final int | keyCode, |
KeyEvent | event | ||
) |
A key up handler.
Passes the key up event to the key event handler.
keyCode | A key code that represents the button pressed, from android.view.KeyEvent. |
event | The KeyEvent object that defines the button action. |
boolean onTouchEvent | ( | final MotionEvent | event | ) |
void pauseNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_PAUSE
events.
Logs the event.
int queueEvent | ( | Runnable | runnable | ) |
Submits a runnable task to Kanzi's task dispatcher.
This function fails if the task dispatcher is not yet initialized.
runnable | The task to be run. |
void registerLifecycle | ( | Lifecycle | lifecycle | ) |
Attaches KanziView to the given Lifecycle.
lifecycle | The lifecycle to attach to. |
void resumeNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_RESUME
events.
Logs the event.
void setOrientation | ( | int | orientation | ) |
Handler for device/display orientation changes.
Translates the received orientation qualifiers into the native library's orientation constants.
orientation | The orientation qualifier from onOrientationChanged(). |
void startNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_START
events.
Runs the Kanzi application if a surface has already been received.
void stopNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_STOP
events.
Stops the Kanzi application.
void surfaceChanged | ( | SurfaceHolder | holder, |
int | format, | ||
int | width, | ||
int | height | ||
) |
This is called immediately after any structural changes (format or size) have been made to the surface.
This method is always called at least once, after surfaceCreated.
holder | The SurfaceHolder whose surface has changed. |
format | The new PixelFormat of the surface. |
width | The new width of the surface. |
height | The new height of the surface. |
void surfaceCreated | ( | SurfaceHolder | holder | ) |
This is called immediately after the surface is first created.
Passes the created surface to the native library for rendering target.
holder | The SurfaceHolder whose surface is being created. |
void surfaceDestroyed | ( | SurfaceHolder | holder | ) |
This is called immediately before a surface is being destroyed.
holder | The SurfaceHolder whose surface is being destroyed. |
|
protected |
Valid Surface.
The surface will be captured during the onSurfaceCreated event.