Sha256: c98e5fbb44ad3dafcd5ead03ead3aad6bd9d5f0826de211e964179aa583b189b

Contents?: true

Size: 941 Bytes

Versions: 15

Compression:

Stored size: 941 Bytes

Contents

require 'ruboto/widget'
require 'ruboto/util/toast'

ruboto_import_widgets :Button, :LinearLayout, :TextView

# http://xkcd.com/378/

class SampleActivity
  def onCreate(bundle)
    super
    set_title 'Domo arigato, Mr Ruboto!'

    self.content_view =
        linear_layout :orientation => :vertical do
          @text_view = text_view :text => 'What hath Matz wrought?', :id => 42, 
                                 :layout => {:width => :match_parent},
                                 :gravity => :center, :text_size => 48.0
          button :text => 'M-x butterfly', 
                 :layout => {:width => :match_parent},
                 :id => 43, :on_click_listener => proc { butterfly }
        end
  rescue Exception
    puts "Exception creating activity: #{$!}"
    puts $!.backtrace.join("\n")
  end

  private

  def butterfly
    @text_view.text = 'What hath Matz wrought!'
    toast 'Flipped a bit via butterfly'
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruboto-1.6.1 assets/samples/sample_activity.rb
ruboto-1.6.0 assets/samples/sample_activity.rb
ruboto-1.5.0 assets/samples/sample_activity.rb
ruboto-1.4.1 assets/samples/sample_activity.rb
ruboto-1.4.0 assets/samples/sample_activity.rb
ruboto-1.3.1 assets/samples/sample_activity.rb
ruboto-1.3.0 assets/samples/sample_activity.rb
ruboto-1.2.0 assets/samples/sample_activity.rb
ruboto-1.1.2 assets/samples/sample_activity.rb
ruboto-1.1.1 assets/samples/sample_activity.rb
ruboto-1.1.0 assets/samples/sample_activity.rb
ruboto-1.0.3 assets/samples/sample_activity.rb
ruboto-1.0.2 assets/samples/sample_activity.rb
ruboto-1.0.1 assets/samples/sample_activity.rb
ruboto-1.0.0 assets/samples/sample_activity.rb