Created
April 1, 2011 16:35
-
-
Save abscondment/898446 to your computer and use it in GitHub Desktop.
getView
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 getView(pos:int, convertView:View, parent:ViewGroup) | |
layout = RelativeLayout(convertView) | |
image = LazyImageView(nil) | |
url = String(Map(getItem pos).get('src')) | |
if layout.nil? | |
image = LazyImageView.new(@context, R.drawable.placeholder) | |
image.setScaleType(ImageView.ScaleType.FIT_XY) | |
image.setLayoutParams Gallery.LayoutParams.new(@oneeighty,@oneeighty) | |
image.setBackgroundResource(R.drawable.gallery_background) | |
image.setOnClickListener nil | |
image.setClickable false | |
layout = RelativeLayout.new @context | |
layout.setLayoutParams Gallery.LayoutParams.new(@oneeighty,@oneeighty) | |
layout.setGravity Gravity.CENTER | |
layout.addView image | |
else | |
image = LazyImageView(layout.getChildAt 0) | |
end | |
# show changes | |
image.setSrcUrl url | |
image.refresh | |
return View(layout) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment