-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathapplication.rb
40 lines (34 loc) · 1.04 KB
/
application.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class UI::Application
attr_reader :navigation
@@instance = nil
def initialize(navigation, context)
UI.context = context
@navigation = navigation
UI.context.contentView = proxy
UI.context.supportActionBar.elevation = UI.density # one bottom border line
@@instance = self
end
def self.instance
@@instance
end
def start
fragment = @navigation.root_screen.proxy
transaction = UI.context.fragmentManager.beginTransaction
transaction.add(proxy.id, fragment, nil)
transaction.addToBackStack(nil)
transaction.commit
end
def proxy
@proxy ||= begin
frame_layout = Android::Widget::FrameLayout.new(UI.context)
frame_layout.id = Android::View::View.generateViewId
frame_layout
end
end
def version_number
UI.context.applicationContext.packageManager.getPackageInfo(UI.context.applicationContext.packageName, 0).versionName
end
def build_number
UI.context.applicationContext.packageManager.getPackageInfo(UI.context.applicationContext.packageName, 0).versionCode
end
end