Skip to content

Instantly share code, notes, and snippets.

@abscondment
Created April 1, 2011 16:36
Show Gist options
  • Save abscondment/898449 to your computer and use it in GitHub Desktop.
Save abscondment/898449 to your computer and use it in GitHub Desktop.
onItemSelected
def onItemSelected(parent:AdapterView, view:View, pos:int, id:long)
unless @textView.nil?
photo_map = Map(LazyGalleryAdapter(parent.getAdapter).getItem pos)
if photo_map.containsKey('caption')
@textView.setText String(photo_map.get('caption'))
@textView.setVisibility View.VISIBLE
else
@textView.setVisibility View.INVISIBLE
end
end
view.setSelected true
# Preload children of the Gallery (i.e. those elements that are visible)
unless parent.nil?
parent.getChildCount.times do |i|
v = RelativeLayout(parent.getChildAt(i))
LazyImageView(v.getChildAt 0).load unless v.nil?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment