evrencoskun / TableView

TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
MIT License
3.14k stars 459 forks source link

Property isShadowed always returns false #228

Open MagoMtzAl opened 5 years ago

MagoMtzAl commented 5 years ago

The property isShadowed is always returning false when trying to access it from Listener method onCellClick()

This is my implementation:

override fun onCellClicked(cellView: RecyclerView.ViewHolder, column: Int, row: Int) {

    cellView as CellViewHolder
    if (cellView.isShadowed) {
            listener.onCellClick(summaryList[row].transaction?.id!!)
    }

}

evrencoskun commented 5 years ago

Hi @MagoMtzAl

You are checking the state on the wrong place and wrong time. That's why you get always false. Because when any cell is clicked, the SelectionStateof the cell is not SelectionState.SHADOWED.

I would recommend you to check the selection handler class to understand in which case, the status of a cell becomes SelectionState.SHADOWED.