Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableView created programmatically not clickable #388

Open
davidwong opened this issue Aug 10, 2021 · 3 comments
Open

TableView created programmatically not clickable #388

davidwong opened this issue Aug 10, 2021 · 3 comments
Labels

Comments

@davidwong
Copy link

davidwong commented Aug 10, 2021

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.

@davidwong davidwong added the bug label Aug 10, 2021
@lupaulus
Copy link
Contributor

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

@lupaulus
Copy link
Contributor

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"

@davidwong
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants