Class: PMNavigationActivity
- Inherits:
-
PMActivity
show all
- Defined in:
- lib/project/pro_motion/activities/pm_navigation_activity.rb
Overview
An Activity designed to host a stack of fragments/screens. RM-733 module ProMotion
Constant Summary
Constants inherited
from PMActivity
PMActivity::EXTRA_FRAGMENT_ARGUMENTS, PMActivity::EXTRA_FRAGMENT_CLASS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from PMActivity
#clear_references, #close, #onActivityResult, #onBackPressed, #onCreate, #onCreateOptionsMenu, #onDestroy, #onOptionsItemSelected, #onPause, #onResume, #onStart, #on_resume, #open, #set_content
Instance Attribute Details
#fragment_container ⇒ Object
Returns the value of attribute fragment_container.
5
6
7
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 5
def fragment_container
@fragment_container
end
|
Returns the value of attribute menu.
5
6
7
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 5
def
@menu
end
|
#root_fragment ⇒ Object
Returns the value of attribute root_fragment.
5
6
7
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 5
def root_fragment
@root_fragment
end
|
Instance Method Details
#close_fragment ⇒ Object
31
32
33
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 31
def close_fragment
getFragmentManager.popBackStackImmediate
end
|
35
36
37
38
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 35
def fragment
getFragmentManager.findFragmentByTag("screen-#{fragmentManager.getBackStackEntryCount}")
end
|
#on_create(saved_instance_state) ⇒ Object
7
8
9
10
11
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 7
def on_create(saved_instance_state)
super
activity_init
end
|
13
14
15
16
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 13
def ()
@menu =
self.fragment.() if self.fragment
end
|
#on_fragment_attached(frag) ⇒ Object
40
41
42
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 40
def on_fragment_attached(frag)
end
|
#on_fragment_detached(frag) ⇒ Object
44
45
46
47
48
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 44
def on_fragment_detached(frag)
if new_frag = self.fragment
new_frag.set_title if new_frag.respond_to?(:set_title)
end
end
|
#on_options_item_selected(item) ⇒ Object
18
19
20
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 18
def on_options_item_selected(item)
self.fragment.on_options_item_selected(item) if self.fragment
end
|
#open_fragment(frag, options = {}) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/project/pro_motion/activities/pm_navigation_activity.rb', line 22
def open_fragment(frag, options={})
mp "open fragment: #{frag.inspect}"
mgr = fragmentManager.beginTransaction
mgr.replace(@fragment_container.getId, frag, "screen-#{fragmentManager.getBackStackEntryCount + 1}")
mgr.addToBackStack(nil)
mgr.commit
frag
end
|