Search in sources :

Example 1 with UITableCellDrawable

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));
}
Also used : UITableCellDrawable(fr.days.android.uitableview.drawable.UITableCellDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable) Drawable(android.graphics.drawable.Drawable) UITableCellDrawable(fr.days.android.uitableview.drawable.UITableCellDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable)

Aggregations

Drawable (android.graphics.drawable.Drawable)1 InsetDrawable (android.graphics.drawable.InsetDrawable)1 UITableCellDrawable (fr.days.android.uitableview.drawable.UITableCellDrawable)1