Sha256: 9e6fb29c20c5106b6b70129774652868c49fe3720e9207992577d045d4494ecc

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

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

ruboto_import_widgets :ImageButton, :LinearLayout, :TextView

class ImageButtonActivity
  def onCreate(bundle)
    super
    set_title File.basename(__FILE__).chomp('_activity.rb').split('_').
                  map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')

    click_handler = proc do |view|
      @text_view.setText 'What hath Matz wrought!'
      toast 'Flipped a bit via butterfly'
    end

    self.content_view =
        linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER_HORIZONTAL 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
          image_button :image_resource    => $package.R::drawable::get_ruboto_core, 
                       :layout            => {:width => :wrap_content}, :id => 43,
                       :on_click_listener => click_handler
        end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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