use of fr.days.android.uitableview.drawable.UITableCellDrawable in project uitableview4android by DayS.
the class UITableCellView method setBackgroundColor.
public void setBackgroundColor(int[] colorDefault, int[] colorPressed) {
// Assign the right backgroundDrawable according to the cell's position in the group
Drawable backgroundDrawable;
if (indexPath.getRowsCount() == 1) {
backgroundDrawable = new UITableCellDrawable(10.0f, 10.0f, colorDefault, colorPressed, borderColor);
} else {
if (indexPath.isFirstCellOfGroup()) {
backgroundDrawable = new UITableCellDrawable(10.0f, 0, colorDefault, colorPressed, borderColor);
} else if (indexPath.isLastCellOfGroup()) {
backgroundDrawable = new UITableCellDrawable(0, 10.0f, colorDefault, colorPressed, borderColor);
} else {
backgroundDrawable = new UITableCellDrawable(0, 0, colorDefault, colorPressed, borderColor);
}
}
// Add extra space if this cell is the last one
int bottomInset = 0;
if (indexPath.isLastCell()) {
bottomInset = INSET;
}
setBackgroundDrawable(new InsetDrawable(backgroundDrawable, INSET, 0, INSET, bottomInset));
}
Aggregations