private void RebuildView() { if (cells.Count == 0) { return; } mainIdentifierLayout.RemoveAllViews(); ImageCell = null; imageView.RemoveAllViews(); contentlayout.RemoveAllViews(); mainIdentifierLayout.AddView(cells[0].GetHeadlineView()); for (int i = 1; i < cells.Count; ++i) { if (cells[i].CellType() == CellModel.Type.Image && null == ImageCell) { imageView.AddView(cells[i].GetView()); ImageCell = cells[i]; } else { contentlayout.AddView(cells[i].GetView()); } } }
public void ColumnDeleted(int index) { ItemCellView prev = cells[index]; cells.RemoveAt(index); RebuildView(); if (prev.CellType() == CellModel.Type.Image) { imagesAmount--; } /*if(prev == ImageCell) * { * ImageCell = null; * imageView.RemoveAllViews(); * if(imagesAmount > 0) * { * for(int i = 0; i < cells.Count; ++i) * { * if (cells[i].CellType() == CellModel.Type.Image) * { * ImageCell = cells[i]; * imageView.AddView(cells[i].GetView()); * break; * } * * } * } * }*/ //} prev.DeleteView(); }
public void ColumnAdded(int index, CellModel cellModel, ColumnModel columnModel) { ItemCellView v = new ItemCellView( columnModel, cellModel, context); cells.Insert(index, v); RebuildView(); /* * if (cellModel.CellType() == CellModel.Type.Image) * { * imagesAmount++; * * if (null != ImageCell && cells.IndexOf(ImageCell) < index) * { * //just leave it, its not going to be displayed * } * else * { * ImageCell = v; * imageView.RemoveAllViews(); * imageView.AddView(v.GetView()); * } * }else * if (index == 0) * { * if(null != IdentifierCell) * { * mainIdentifierLayout.RemoveAllViews(); * contentlayout.AddView(IdentifierCell.GetView(), 0); * * IdentifierCell = v; * mainIdentifierLayout.AddView(IdentifierCell.GetHeadlineView()); * } * else * { * IdentifierCell = v; * mainIdentifierLayout.AddView(IdentifierCell.GetHeadlineView()); * } * } * else * { * contentlayout.AddView(v.GetView(), index - imagesAmount); * } */ }