KanziViewAdapter allows embedding Kanzi UI content into an Android view. More...
Public Member Functions | |
KanziViewAdapter (View view, AttributeSet attrs) | |
Constructor to use when inflating a view from XML. More... | |
KanziViewAdapter (View view, String name) | |
Constructor to use when attaching to a view. More... | |
KanziViewAdapter (Context context, String name) | |
Constructor to use when operating without a view. More... | |
void | addListener (KanziViewListener listener) |
Adds a view state change listener. More... | |
Domain | getDomain () |
Gets the Domain associated with this view. More... | |
String | getName () |
Gets the name of the underlying native view node. More... | |
Node2D | getRoot () |
Returns the root node of the underlying native view's node tree. More... | |
KanziRuntime | getRuntime () |
Gets the KanziRuntime associated with this view. More... | |
void | handleActivityStarted () |
Notifies the adapter that the Activity has started. More... | |
void | handleActivityStopped () |
Notifies the adapter that the Activity has stopped. More... | |
void | handleAttachedToWindow () |
Notifies the adapter of the attachment of the associated view to a window. More... | |
void | handleDetachedFromWindow () |
Notifies the adapter of the detachment of the associated view from its window. More... | |
void | handleFocusChange (boolean hasFocus) |
Handles focus change. More... | |
boolean | handleGenericMotionEvent (MotionEvent event) |
Handles the specified rotary controller knob rotation event if the view is in direct manipulation mode. More... | |
boolean | handleKeyEvent (final int keyCode, KeyEvent event) |
Handles key events. More... | |
void | handleOrientationChange (int orientation) |
Applies device orientation changes to the Kanzi contents of associated view. More... | |
void | handleSurfaceChanged (Surface surface, int width, int height) |
Notifies the adapter of any changes in the dimensions of the surface of the associated view. More... | |
void | handleSurfaceCreated (Surface surface) |
Notifies the adapter of availability of surface of the associated view. More... | |
void | handleSurfaceDestroyed () |
Notifies the adapter of the destruction of the surface of the associated view. More... | |
boolean | handleTouchEvent (final MotionEvent event) |
Handles touch events. More... | |
void | handleVisibilityChange (boolean isVisible) |
Notifies the adapter that the visibility has changed. More... | |
void | removeListener (KanziViewListener listener) |
Removes a view state change listener. More... | |
void | setClearColor (ColorRGBA color) |
Configures the clear color that is used when rendering of the surface of the view. More... | |
void | setKzbPathList (String[] kzbPaths) |
Configures the list of kzb files that are loaded when the view is attached. More... | |
void | setName (String name) |
Sets the name for the underlying native view node. More... | |
void | setRoot (Node2D node) |
Sets the root node of the underlying native view's node tree, used to manually set content to the view. More... | |
void | setRotaryHandlingEnabled (boolean enable) |
Sets whether the adapter processes rotary controller events. More... | |
void | setStartupPrefabUrl (String url) |
Configures the startup prefab that is automatically loaded during initialization. More... | |
KanziViewAdapter allows embedding Kanzi UI content into an Android view.
Alternatively, you can use one of the Kanzi view classes: KanziSurfaceView and KanziTextureView.
KanziViewAdapter | ( | View | view, |
AttributeSet | attrs | ||
) |
Constructor to use when inflating a view from XML.
view | Reference to the view being adapted. |
attrs | Attributes received when inflating the view from XML. |
KanziViewAdapter | ( | View | view, |
String | name | ||
) |
Constructor to use when attaching to a view.
view | Reference to the view being adapted. |
name | A name for the underlying native view node. |
KanziViewAdapter | ( | Context | context, |
String | name | ||
) |
Constructor to use when operating without a view.
context | Reference to the application context. |
name | A name for the underlying native view node. |
void addListener | ( | KanziViewListener | listener | ) |
Adds a view state change listener.
listener | An instance of KanziViewListener. |
Domain getDomain | ( | ) |
Gets the Domain associated with this view.
String getName | ( | ) |
Gets the name of the underlying native view node.
Node2D getRoot | ( | ) |
Returns the root node of the underlying native view's node tree.
KanziRuntime getRuntime | ( | ) |
Gets the KanziRuntime associated with this view.
void handleActivityStarted | ( | ) |
Notifies the adapter that the Activity has started.
Activates the view node.
void handleActivityStopped | ( | ) |
Notifies the adapter that the Activity has stopped.
Deactivates the view node.
void handleAttachedToWindow | ( | ) |
Notifies the adapter of the attachment of the associated view to a window.
Initializes runtime if this is the first Kanzi based view to be attached in this application. Initializes the underlying view node and initiates asynchronous loading of its start-up prefab if configured.
void handleDetachedFromWindow | ( | ) |
Notifies the adapter of the detachment of the associated view from its window.
Releases the underlying view node.
void handleFocusChange | ( | boolean | hasFocus | ) |
Handles focus change.
Call this to inform Kanzi of changes in the focus of a Kanzi-based-view. Kanzi view types KanziSurfaceView and KanziTextureView do this by default, so you don't have to.
hasFocus | True if the View has focus; false otherwise. |
boolean handleGenericMotionEvent | ( | MotionEvent | event | ) |
Handles the specified rotary controller knob rotation event if the view is in direct manipulation mode.
To handle rotary controller knob rotation events and translate them to focus navigation events, forward generic motion events to this function. Use this function to process rotary controller events of an arbitrary view that uses KanziViewAdapter. Kanzi views KanziSurfaceView and KanziTextureView forward all the generic motion events to this function, so you do not have to.
event | The MotionEvent object that defines the knob rotation action. |
boolean handleKeyEvent | ( | final int | keyCode, |
KeyEvent | event | ||
) |
Handles key events.
You can forward key events received by Kanzi-based-view to this function, if you want Kanzi to handle them. Kanzi view types KanziSurfaceView and KanziTextureView do this by default, so you don't have to.
keyCode | a key code that represents the button pressed, from android.view.KeyEvent. |
event | the KeyEvent object that defines the button action. |
void handleOrientationChange | ( | int | orientation | ) |
Applies device orientation changes to the Kanzi contents of associated view.
orientation | The orientation qualifier from onOrientationChanged(). |
void handleSurfaceChanged | ( | Surface | surface, |
int | width, | ||
int | height | ||
) |
Notifies the adapter of any changes in the dimensions of the surface of the associated view.
surface | The new surface |
width | The new width of the surface. |
height | The new height of the surface. |
void handleSurfaceCreated | ( | Surface | surface | ) |
Notifies the adapter of availability of surface of the associated view.
Sets the surface as the target of the graphics context of the underlying view node. Activates the view node.
surface | The surface |
void handleSurfaceDestroyed | ( | ) |
Notifies the adapter of the destruction of the surface of the associated view.
Detaches the graphics context of the underlying view node from this surface. Deactivates the view node.
boolean handleTouchEvent | ( | final MotionEvent | event | ) |
Handles touch events.
You can forward touch events received by Kanzi-based-view to this function, if you want Kanzi to handle them. Kanzi view types KanziSurfaceView and KanziTextureView do this by default, so you don't have to.
event | The touch event. |
void handleVisibilityChange | ( | boolean | isVisible | ) |
Notifies the adapter that the visibility has changed.
Use this method only when your application is in a view-less context, such as a WallpaperEngine.
Toggles the activation of the Kanzi View.
isVisible | Whether the surface is visible and must be rendered. |
void removeListener | ( | KanziViewListener | listener | ) |
Removes a view state change listener.
listener | The instance of KanziViewListener to remove. |
void setClearColor | ( | ColorRGBA | color | ) |
Configures the clear color that is used when rendering of the surface of the view.
color | Color used to clear the surface of the view. Use null to skip clearing. |
void setKzbPathList | ( | String[] | kzbPaths | ) |
Configures the list of kzb files that are loaded when the view is attached.
kzbPaths | Array of kzb paths to load. |
void setName | ( | String | name | ) |
Sets the name for the underlying native view node.
name | New name for native view node. |
void setRoot | ( | Node2D | node | ) |
Sets the root node of the underlying native view's node tree, used to manually set content to the view.
node | Reference to a node. |
void setRotaryHandlingEnabled | ( | boolean | enable | ) |
Sets whether the adapter processes rotary controller events.
enable | If true, the adapter processes rotary controller input, otherwise related input events are ignored. |
void setStartupPrefabUrl | ( | String | url | ) |
Configures the startup prefab that is automatically loaded during initialization.
url | Url of the prefab template to load. |