Sha256: 35e079de6c95f4b58e2640fb519e8225b932a874fc9c01b9b64c3f5969d29d6d

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

# TODO(uwe): Remove when we stop supporting psych with Ruby 1.8 mode
if RUBY_VERSION < '1.9'
  require 'jruby'
  require 'rbconfig'
  org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
  $LOADED_FEATURES << 'psych.so'
  $LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
end
# ODOT

require 'ruboto/util/stack'
with_large_stack {require 'psych'}

# TODO(uwe): Remove when we stop supporting psych with Ruby 1.8 mode
if RUBY_VERSION < '1.9'
  $LOAD_PATH.delete File.join(Config::CONFIG['libdir'], 'ruby/1.9')
end
# ODOT

Psych::Parser
Psych::Handler

require 'ruboto/widget'

ruboto_import_widgets :LinearLayout, :TextView

class PsychActivity
  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, :gravity => android.view.Gravity::CENTER do
          @decoded_view = text_view :id        => 42, :text => with_large_stack { Psych.load('--- foo') },
                                    :text_size => 48.0, :gravity => android.view.Gravity::CENTER

          # TODO(uwe): Simplify when we stop supporting Psych in Ruby 1.8 mode
          if RUBY_VERSION >= '1.9'
            @encoded_view = text_view :id        => 43, :text => with_large_stack { Psych.dump('foo') },
                                      :text_size => 48.0, :gravity => android.view.Gravity::CENTER
          end
        end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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