app_version(0, 1, git_revision)
java_package "org.nitlanguage.calculator"
- # Use a translucent background and lock in portrait mode
- android_manifest_activity """
- android:theme="@android:style/Theme.Holo.Wallpaper"
- android:screenOrientation="portrait""""
+ # Lock in portrait mode
+ android_manifest_activity """android:screenOrientation="portrait""""
end
# FIXME the next line should import `android` only when it uses nit_activity
import calculator_logic
-redef class App
+redef class Activity
+ super EventCatcher
+
private var context = new CalculatorContext
# The main display, at the top of the screen
# Has this window been initialized?
private var inited = false
- redef fun init_window
+ redef fun on_start
do
super
inited = true
# Setup UI
- var context = native_activity
- var layout = new NativeLinearLayout(context)
+ var layout = new NativeLinearLayout(native)
layout.set_vertical
# Display screen
["="]]
for line in ops do
- var buts_layout = new NativeLinearLayout(context)
+ var buts_layout = new NativeLinearLayout(native)
buts_layout.set_horizontal
layout.add_view_with_weight(buts_layout, 1.0)
for op in line do
var but = new Button
+ but.event_catcher = self
but.text = op
but.text_size = 40
buts_layout.add_view_with_weight(but.native, 1.0)
end
end
- context.content_view = layout
+ native.content_view = layout
end
redef fun catch_event(event)