Skip to content

Instantly share code, notes, and snippets.

@abscondment
Created April 1, 2011 16:35
Show Gist options
  • Save abscondment/898446 to your computer and use it in GitHub Desktop.
Save abscondment/898446 to your computer and use it in GitHub Desktop.
getView
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