Skip to content
This repository
Browse code

Updated to 0.10.1.dev

  • Loading branch information...
commit f5bc21dbdd0009ac6487b487cf30bb9089129a3d 1 parent e69a782
Scott Moyer rscottm authored

Showing 1 changed file with 15 additions and 4 deletions. Show diff stats Hide diff stats

  1. +15 4 src/ruboto/service.rb
19 src/ruboto/service.rb
@@ -14,7 +14,18 @@
14 14
15 15 module Ruboto
16 16 module Context
17   - def start_ruboto_service(global_variable_name = '$service', klass=RubotoService, &block)
  17 + def start_ruboto_service(global_variable_name='$service', klass=RubotoService, options={}, &block)
  18 + # FIXME(uwe): Translate old positional signature to new options-based signature.
  19 + # FIXME(uwe): Remove when we stop supporting Ruboto 0.8.0 or older.
  20 + if options.nil?
  21 + if global_variable_name.is_a?(Hash)
  22 + options = global_variable_name
  23 + else
  24 + options = {}
  25 + end
  26 + global_variable_name = nil
  27 + end
  28 +
18 29 class_name = options[:class_name] || "#{klass.name.split('::').last}_#{source_descriptor(block)[0].split("/").last.gsub(/[.-]+/, '_')}_#{source_descriptor(block)[1]}"
19 30 if !Object.const_defined?(class_name)
20 31 Object.const_set(class_name, Class.new(&block))
@@ -22,12 +33,12 @@ def start_ruboto_service(global_variable_name = '$service', klass=RubotoService,
22 33 Object.const_get(class_name).class_eval(&block) if block_given?
23 34 end
24 35 b = Java::android.os.Bundle.new
25   - b.putInt("Theme", theme) if theme
26 36 b.putString("ClassName", class_name)
  37 + b.putString("Script", options[:script]) if options[:script]
27 38 i = android.content.Intent.new
28 39 i.setClass self, klass.java_class
29   - i.putExtra("RubotoActivity Config", b)
30   - self.startService Java::android.content.Intent.new(self, klass.java_class)
  40 + i.putExtra("Ruboto Config", b)
  41 + self.startService i
31 42 self
32 43 end
33 44 end

0 comments on commit f5bc21d

Please sign in to comment.
Something went wrong with that request. Please try again.