Class: PMCursorAdapter

Inherits:
PMBaseAdapter show all
Defined in:
lib/project/pro_motion/adapters/pm_cursor_adapter.rb

Instance Attribute Summary collapse

Attributes inherited from PMBaseAdapter

#data

Instance Method Summary collapse

Methods inherited from PMBaseAdapter

#areAllItemsEnabled, #are_all_items_enabled?, #getCount, #getItem, #getItemId, #getItemViewType, #getView, #getViewTypeCount, #hasStableIds, #has_stable_ids?, #inflate_row, #isEmpty, #isEnabled, #is_empty?, #is_enabled?, #item_id, #item_view_type_id, #screen, #screen=, #selected_view, #update_view, #view, #view_type_count, #view_types

Constructor Details

#initialize(opts = {}) ⇒ PMCursorAdapter

Returns a new instance of PMCursorAdapter.



5
6
7
8
9
10
# File 'lib/project/pro_motion/adapters/pm_cursor_adapter.rb', line 5

def initialize(opts={})
  super()
  @cursor = opts.fetch(:cursor)
  @cell_options = opts.fetch(:cell, 1)
  @cell_options[:cursor] = @cursor # slip the cursor inside so callbacks have it
end

Instance Attribute Details

#cell_optionsObject

Returns the value of attribute cell_options.



3
4
5
# File 'lib/project/pro_motion/adapters/pm_cursor_adapter.rb', line 3

def cell_options
  @cell_options
end

#cursorObject

Returns the value of attribute cursor.



2
3
4
# File 'lib/project/pro_motion/adapters/pm_cursor_adapter.rb', line 2

def cursor
  @cursor
end

Instance Method Details

#action_arguments(data, position) ⇒ Object

slighty different arguments to send when tapping



22
23
24
25
# File 'lib/project/pro_motion/adapters/pm_cursor_adapter.rb', line 22

def action_arguments(data, position)
  item_data(position) # move the cursor into position
  @cursor
end

#countObject



12
13
14
# File 'lib/project/pro_motion/adapters/pm_cursor_adapter.rb', line 12

def count
  cursor.count
end

#item_data(position) ⇒ Object



16
17
18
19
# File 'lib/project/pro_motion/adapters/pm_cursor_adapter.rb', line 16

def item_data(position)
  cursor.moveToPosition(position)
  cell_options # return the one & only one cell_options
end