/** * Creates a Group using a label for grouping items * * @param items the list of items * @param label the String that rapresent the label to be shown */ public Group(List<ItemPinned> items, String label) { this.items = items; if (this.items != null) { for (int i = 0; i < this.items.size(); i++) { ItemPinned itemPinned = this.items.get(i); initItemPosition(itemPinned, i); if (this.items.get(i) instanceof TextItemPinned) ((TextItemPinned) this.items.get(i)).setLabel(label); } } }
groups.addGroup(new Group(values, key));
private void initItemPosition(ItemPinned item, int position) { item.setGroupSize(getGroupSize()); item.setRelativePosition(position); }
listD.add(itemD1); listD.add(itemD2); Group groupD = new Group(listD, R.drawable.germany); listS.add(itemS4); listS.add(itemS5); Group groupS = new Group(listS, R.drawable.sweden); listNL.add(itemNL6); listNL.add(itemNL7); Group groupNL = new Group(listNL, R.drawable.netherlands); listIT.add(itemIT3); listIT.add(itemIT4); Group groupIT = new Group(listIT, R.drawable.italy); listP.add(itemP5); listP.add(itemP6); Group groupP = new Group(listP, R.drawable.portugal); listES.add(itemES4); listES.add(itemES5); Group groupES = new Group(listES, R.drawable.spain); listF.add(itemF2); listF.add(itemF3); Group groupF = new Group(listF, R.drawable.france); listEAK.add(itemEAK4);
/** * Creates a Group using an image for grouping items * * @param items the list of items * @param resourceId resource id associated with the image. */ public Group(List<ItemPinned> items, int resourceId) { this.items = items; if (this.items != null) { for (int i = 0; i < this.items.size(); i++) { ItemPinned itemPinned = this.items.get(i); initItemPosition(itemPinned, i); if (this.items.get(i) instanceof ImageItemPinned) ((ImageItemPinned) this.items.get(i)).setImage(resourceId); } } }