assets/src/ruboto/widget.rb in ruboto-0.10.2 vs assets/src/ruboto/widget.rb in ruboto-0.11.0.rc.0
- old
+ new
@@ -73,20 +73,20 @@
#
# Load ViewGroup constants
#
-java_import "android.view.ViewGroup"
+java_import 'android.view.ViewGroup'
ViewGroup::LayoutParams.constants.each do |i|
View.add_constant_conversion i.downcase.to_sym, ViewGroup::LayoutParams.const_get(i)
end
#
# Load Gravity constants
#
-java_import "android.view.Gravity"
+java_import 'android.view.Gravity'
Gravity.constants.each do |i|
View.add_constant_conversion i.downcase.to_sym, Gravity.const_get(i)
end
#
@@ -95,11 +95,11 @@
def ruboto_import_widgets(*widgets)
widgets.each { |i| ruboto_import_widget i }
end
-def ruboto_import_widget(class_name, package_name="android.widget")
+def ruboto_import_widget(class_name, package_name='android.widget')
if class_name.is_a?(String) or class_name.is_a?(Symbol)
klass = java_import("#{package_name}.#{class_name}") || eval("Java::#{package_name}.#{class_name}")
else
klass = class_name
java_import klass
@@ -163,10 +163,11 @@
def setup_image_button
# legacy
end
def setup_list_view
+ Java::android.widget.ListView.__persistent__ = true
Java::android.widget.ListView.class_eval do
def configure(context, params = {})
if list = params.delete(:list)
@adapter_list = Java::java.util.ArrayList.new
@adapter_list.addAll(list)
@@ -184,9 +185,10 @@
end
end
end
def setup_spinner
+ Java::android.widget.Spinner.__persistent__ = true
Java::android.widget.Spinner.class_eval do
attr_reader :adapter, :adapter_list
def configure(context, params = {})
if params.has_key? :list