assets/src/ruboto/activity.rb in ruboto-1.0.3 vs assets/src/ruboto/activity.rb in ruboto-1.1.0
- old
+ new
@@ -57,16 +57,22 @@
class_name ||= class_name_option
# EMXIF
script_name = options.delete(:script)
extras = options.delete(:extras)
+ flags = options.delete(:flags)
+
raise "Unknown options: #{options}" unless options.empty?
- if class_name.nil? && block_given?
- src_desc = source_descriptor(block)
- class_name =
- "#{java_class.name.split('::').last}_#{src_desc[0].split('/').last.gsub(/[.-]+/, '_')}_#{src_desc[1]}"
+ if class_name.nil?
+ if block_given?
+ src_desc = source_descriptor(block)
+ class_name =
+ "#{java_class.name.split('::').last}_#{src_desc[0].split('/').last.gsub(/[.-]+/, '_')}_#{src_desc[1]}"
+ else
+ class_name = java_class.name.split('::').last
+ end
end
class_name = class_name.to_s
if Object.const_defined?(class_name)
@@ -74,10 +80,11 @@
else
Object.const_set(class_name, Class.new(&block))
end
i = android.content.Intent.new
i.setClass self, java_class.java_class
+ i.add_flags(flags) if flags
i.putExtra(Ruboto::THEME_KEY, theme) if theme
i.putExtra(Ruboto::CLASS_NAME_KEY, class_name) if class_name
i.putExtra(Ruboto::SCRIPT_NAME_KEY, script_name) if script_name
extras.each { |k, v| i.putExtra(k.to_s, v) } if extras
startActivity i
@@ -122,6 +129,5 @@
end
java_import 'android.app.Activity'
java_import 'org.ruboto.RubotoActivity'
ruboto_configure_activity(RubotoActivity)
-