recycler-view-divider / com.fondesa.recyclerviewdivider / Divider / <init>

<init>

Divider(grid: Grid, originX: Int, originY: Int, orientation: Orientation)

Identifies a divider originating from a corner of a cell and going to an adjacent corner. The coordinates:

Some examples of a list with 3 items:

top-to-bottom        top-to-bottom        bottom-to-top        bottom-to-top
left-to-right        right-to-left        left-to-right        right-to-left

0;0 ----> 1;0        1;0 <---- 0;0        0;3 ----> 1;3        1;3 <---- 0;3
 |         |          |         |          ∧         ∧          ∧         ∧
 |    0    |          |    0    |          |    2    |          |    2    |
 ∨         ∨          ∨         ∨          |         |          |         |
0;1 ----> 1;1        1;1 <---- 0;1        0;2 ----> 1;2        1;2 <---- 0;2
 |         |          |         |          ∧         ∧          ∧         ∧
 |    1    |          |    1    |          |    1    |          |    1    |
 ∨         ∨          ∨         ∨          |         |          |         |
0;2 ----> 1;2        1;2 <---- 0;2        0;1 ----> 1;1        1;1 <---- 0;1
 |         |          |         |          ∧         ∧          ∧         ∧
 |    2    |          |    2    |          |    0    |          |    0    |
 ∨         ∨          ∨         ∨          |         |          |         |
0;3 ----> 1;3        1;3 <---- 0;3        0;0 ----> 1;0        1;0 <---- 0;0

Some examples of a 2 x 2 grid with 4 items:

         top-to-bottom                  top-to-bottom                 bottom-to-top                 bottom-to-top
         left-to-right                  right-to-left                 left-to-right                 right-to-left

    0;0 ----> 1;0 ----> 2;0        2;0 <---- 1;0 <---- 0;0       0;2 ----> 1;2 ----> 2;2       2;2 <---- 1;2 <---- 0;2
     |         |         |          |         |         |         ∧         ∧         ∧         ∧         ∧         ∧
     |    0    |    1    |          |    1    |    0    |         |    2    |    3    |         |    3    |    2    |
     ∨         ∨         ∨          ∨         ∨         ∨         |         |         |         |         |         |
    0;1 ----> 1;1 ----> 2;1        2;1 <---- 1;1 <---- 0;1       0;1 ----> 1;1 ----> 2;1       2;1 <---- 1;1 <---- 0;1
     |         |         |          |         |         |         ∧         ∧         ∧         ∧         ∧         ∧
     |    2    |    3    |          |    3    |    2    |         |    0    |    1    |         |    1    |    0    |
     ∨         ∨         ∨          ∨         ∨         ∨         |         |         |         |         |         |
    0;2 ----> 1;2 ----> 2;2        2;2 <---- 1;2 <---- 0;2       0;0 ----> 1;0 ----> 2;0       2;0 <---- 1;0 <---- 0;0

The set of coordinates is NOT a projection of the intersections of all the lines in a grid N (rows) x M (columns), but they map exactly the given grid, considering the cells' spans. The coordinates match their projection only when all the items have a span size of 1. This decision was taken only to simplify the customization of a single divider with the different providers, even if it's less coherent with the structure of a standard table.

An example of a grid with 4 items having different span sizes:

              top-to-bottom
              left-to-right

    0;0 ----> 1;0 --------------> 2;0
     |         |                   |
     |    0    |         1         |
     ∨         ∨                   ∨
    0;1 ----> 1;1 ----> 1;1 ----> 2;1
     |                   |         |
     |         2         |    3    |
     ∨                   ∨         ∨
    0;2 --------------> 1;2 ----> 2;2

The coordinate (x)1;(y)1 is repeated twice since it's the bottom divider of the item with index 0 and the top divider of the item with index 2.

Parameters

grid - the grid in which this divider should appear.

originX - the x-coordinate from which the divider is originating.

originY - the y-coordinate from which the divider is originating.

orientation - Orientation.HORIZONTAL if the divider is horizontal, Orientation.VERTICAL if the divider is vertical.

See Also

Grid

Line

Cell