Open davidwong opened 3 years ago
Hi Did you find any solution to this problem? I noted that the click is register inside the library RecyclerView but the listener is not working.
The logs when I click on a Cell:
D/VerticalRecyclerViewListener: mCellRecyclerView scroll listener added
D/HorizontalRecyclerViewListener: Scroll listener has been added to 0 at action down
D/VerticalRecyclerViewListener: mCellRecyclerView scroll listener removed from up
D/HorizontalRecyclerViewListener: Scroll listener has been removed to 0 at action up
D/VerticalRecyclerViewListener: mCellRecyclerView scroll listener added
D/HorizontalRecyclerViewListener: Scroll listener has been added to 0 at action down
D/VerticalRecyclerViewListener: mCellRecyclerView scroll listener removed from up
D/HorizontalRecyclerViewListener: Scroll listener has been removed to 0 at action up
I will add this to documentation
app:allow_click_inside_cell="true"
app:allow_click_inside_row_header="true"
app:allow_click_inside_column_header="true"
As a temporary work around, I copied the source code for TableView to create my own table view class that has an extra constructor where you can pass in the boolean values to set those flags. This has to done in a constructor since those boolean flags are private. Note that for this to work, I also had to copy and change the code for the PreferencesHandler class, since that was hardcoded to accept a TableView in it's constructor, instead of the ITableView interface like most of the other internal dependencies. The only change there was in the constructor to accept my table view class instead of TableView.
When a TableView is created with new TableView(context), i.e. not using XML, then it is not clickable.
Looking at the source for TableView (version 0.8.9.4) it seems like the flags to allow clicking are set to false by default:
private boolean mAllowClickInsideCell = false;
private boolean mAllowClickInsideRowHeader = false;
private boolean mAllowClickInsideColumnHeader = false;
When the TableView is inflated from XML these can be set
app:allow_click_inside_cell="true"
app:allow_click_inside_row_header="true"
app:allow_click_inside_column_header="true"
However they cannot be set programmatically, i.e. there are no setters for these fields. This is kinda understandable since they are used during initialization for the TableView, so really need another constructor to set them I guess.
FYI, I'm using new TableView(context) instead of XML since I'm embedding it in a compose AndroidView.