A motion event concerning a single or more pointers

Introduced properties

fun acting_pointer: AndroidPointerEvent

android :: AndroidMotionEvent :: acting_pointer

The pointer (or finger) causing this event
protected fun acting_pointer=(acting_pointer: AndroidPointerEvent)

android :: AndroidMotionEvent :: acting_pointer=

The pointer (or finger) causing this event
fun down_time: Int

android :: AndroidMotionEvent :: down_time

Time when the user originally pressed down to start a stream of position events
fun pointers: Array[AndroidPointerEvent]

android :: AndroidMotionEvent :: pointers

Pointers (or fingers) composing this motion event
protected fun pointers=(pointers: Array[AndroidPointerEvent])

android :: AndroidMotionEvent :: pointers=

Pointers (or fingers) composing this motion event
fun touch_bottom_edge: Bool

android :: AndroidMotionEvent :: touch_bottom_edge

Was the bottom edge of the screen intersected by this event?
fun touch_left_edge: Bool

android :: AndroidMotionEvent :: touch_left_edge

Was the left edge of the screen intersected by this event?
fun touch_right_edge: Bool

android :: AndroidMotionEvent :: touch_right_edge

Was the right edge of the screen intersected by this event?
fun touch_to_edge: Bool

android :: AndroidMotionEvent :: touch_to_edge

Was the top edge of the screen intersected by this event?

Redefined properties

redef type SELF: AndroidMotionEvent

android $ AndroidMotionEvent :: SELF

Type of this instance, automatically specialized in every class
redef fun down_pointer: nullable AndroidPointerEvent

android $ AndroidMotionEvent :: down_pointer

Which pointer is down, if any
redef fun just_went_down: Bool

android $ AndroidMotionEvent :: just_went_down

A pointer just went down?

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 acting_pointer: AndroidPointerEvent

android :: AndroidMotionEvent :: acting_pointer

The pointer (or finger) causing this event
protected fun acting_pointer=(acting_pointer: AndroidPointerEvent)

android :: AndroidMotionEvent :: acting_pointer=

The pointer (or finger) causing this event
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 down_pointer: nullable PointerEvent

mnit :: MotionEvent :: down_pointer

Which pointer is down, if any
fun down_time: Int

android :: AndroidMotionEvent :: down_time

Time when the user originally pressed down to start a stream of position events
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".
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.
abstract fun just_went_down: Bool

mnit :: MotionEvent :: just_went_down

A pointer just went down?
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 pointers: Array[AndroidPointerEvent]

android :: AndroidMotionEvent :: pointers

Pointers (or fingers) composing this motion event
protected fun pointers=(pointers: Array[AndroidPointerEvent])

android :: AndroidMotionEvent :: pointers=

Pointers (or fingers) composing this motion event
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_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun touch_bottom_edge: Bool

android :: AndroidMotionEvent :: touch_bottom_edge

Was the bottom edge of the screen intersected by this event?
fun touch_left_edge: Bool

android :: AndroidMotionEvent :: touch_left_edge

Was the left edge of the screen intersected by this event?
fun touch_right_edge: Bool

android :: AndroidMotionEvent :: touch_right_edge

Was the right edge of the screen intersected by this event?
fun touch_to_edge: Bool

android :: AndroidMotionEvent :: touch_to_edge

Was the top edge of the screen intersected by this event?
package_diagram android::AndroidMotionEvent AndroidMotionEvent android::AndroidInputEvent AndroidInputEvent android::AndroidMotionEvent->android::AndroidInputEvent mnit::MotionEvent MotionEvent android::AndroidMotionEvent->mnit::MotionEvent mnit::InputEvent InputEvent android::AndroidInputEvent->mnit::InputEvent mnit::MotionEvent->mnit::InputEvent ...mnit::InputEvent ... ...mnit::InputEvent->mnit::InputEvent

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 MotionEvent

mnit :: MotionEvent

A motion event on screen composed of many PointerEvent

Class definitions

android $ AndroidMotionEvent
# A motion event concerning a single or more `pointers`
class AndroidMotionEvent
	super AndroidInputEvent
	super MotionEvent

	private var native: NativeAndroidMotionEvent

	# Pointers (or fingers) composing this motion event
	var pointers: Array[AndroidPointerEvent] is lazy do
		return [for i in native.pointers_count.times do new AndroidPointerEvent(self, i)]
	end

	# The pointer (or finger) causing this event
	var acting_pointer: AndroidPointerEvent is lazy do
		var action = native.action
		var index = 0

		if action.is_pointer_down or action.is_pointer_up then
			index = native.action.pointer_index
		end

		return new AndroidPointerEvent(self, index)
	end

	redef fun just_went_down do return native.action.is_down or native.action.is_pointer_down

	# Was the top edge of the screen intersected by this event?
	fun touch_to_edge: Bool do return native.edge == 1

	# Was the bottom edge of the screen intersected by this event?
	fun touch_bottom_edge: Bool do return native.edge == 2

	# Was the left edge of the screen intersected by this event?
	fun touch_left_edge: Bool do return native.edge == 4

	# Was the right edge of the screen intersected by this event?
	fun touch_right_edge: Bool do return native.edge == 8

	redef fun down_pointer: nullable AndroidPointerEvent
	do
		if just_went_down then
			# The primary pointer went down
			return pointers[0]
		end

		var i = native.index_down_pointer
		if i > 0 then
			# A secondary pointer went down
			return pointers[i]
		else
			return null
		end
	end

	# Time when the user originally pressed down to start a stream of position events
	#
	# The return value is in the `java.lang.System.nanoTime()` time base.
	fun down_time: Int do return native.native_down_time
end
lib/android/input_events.nit:101,1--159,3