Sha256: 00b710f94f3b377734ec24b3d901ac799b2d701a1bba3165752ab6a0ff4adef1

Contents?: true

Size: 867 Bytes

Versions: 15

Compression:

Stored size: 867 Bytes

Contents

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

ruboto_import_widgets :LinearLayout, :TextView

class OptionMenuActivity
  def onCreate(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 => 'What hath Matz wrought?', :id => 42, :text_size => 48.0,
                    :layout => {:width => :fill_parent}, :gravity => android.view.Gravity::CENTER
        end
  end

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

Version data entries

15 entries across 15 versions & 1 rubygems

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