Sha256: 222b66caded244ee20b720fe76ece8a8d25a026b9c2ccd2acd51c348d0243f99

Contents?: true

Size: 1.25 KB

Versions: 15

Compression:

Stored size: 1.25 KB

Contents

require 'ruboto/widget'

ruboto_import_widgets :Button, :LinearLayout, :TextView

class ViewConstantsActivity
  def onCreate(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, :layout => {:width => :fill_parent},
                                 :gravity => android.view.Gravity::CENTER, :text_size => 48.0
          button :text => 'M-x butterfly', :layout => {: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

15 entries across 15 versions & 1 rubygems

Version Path
ruboto-1.6.1 test/activity/view_constants_activity.rb
ruboto-1.6.0 test/activity/view_constants_activity.rb
ruboto-1.5.0 test/activity/view_constants_activity.rb
ruboto-1.4.1 test/activity/view_constants_activity.rb
ruboto-1.4.0 test/activity/view_constants_activity.rb
ruboto-1.3.1 test/activity/view_constants_activity.rb
ruboto-1.3.0 test/activity/view_constants_activity.rb
ruboto-1.2.0 test/activity/view_constants_activity.rb
ruboto-1.1.2 test/activity/view_constants_activity.rb
ruboto-1.1.1 test/activity/view_constants_activity.rb
ruboto-1.1.0 test/activity/view_constants_activity.rb
ruboto-1.0.3 test/activity/view_constants_activity.rb
ruboto-1.0.2 test/activity/view_constants_activity.rb
ruboto-1.0.1 test/activity/view_constants_activity.rb
ruboto-1.0.0 test/activity/view_constants_activity.rb