space, → | next slide |
← | previous slide |
d | debug mode |
## <ret> | go to slide # |
c | table of contents (vi) |
f | toggle footer |
r | reload slides |
z | toggle help (this) |
public void Activity.onCreate(Bundle bundle)
public void Activity.onPause()
public void onClick(View view)
handle_create do |bundle|
handle_pause do
handle_click do |view|
$ ruboto gen app \
$ --package com.danieljackoway.rubyconfx \
$ --path rubyconfx \ # where app files go
$ --name HelloWorld \ # Name of app
$ --target android-8 \ # Froyo
$ --activity HiActivity # Name of Activity
(remove comments)
android create project
require 'ruboto.rb'
ruboto_import_widgets :TextView,
:LinearLayout, :Button
$activity.handle_create do |bundle|
setTitle 'This is the Title'
#...
setup_content do
linear_layout :orientation => LinearLayout::VERTICAL do
@text_view = text_view :text => "What hath Matz wrought?"
button :text => "M-x butterfly", :width => :wrap_content
end
end
handle_click do |view|
if view.getText == 'M-x butterfly'
@text_view.setText "What hath Matz wrought!"
toast 'Flipped a bit via butterfly'
end
end
end #close handle_create block (prev slide)
$ rake; adb -d install -r bin/*-debug.apk
Must use JRuby's rake
@name = "world"
puts "Hello, #{@name}!"
def fib(a:fixnum)
if a < 2
a
else
fib(a - 1) + fib(a - 2)
end
end
// Generated from fib.mirah
public class Fib extends java.lang.Object {
public static void main(java.lang.String[] argv) {
}
public static int fib(int a) {
// normally one line
return (a < 2) ? (a) :
((Fib.fib((a - 1)) + Fib.fib((a - 2))));
}
}
rake update_scripts