Created
April 1, 2011 16:36
-
-
Save abscondment/898449 to your computer and use it in GitHub Desktop.
onItemSelected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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