Skip to content

Instantly share code, notes, and snippets.

@DevJohnC
Created May 14, 2013 15:22
Show Gist options
  • Select an option

  • Save DevJohnC/5576795 to your computer and use it in GitHub Desktop.

Select an option

Save DevJohnC/5576795 to your computer and use it in GitHub Desktop.
var i = 0;
var upperBound = itemsToDisplay + startOffset;
foreach (var item in Items)
{
if (i < startOffset || i >= upperBound)
{
if (item.IsDisplayed)
{
_layout.Remove(item.ProxyDrawable);
item.IsDisplayed = false;
}
i++;
continue;
}
i++;
if (!item.IsDisplayed)
{
_layout.Add(item.ProxyDrawable, col * (Size.Width / ItemsPerLine), row * ((Size.Width / ItemsPerLine) + 20));
item.IsDisplayed = true;
item.Size = new Size((int)itemWidth, (int)itemHeight);
}
else
{
_layout.Move(item.ProxyDrawable, col * (Size.Width / ItemsPerLine),
row * ((Size.Width / ItemsPerLine) + 20));
item.Size = new Size((int)itemWidth, (int)itemHeight);
}
col++;
if (col == ItemsPerLine)
{
row++;
col = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment