Sha256: c3e88032e412999fcbd9106301c9dbd1fcf668e5c46132a7693bb8e46e3c025b

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'ruboto/widget'

ruboto_import_widgets :Button, :LinearLayout, :TextView

class ViewConstantsActivity
  def on_create(bundle)
    super
    $ruboto_test_app_activity = self
    setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')

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

  def set_text(text)
    @text_view.text = text
  end

  private

  def butterfly
    puts 'butterfly'
    Thread.start do
      begin
        startService(android.content.Intent.new(application_context, $package.RubotoTestService.java_class))
      rescue Exception
        puts "Exception starting the service: \#{$!}"
        puts $!.backtrace.join("\\n")
      end
    end
    puts 'butterfly OK'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruboto-0.10.2 test/activity/view_constants_activity.rb
ruboto-0.10.2.rc.0 test/activity/view_constants_activity.rb