ISchwarz23 / SortableTableView

An Android library containing a simple TableView and an advanced SortableTableView providing a lot of customisation possibilities to fit all needs.
Apache License 2.0
1.05k stars 239 forks source link

I want to wrap the all raw cell with my custom view group. #92

Open moinkhan-in opened 7 years ago

moinkhan-in commented 7 years ago

Library is very handy. But I got a problem when I want to wrap all cell in a custom view group.

As i have seen the code of this library. I found that getView() method is final, So that i can not change the behaviour of getView(), And all cell are inserted in LinearLayout,.

What i want to achieve is, i want swipe delete row functionality. So that i need to change the wrapper of all cell view. So currently I just download library, and remove the final key word from getView() and override the method, and wrap whole LinearLayout with SwipeLayout.

So my question why getView() is final ? Why don't you allow from overriding it, so that people can modified it according to their requirement.

ISchwarz23 commented 7 years ago

Hi @msquare097,

the reason why this method is final is because it contains the main logic that makes the table a table. If this method is overridden by somebody who is not exactly knowing what he is doing, than he could destroy the full functionality of the table. But instead of removing the final modifier from the getView method there could be a new entity set on the Table, that wrapps each row view inside another view. This other view would be by default no view and in your case it would wrap the row view inside a SwipeLayout. What do you think about this idea?

Best regards, Ingo

moinkhan-in commented 7 years ago

Hii @ISchwarz23 that's cool and thanks for reply .. Just give any mechanism that if any one want to wrap your row with other layout by some where , or they can use layout which comes by default. but be careful when you provide this, because when added my custom wrapper to your row view the listeners are not working properly. I mean when I long click on row the both dataLongClicked and dataClicked called. May be I have used SwipeLayout so that it was happen. But make sure to test it properly.