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 454 forks source link

Feature to allow the location of the corner view and the fixed column to other corners of the screen #357

Closed Zardozz closed 3 years ago

Zardozz commented 3 years ago

This was a feature somebody requested on stackoverflow and it should be an enabler for (Right to Left) RTL support #314 #233 It does not change the layout direction of the any of the recyclerviews but it does allow the Row Headers to be on the Right with would be logical when supporting Full RTL

The Changes include New Instrumented Test Class to cover changes

Example Default CornerView Location (From Tests) image

XML Attribute "app:corner_view_location="top_right"" Most likely used for RTL layout image

XML Attribute "app:corner_view_location="bottom_left"" image

XML Attribute "app:corner_view_location="bottom_right"" image

As well as setting the location via XML Attributes and additional constructor has been added to allow the class construction to be in 2 parts public TableView(@NonNull Context context, boolean initialize) {

This allows you delay the creation of the recyclerview by setting initialze = false so you can set some of the properties on when creating the TableView class programmatically, instead of only being able to do them via XML attrinutes.
e.g. setCornerViewLocation, setShowVerticalSeparators, setShowHorizontalSeparators, etc

It was made an additional constructor method to not break any existing usuages.

It can be used like:-

TableView tableView =
                new TableView(InstrumentationRegistry.getInstrumentation().getTargetContext(), false);

        // initialize was false so set properties and call initialize
        tableView.setCornerViewLocation(ITableView.CornerViewLocation.BOTTOM_LEFT);
        tableView.initialize();

Also the three main recyclerviews (mColumnHeaderRecyclerView, mRowHeaderRecyclerView, mCellRecyclerView) where given auto generated Id's of "ColumnHeaderRecyclerView" , "RowHeaderRecyclerView", "CellRecyclerView" to aid identification in the layout.

All Existing and New Tests Pass image

New Overall code coverage Stats from all Tests image

Zardozz commented 3 years ago

Might also cover

Something like Footer #150 - as Header can be placed at the bottom instead of top.

And probably part way to

horizontal scrolling from right to left #15 and Does this library support RTL? #68