Class: MotionEventsWrapper

Inherits:
Object show all
Includes:
Droiuby::ViewHelper, JavaMethodHelper
Defined in:
lib/droiuby/wrappers/motion_events_wrapper.rb

Constant Summary collapse

ACTION_DOWN =
Java::android.view.MotionEvent::ACTION_DOWN
ACTION_MOVE =
Java::android.view.MotionEvent::ACTION_MOVE

Instance Method Summary collapse

Methods included from JavaMethodHelper

included

Methods included from Droiuby::ViewHelper

included

Constructor Details

#initialize(event) ⇒ MotionEventsWrapper

Returns a new instance of MotionEventsWrapper.



16
17
18
# File 'lib/droiuby/wrappers/motion_events_wrapper.rb', line 16

def initialize(event)
  @native = event
end

Instance Method Details

#each(&block) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/droiuby/wrappers/motion_events_wrapper.rb', line 24

def each(&block)
  pointerCount = pointer_count
  (0...history_size).each do |h|
    current_time = java_getHistoricalEventTime(h)
    (0...pointerCount).each do |p|
      block.call(java_getPointerId(p), java_getHistoricalX(p, h), java_getHistoricalY(p, h))
    end
  end
end

#nativeObject



20
21
22
# File 'lib/droiuby/wrappers/motion_events_wrapper.rb', line 20

def native
  @native
end