An hardware key event

Introduced properties

fun is_a: Bool

android :: AndroidKeyEvent :: is_a

Was self raised by the A button?
fun is_b: Bool

android :: AndroidKeyEvent :: is_b

Was self raised by the B button?
fun is_back_key: Bool

android :: AndroidKeyEvent :: is_back_key

Was this event raised by the back key?
fun is_bumper_left: Bool

android :: AndroidKeyEvent :: is_bumper_left

Was self raised by the left bumper?
fun is_bumper_right: Bool

android :: AndroidKeyEvent :: is_bumper_right

Was self raised by the right bumper button?
fun is_dpad: Bool

android :: AndroidKeyEvent :: is_dpad

Was self raised by the directional pad?
fun is_dpad_down: Bool

android :: AndroidKeyEvent :: is_dpad_down

Was self raised by the down key on the directional pad?
fun is_dpad_left: Bool

android :: AndroidKeyEvent :: is_dpad_left

Was self raised by the left key on the directional pad?
fun is_dpad_right: Bool

android :: AndroidKeyEvent :: is_dpad_right

Was self raised by the right key on the directional pad?
fun is_dpad_up: Bool

android :: AndroidKeyEvent :: is_dpad_up

Was self raised by the up key on the directional pad?
fun is_media_next: Bool

android :: AndroidKeyEvent :: is_media_next

Was self raised by the media button 'next'?
fun is_media_pause: Bool

android :: AndroidKeyEvent :: is_media_pause

Was self raised by the media button 'pause'?
fun is_media_previous: Bool

android :: AndroidKeyEvent :: is_media_previous

Was self raised by the media button 'previous'?
fun is_menu_key: Bool

android :: AndroidKeyEvent :: is_menu_key

Was this event raised by the menu key?
fun is_search_key: Bool

android :: AndroidKeyEvent :: is_search_key

Was this event raised by the search key?
fun is_select: Bool

android :: AndroidKeyEvent :: is_select

Was self raised by the select button?
fun is_start: Bool

android :: AndroidKeyEvent :: is_start

Was self raised by the start button?
fun is_trigger_left: Bool

android :: AndroidKeyEvent :: is_trigger_left

Was self raised by the left trigger?
fun is_trigger_right: Bool

android :: AndroidKeyEvent :: is_trigger_right

Was self raised by the right trigger?
fun is_volume_down: Bool

android :: AndroidKeyEvent :: is_volume_down

Was this event raised by the volume down key?
fun is_volume_up: Bool

android :: AndroidKeyEvent :: is_volume_up

Was this event raised by the volume up key?
fun is_x: Bool

android :: AndroidKeyEvent :: is_x

Was self raised by the X button?
fun is_y: Bool

android :: AndroidKeyEvent :: is_y

Was self raised by the Y button?
fun key_code: Int

android :: AndroidKeyEvent :: key_code

Hardware code of the key raising this event

Redefined properties

redef type SELF: AndroidKeyEvent

android $ AndroidKeyEvent :: SELF

Type of this instance, automatically specialized in every class
redef fun is_down: Bool

android $ AndroidKeyEvent :: is_down

Key is currently down?
redef fun is_up: Bool

android $ AndroidKeyEvent :: is_up

Key is currently up?
redef fun name: String

android $ AndroidKeyEvent :: name

Name of the key that raised self
redef fun to_c: nullable Char

android $ AndroidKeyEvent :: to_c

Get Char value of key, if any

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
abstract fun code: Int

mnit :: KeyEvent :: code

Key code, is plateform specific
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_a: Bool

android :: AndroidKeyEvent :: is_a

Was self raised by the A button?
abstract fun is_arrow_down: Bool

mnit :: KeyEvent :: is_arrow_down

Key is the down arrow key?
abstract fun is_arrow_left: Bool

mnit :: KeyEvent :: is_arrow_left

Key is the left arrow key?
abstract fun is_arrow_right: Bool

mnit :: KeyEvent :: is_arrow_right

Key is the right arrow key?
abstract fun is_arrow_up: Bool

mnit :: KeyEvent :: is_arrow_up

Key is the up arrow key?
fun is_b: Bool

android :: AndroidKeyEvent :: is_b

Was self raised by the B button?
fun is_back_key: Bool

android :: AndroidKeyEvent :: is_back_key

Was this event raised by the back key?
fun is_bumper_left: Bool

android :: AndroidKeyEvent :: is_bumper_left

Was self raised by the left bumper?
fun is_bumper_right: Bool

android :: AndroidKeyEvent :: is_bumper_right

Was self raised by the right bumper button?
abstract fun is_down: Bool

mnit :: KeyEvent :: is_down

Key is currently down?
fun is_dpad: Bool

android :: AndroidKeyEvent :: is_dpad

Was self raised by the directional pad?
fun is_dpad_down: Bool

android :: AndroidKeyEvent :: is_dpad_down

Was self raised by the down key on the directional pad?
fun is_dpad_left: Bool

android :: AndroidKeyEvent :: is_dpad_left

Was self raised by the left key on the directional pad?
fun is_dpad_right: Bool

android :: AndroidKeyEvent :: is_dpad_right

Was self raised by the right key on the directional pad?
fun is_dpad_up: Bool

android :: AndroidKeyEvent :: is_dpad_up

Was self raised by the up key on the directional pad?
fun is_media_next: Bool

android :: AndroidKeyEvent :: is_media_next

Was self raised by the media button 'next'?
fun is_media_pause: Bool

android :: AndroidKeyEvent :: is_media_pause

Was self raised by the media button 'pause'?
fun is_media_previous: Bool

android :: AndroidKeyEvent :: is_media_previous

Was self raised by the media button 'previous'?
fun is_menu_key: Bool

android :: AndroidKeyEvent :: is_menu_key

Was this event raised by the menu key?
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun is_search_key: Bool

android :: AndroidKeyEvent :: is_search_key

Was this event raised by the search key?
fun is_select: Bool

android :: AndroidKeyEvent :: is_select

Was self raised by the select button?
fun is_start: Bool

android :: AndroidKeyEvent :: is_start

Was self raised by the start button?
fun is_trigger_left: Bool

android :: AndroidKeyEvent :: is_trigger_left

Was self raised by the left trigger?
fun is_trigger_right: Bool

android :: AndroidKeyEvent :: is_trigger_right

Was self raised by the right trigger?
fun is_up: Bool

mnit :: KeyEvent :: is_up

Key is currently up?
fun is_volume_down: Bool

android :: AndroidKeyEvent :: is_volume_down

Was this event raised by the volume down key?
fun is_volume_up: Bool

android :: AndroidKeyEvent :: is_volume_up

Was this event raised by the volume up key?
fun is_x: Bool

android :: AndroidKeyEvent :: is_x

Was self raised by the X button?
fun is_y: Bool

android :: AndroidKeyEvent :: is_y

Was self raised by the Y button?
fun key_code: Int

android :: AndroidKeyEvent :: key_code

Hardware code of the key raising this event
abstract fun name: String

mnit :: KeyEvent :: name

Name of the key that raised self
init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_c: nullable Char

mnit :: KeyEvent :: to_c

Get Char value of key, if any
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram android::AndroidKeyEvent AndroidKeyEvent mnit::KeyEvent KeyEvent android::AndroidKeyEvent->mnit::KeyEvent android::AndroidInputEvent AndroidInputEvent android::AndroidKeyEvent->android::AndroidInputEvent core::Pointer Pointer android::AndroidKeyEvent->core::Pointer mnit::InputEvent InputEvent mnit::KeyEvent->mnit::InputEvent android::AndroidInputEvent->mnit::InputEvent core::Object Object core::Pointer->core::Object ...mnit::InputEvent ... ...mnit::InputEvent->mnit::InputEvent ...core::Object ... ...core::Object->core::Object

Ancestors

interface InputEvent

mnit :: InputEvent

Input to the App, propagated through App::input.
interface Object

core :: Object

The root of the class hierarchy.

Parents

interface AndroidInputEvent

android :: AndroidInputEvent

An input event on Android
interface KeyEvent

mnit :: KeyEvent

Keyboard or other keys event
extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

android $ AndroidKeyEvent
# An hardware key event
extern class AndroidKeyEvent `{AInputEvent *`}
	super KeyEvent
	super AndroidInputEvent

	private fun action: Int `{ return AKeyEvent_getAction(self); `}

	redef fun is_down do return action == 0
	redef fun is_up do return action == 1

	# Hardware code of the key raising this event
	fun key_code: Int `{ return AKeyEvent_getKeyCode(self); `}

	redef fun to_c
	do
		var i = native_to_c
		if i == 0 then return null
		return i.code_point
	end

	private fun native_to_c: Int `{
		int code = AKeyEvent_getKeyCode(self);
		if (code >= AKEYCODE_0 && code <= AKEYCODE_9)
			return '0'+code-AKEYCODE_0;
		if (code >= AKEYCODE_A && code <= AKEYCODE_Z)
			return 'a'+code-AKEYCODE_A;
		return 0;
	`}

	redef fun name do return key_code.to_s

	# Was this event raised by the back key?
	fun is_back_key: Bool do return key_code == 4

	# Was this event raised by the menu key?
	fun is_menu_key: Bool do return key_code == 82

	# Was this event raised by the search key?
	fun is_search_key: Bool do return key_code == 84

	# Was this event raised by the volume up key?
	fun is_volume_up: Bool do return key_code == 24

	# Was this event raised by the volume down key?
	fun is_volume_down: Bool do return key_code == 25
end
lib/android/input_events.nit:210,1--255,3

android :: gamepad $ AndroidKeyEvent
redef class AndroidKeyEvent

	# Was `self` raised by the A button?
	fun is_a: Bool do return key_code == 96

	# Was `self` raised by the B button?
	fun is_b: Bool do return key_code == 97

	# Was `self` raised by the X button?
	fun is_x: Bool do return key_code == 99

	# Was `self` raised by the Y button?
	fun is_y: Bool do return key_code == 100

	# Was `self` raised by the directional pad?
	fun is_dpad: Bool
	do
		return is_dpad_up or is_dpad_down or is_dpad_left or is_dpad_right
	end

	# Was `self` raised by the up key on the directional pad?
	fun is_dpad_up: Bool do return key_code == 19

	# Was `self` raised by the down key on the directional pad?
	fun is_dpad_down: Bool do return key_code == 20

	# Was `self` raised by the left key on the directional pad?
	fun is_dpad_left: Bool do return key_code == 21

	# Was `self` raised by the right key on the directional pad?
	fun is_dpad_right: Bool do return key_code == 22

	# Was `self` raised by the start button?
	fun is_start: Bool do return key_code == 108

	# Was `self` raised by the select button?
	fun is_select: Bool do return key_code == 109

	# Was `self` raised by the right bumper button?
	fun is_bumper_right: Bool do return key_code == 103

	# Was `self` raised by the right trigger?
	fun is_trigger_right: Bool do return key_code == 105

	# Was `self` raised by the left bumper?
	fun is_bumper_left: Bool do return key_code == 102

	# Was `self` raised by the left trigger?
	fun is_trigger_left: Bool do return key_code == 101

	# Was `self` raised by the media button 'previous'?
	fun is_media_previous: Bool do return key_code == 87

	# Was `self` raised by the media button 'pause'?
	fun is_media_pause: Bool do return key_code == 85

	# Was `self` raised by the media button 'next'?
	fun is_media_next: Bool do return key_code == 88
end
lib/android/gamepad.nit:20,1--78,3