Class: PMApplication

Inherits:
Android::App::Application
  • Object
show all
Defined in:
lib/project/pro_motion/pm_application.rb

Overview

RM-773 module ProMotion

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.current_applicationObject

Returns the value of attribute current_application.



62
63
64
# File 'lib/project/pro_motion/pm_application.rb', line 62

def current_application
  @current_application
end

.home_screen_classObject

Returns the value of attribute home_screen_class.



62
63
64
# File 'lib/project/pro_motion/pm_application.rb', line 62

def home_screen_class
  @home_screen_class
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



4
5
6
# File 'lib/project/pro_motion/pm_application.rb', line 4

def context
  @context
end

#current_activityObject

Returns the value of attribute current_activity.



4
5
6
# File 'lib/project/pro_motion/pm_application.rb', line 4

def current_activity
  @current_activity
end

#home_screen_classObject

Returns the value of attribute home_screen_class.



4
5
6
# File 'lib/project/pro_motion/pm_application.rb', line 4

def home_screen_class
  @home_screen_class
end

Class Method Details

.home_screen(hclass) ⇒ Object



64
65
66
67
# File 'lib/project/pro_motion/pm_application.rb', line 64

def home_screen(hclass)
  mp "PMApplication home_screen", debugging_only: true
  @home_screen_class = hclass
end

Instance Method Details

#current_screenObject



26
27
28
29
30
31
32
# File 'lib/project/pro_motion/pm_application.rb', line 26

def current_screen
  if @current_activity && (ca = @current_activity)
    if ca.is_a?(PMSingleFragmentActivity)
      ca.fragment
    end
  end
end

#development?Boolean



57
58
59
# File 'lib/project/pro_motion/pm_application.rb', line 57

def development?
  environment == :development
end

#environmentSymbol



41
42
43
# File 'lib/project/pro_motion/pm_application.rb', line 41

def environment
  @_environment ||= RUBYMOTION_ENV.to_sym
end

#guess_current_screenObject



34
35
36
37
38
# File 'lib/project/pro_motion/pm_application.rb', line 34

def guess_current_screen
  # TODO
  #ca.getFragmentManager.findFragmentById(Android::R::Id.fragment_container)
  #ca.getFragmentManager.frameTitle
end

#onCreateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/project/pro_motion/pm_application.rb', line 6

def onCreate
  mp "PMApplication onCreate", debugging_only: true

  # We can always get to the current application from PMApplication.current_application
  # but we set the child class's current_application too, in case someone uses that
  PMApplication.current_application = self
  self.class.current_application = self

  @context = self

  @home_screen_class = self.class.home_screen_class
  self.on_create if respond_to?(:on_create)
end

#release?Boolean Also known as: production?



46
47
48
# File 'lib/project/pro_motion/pm_application.rb', line 46

def release?
  environment == :release
end

#test?Boolean



52
53
54
# File 'lib/project/pro_motion/pm_application.rb', line 52

def test?
  environment == :test
end

#windowObject



20
21
22
23
24
# File 'lib/project/pro_motion/pm_application.rb', line 20

def window
  if @current_activity
    @window ||= @current_activity.getWindow
  end
end