Class: MotionPrime::TableDelegate
- Inherits:
-
Object
- Object
- MotionPrime::TableDelegate
show all
- Includes:
- DelegateMixin
- Defined in:
- motion-prime/sections/table/table_delegate.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#clear_delegated, #delegated_by
Constructor Details
Returns a new instance of TableDelegate.
6
7
8
9
10
|
# File 'motion-prime/sections/table/table_delegate.rb', line 6
def initialize(options)
self.table_section = options[:section].try(:weak_ref)
@_section_info = table_section.to_s
@section_instance = table_section.to_s
end
|
Instance Attribute Details
#table_section ⇒ Object
Returns the value of attribute table_section.
4
5
6
|
# File 'motion-prime/sections/table/table_delegate.rb', line 4
def table_section
@table_section
end
|
Instance Method Details
#dealloc ⇒ Object
12
13
14
15
|
# File 'motion-prime/sections/table/table_delegate.rb', line 12
def dealloc
Prime.logger.dealloc_message :collection_delegate, @_section_info
super
end
|
#init_pull_to_refresh ⇒ Object
17
18
19
20
21
22
|
# File 'motion-prime/sections/table/table_delegate.rb', line 17
def init_pull_to_refresh
return unless block = table_section.class.pull_to_refresh_block
table_section.add_pull_to_refresh(table_section.class.pull_to_refresh_options || {}) do
table_section.instance_eval(&block)
end
end
|
#numberOfSectionsInTableView(table) ⇒ Object
24
25
26
|
# File 'motion-prime/sections/table/table_delegate.rb', line 24
def numberOfSectionsInTableView(table)
table_section.number_of_groups
end
|
71
72
73
|
# File 'motion-prime/sections/table/table_delegate.rb', line 71
def scrollViewDidEndDecelerating(scroll)
table_section.scroll_view_did_end_decelerating(scroll)
end
|
75
76
77
|
# File 'motion-prime/sections/table/table_delegate.rb', line 75
def scrollViewDidEndDragging(scroll, willDecelerate: will_decelerate)
table_section.scroll_view_did_end_dragging(scroll, willDecelerate: will_decelerate)
end
|
62
63
64
65
|
# File 'motion-prime/sections/table/table_delegate.rb', line 62
def scrollViewDidScroll(scroll)
table_section.scroll_view_did_scroll(scroll)
table_section.update_pull_to_refresh_after_scroll(scroll)
end
|
67
68
69
|
# File 'motion-prime/sections/table/table_delegate.rb', line 67
def scrollViewWillBeginDragging(scroll)
table_section.scroll_view_will_begin_dragging(scroll)
end
|
#tableView(table, heightForHeaderInSection: group) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'motion-prime/sections/table/table_delegate.rb', line 28
def tableView(table, cellForRowAtIndexPath: index)
cur_call_time = Time.now.to_f
cur_call_offset = table.contentOffset.y
if @prev_call_time
time_delta = cur_call_time - @prev_call_time
offset_delta = cur_call_offset - @prev_call_offset
@deceleration_speed = offset_delta/time_delta
end
@prev_call_time = cur_call_time
@prev_call_offset = cur_call_offset
table_section.cell_for_index(index)
end
|