assets/src/ruboto/widget.rb in ruboto-0.13.0.rc.0 vs assets/src/ruboto/widget.rb in ruboto-0.13.0
- old
+ new
@@ -32,11 +32,12 @@
def self.add_constant_conversion(from, to)
@@convert_constants[from] = to
end
def self.convert_constant(from)
- @@convert_constants[from] or from
+ return from unless from.is_a?(Symbol)
+ @@convert_constants[from] or raise "Symbol #{from.inspect} doesn't have a corresponding View constant #{from.to_s.upcase}"
end
def self.setup_constant_conversion
(self.constants - self.superclass.constants).each do |i|
View.add_constant_conversion i.downcase.to_sym, self.const_get(i)
@@ -166,10 +167,10 @@
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)
+ if (list = params.delete(:list))
@adapter_list = Java::java.util.ArrayList.new
@adapter_list.addAll(list)
item_layout = params.delete(:item_layout) || R::layout::simple_list_item_1
params[:adapter] = Java::android.widget.ArrayAdapter.new(context, item_layout, @adapter_list)
end