Skip to content

Commit

Permalink
Added home_screen_class to application. Fixed template
Browse files Browse the repository at this point in the history
  • Loading branch information
twerth committed May 31, 2015
1 parent c4935e4 commit 340030c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/bluepotion_application.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
class BluePotionApplication < PMApplication

home_screen HomeScreen
# You can also do something like this:
# def home_screen_class
# User.current.logged_in? ? WelcomeScreen : LoginScreen
# end

def on_create
mp "BluePotionApplication on_create", debugging_only: true
Expand Down
6 changes: 5 additions & 1 deletion lib/project/pro_motion/pm_application.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# RM-773
#module ProMotion
class PMApplication < Android::App::Application
attr_accessor :home_screen_class, :context, :current_activity
attr_accessor :context, :current_activity

def onCreate
mp "PMApplication onCreate", debugging_only: true
Expand All @@ -17,6 +17,10 @@ def onCreate
self.on_create if respond_to?(:on_create)
end

def home_screen_class
@home_screen_class
end

def application_info
context.applicationInfo
end
Expand Down
6 changes: 4 additions & 2 deletions lib/project/pro_motion/pm_home_activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ def on_create(saved_instance_state)
super

mp "PMHomeActivity on_create", debugging_only: true
create_home_screen
end

def create_home_screen
home_screen_class = PMApplication.current_application.home_screen_class
set_fragment home_screen_class.new if home_screen_class
self.set_fragment home_screen_class.new if home_screen_class
end
end

#end
2 changes: 1 addition & 1 deletion templates/screen/app/screens/name_screen.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class <%= @name_camel_case %>Screen < PMScreen
# If you are using XML for this screen:
#uses_xml :<%= @name %>
#uses_xml :<%= @name %>_screen

uses_action_bar true
stylesheet <%= @name_camel_case %>ScreenStylesheet
Expand Down

0 comments on commit 340030c

Please sign in to comment.