Sha256: be8bbca86f6e59f6d9292be7011dc2e0978be075b1839d34d4806694c0211064

Contents?: true

Size: 933 Bytes

Versions: 2

Compression:

Stored size: 933 Bytes

Contents

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

ruboto_import_widgets :LinearLayout, :TextView

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

    self.content_view =
        linear_layout :orientation => LinearLayout::VERTICAL do
          @text_view = text_view :text  => 'What hath Matz wrought?', :id => 42, :text_size => 48.0,
                                 :width => :fill_parent, :gravity => android.view.Gravity::CENTER
        end
  end

  def on_create_options_menu(menu)
    mi = menu.add('Test')
    # mi.icon = $package.R::drawable::get_ruboto_core
    mi.setIcon($package.R::drawable::get_ruboto_core)
    mi.set_on_menu_item_click_listener do |menu_item|
      @text_view.text = 'What hath Matz wrought!'
      toast 'Flipped a bit via butterfly'
    end
    true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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