Sha256: a78bd38b00a75d49dcffe685c5054ec6d6aea988d693b6356c1b89eded027367

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

require 'droiuby/loader'

#Droiuby Framework class
class DroiubyFramework

  def before_activity_setup
    fname = "#{File.dirname(__FILE__)}/bootstrap.rb"
    @bootstrap = @bootstrap || File.read(fname)
    eval(@bootstrap, TOPLEVEL_BINDING, fname, __LINE__)
  end

  def preload
    fname = "#{File.dirname(__FILE__)}/preload.rb"
    @preload = @preload || File.read(fname)
    eval(@preload, TOPLEVEL_BINDING, fname, __LINE__)
  end

  def on_click(view)
  end

  def script(controller, refresh = false)
    klass = controller.camelize.constantize
    instance = klass.new

    skip_content_view = if instance.respond_to? :before_content_render
      instance.before_content_render unless refresh
    end

    set_content_view unless skip_content_view

    instance.on_create
    instance
  end

  def resolve_view(name, node)
    name_parts = name.split('#')

    klass_str = if name_parts.size > 1
      "#{name_parts[0].camelize}::#{name_parts[1].camelize}"
    else
      name.camelize
    end

    puts klass_str
    klass = klass_str.constantize

    instance = klass.new(_current_activity)
    if instance.class < ViewWrapper
      instance.native
    else
      instance._proxy_class([Java::android.content.Context.java_class], [_current_activity])
    end
  end

end

$framework = DroiubyFramework.new

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
droiuby-0.3.6 lib/droiuby/droiuby.rb
droiuby-0.3.5 lib/droiuby/droiuby.rb
droiuby-0.3.4 lib/droiuby/droiuby.rb
droiuby-0.3.3 lib/droiuby/droiuby.rb
droiuby-0.3.2 lib/droiuby/droiuby.rb
droiuby-0.3.1 lib/droiuby/droiuby.rb
droiuby-0.3.0 lib/droiuby/droiuby.rb
droiuby-0.2.9 lib/droiuby/droiuby.rb
droiuby-0.2.8 lib/droiuby/droiuby.rb
droiuby-0.2.7 lib/droiuby/droiuby.rb
droiuby-0.2.6 lib/droiuby/droiuby.rb
droiuby-0.2.5 lib/droiuby/droiuby.rb
droiuby-0.2.4 lib/droiuby/droiuby.rb
droiuby-0.2.3 lib/droiuby/droiuby.rb
droiuby-0.2.2 lib/droiuby/droiuby.rb