Case Study: How We Created Adaptive Table Layout Library To Work With CSV Files
Open source libraries play a very important role in the software development. Programmers will agree with us for sure. Using many interesting features from one library or another, you can enhance your app and make it more advanced. And if your app needs to work with tables, values, and symbols, you may need a certain library that allows you to work with CSV files, for example.
A CSV file is a text file where tabular information is stored and its margins are separated by delimiters. That is why this file is called Comma Separated Values. Figuratively speaking, a CSV Library is a kind of a container for the storage of various features for working with CSV files.
We would like to draw your attention to the following case study that will explain how we created our custom CSV library AdaptiveTableLayout for Android, how to use it in mobile app development and why it is better than its counterparts.
First, you may say that you are not surprised with the development of one more new CSV Reader for mobile and corresponding libraries. But there is one small detail that you cannot ignore. Available CSV Editors and Readers can provide you with almost all necessary features apart from the one - they all have no controlling feature that allows users to dynamically indicate a number of column and rows. It makes working process with CSV files slower and less convenient. But there was no solution to it until we have decided to fix it.
See how we created an event planning app. Read Case study: How we created a cutting-edge event planning app
We created a CSV Library to provide users with the new features they can use in their own software. Also, we have developed a CSV Reader as a demonstration of the practical application of our AdaptiveTableLayout library.
Of course, it is a not some trendy software that will be popular among all Android users. But if you are working with a large array of information, this library can be helpful for you in your software development.
We launched market research in order to look through other available CSV Readers for Android, checking their features and capabilities. We would like to indicate some counterparts to show you what we have looked through to make our conclusions.
This CSV Viewer allows users to edit CSV files as well as work with importing and exporting phone contacts.
But, including the lack of a dynamic indication feature, it has an advertisement as well. In addition, it doesn't allow you to make a diagonally scrolling, or fix headers as our CSV Reader and corresponding library can do.
This CSV Reader can sort data display functions, it supports a few data delimiters, and it displays the function of the line number etc.
First, it also contains an advertisement. Apart from this, Reader has no reshuffling feature when you can reshuffle all rows and columns in the table. Finally, our CSV Reader can boast about a drag-and-drop feature that no listed CSV Viewer can offer you.
As we noted, this simple CSV Reader allows you only to read files. It doesn't have an editing feature or any other feature like scrolling, changing the cell margin, dragging files and so on. This Reader can become necessary only if you just need to make an ordinary CSV table.
Noting all the above, we would like to add one more feature that CSV Viewer and CSV Reader lack as well - they cannot work with large files easily. But our library makes it possible.
Having conducted a market research, we have analyzed existing solutions for Android, scrutinized their capabilities and features, and drew the appropriate conclusions. We have changed the design of our CSV Reader to make it unique, made an open source library to allow anyone to integrate it into their software, and released it for free downloading without advertisements.
AdaptiveTableLayout development steps
Now we will show you how we created this library step by step. Let's study it in more detail.
First, our Android developers applied RecyclerView technology that was used for the scrolling feature integration. Then the sample of the future app was created to get the first visual display of how the app will look. Also, the sample stage included functional testing and verification of all methods for working with the library. Having done it, developers started integrating new features into the app to make it custom and unique.
Example of how the library works in the app
The library was created using native Android SDK and developers used API level 16.
Developers get the CSV Reader into shape and make appropriate documentation with the detailed description of how the app works and how to use the library. Also, our testers tested the CSV library for bugs detection and then developers fixed some bugs.
You should know how our project team is formed. Read How we form a project team that can breathe life into your ideas
Features of AdaptiveTableLayout
What can you do using our library? It has the following features:
- Reading and editing CSV files;
- It allows reshuffling rows and columns;
- Diagonal scrolling;
- Fixing headers to the edges;
- Changing cell margin;
- Working with large files without lagging;
- Drag-and-drop feature.
The way you can add your CSV file to the CSV Reader
The library also contains two data adapters:
The first is BaseDataAdaptiveTableLayoutAdapter that makes it possible to work with the Light data. Original data can be changed after switching to each column/row and then data is saved automatically.
The second - LinkedAdaptiveTableAdapter is using the matrix with changed items with links on it. It can work with the Heavy data. Original data cannot be changed.
Before using the adapters mentioned above, you need to know the precise width and height of rows and columns as well as their number.
Advantages of AdaptiveTableLayout
A custom open source library makes it possible to use new features you won't find in other libraries. Here you can do the following:
- Make a diagonal scrolling;
- Comfortable navigation;
- Use drag-and-drop feature to change rows/columns;
- Fix your headers to the edge;
- Solid rows - row header changes its number when you drag the row up or down.
Customize your CSV Reader - choose solid row or fixed header
Key challenges we had to overcome
As any other app development, some difficulties can become an obstacle. But we never throw in our cards, we break all obstacles and move forward. And here you find all problems we had to solve during development of the app.
Other CSV libraries can provide you only with up-and-down or left-to-right scrolling at the same time. So developers decided to integrate obliquely scrolling. It was not a simple task since they wanted to do it on the RecyclerView basis. It took some time before they succeeded in it but the code looked awful. And then they came to the conclusion that it is better to manage it all manually and remove RecyclerView from the library completely. And use it in CSV Reader.
It was necessary to calculate precisely what element and where it should be located. It was not an easy process since programmers had to perform many calculations.
It took a lot of time to create an adapter which would cache all drag-and-drop changes. It simplified work with large CSV files.
It was not a very serious challenge but they also had to think over the correct movement process.
See what we did to create a Bitutorial platform. Read Case study: Crumbling turorial for Android
Also, in the future, we plan to add pinch-in/pinch-out feature as well as a zooming feature. In addition, we will add right to left writing model for people from Middle Eastern countries.
Static example of our CSV Reader
Just watch our video to see the library in action:
How AdaptiveTableLayout works - see in action
Are you satisfied with our CSV library? Rate it and give your feedback on GitHub. If you want to create something similar, we will be glad to help you. Just drop us a line! Besides that, if you subscribe to our blog, you will never miss our fresh interesting news about the IT world. Join us!