Library that makes it possible to read, edit and write CSV files

Overview

AdaptiveTableLayout Awesome

Header image

Welcome the new CSV Library AdaptiveTableLayout for Android by Cleveroad

Pay your attention to our new library that makes it possible to read, edit and write CSV files. If you use Android-based device, you can easily use our library for implementation of all aforementioned actions. In addition, you will be able to change rows and columns, display the picture via link, and align the required data. It will surely help you cope with your tasks faster and make your output higher. AdaptiveTableLayout library is at your disposal.

Demo image

Take a look at the animation of AdaptiveTableLayout for Android on YouTube in HD quality. For using this library in a valuable way, you can find our CSV Editor app on the Google Play Store or on Appetize.

AwesomeAwesomeAwesome

The main goal of the library is to apply all its functions in the process of working with CSV files. Moreover, it will give you a competitive edge over others.

Awesome

Setup and usage

Installation

by gradle :

dependencies {
    implementation "com.cleveroad:adaptivetablelayout:1.2.1"
}

Features

Library consists of three parts:

  • AdaptiveTableLayout (View)
  • LinkedAdaptiveTableAdapter (Adapter)
  • ViewHolderImpl (ViewHolder)

Usage

AdaptiveTableLayout

  <com.cleveroad.adaptivetablelayout.AdaptiveTableLayout
        android:id="@+id/tableLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"      
        app:cellMargin="1dp"
        app:fixedHeaders="true"
        app:solidRowHeaders="true"
        app:dragAndDropEnabled="true"/>
attribute name description
cellMargin margin between cards
fixedHeaders fixed headers mode. If enable, headers always will be displayed in the corners.
solidRowHeaders solid row headers mode. If enable, row header will change its position with dragging row.
dragAndDropEnabled drag and drop mode. If enable, column or row will change its position with dragging after long press on row or column header.
// Return fixed headers mode
boolean isHeaderFixed(); 

// Return solid row headers mode
boolean isSolidRowHeader()

// Return drag and drop mode
boolean isDragAndDropEnabled()

// Return true if layout direction is RightToLeft
boolean isRTL()

// Set fixed headers mode
void setHeaderFixed(boolean headerFixed)

// Set solid row headers mode
void setSolidRowHeader(boolean solidRowHeader)
1.2.0
// Set drag and drop mode
void setDragAndDrow(boolean enabled)

/**
 * Set adapter with IMMUTABLE data.
 * Create wrapper with links between layout rows, columns and data rows, columns.
 * On drag and drop event just change links but not change data in adapter.
 */
void setAdapter(@Nullable AdaptiveTableAdapter adapter)

/**
 * Set adapter with MUTABLE data.
 * You need to implement switch rows and columns methods.    
 * DO NOT USE WITH BIG DATA!!
 */
void setAdapter(@Nullable DataAdaptiveTableLayoutAdapter adapter)

// Notify any registered observers that the data set has changed.
void notifyDataSetChanged()

// Notify any registered observers that the item has changed.
void notifyItemChanged(int rowIndex, int columnIndex)

// Notify any registered observers that the row with rowIndex has changed.
void notifyRowChanged(int rowIndex)

// Notify any registered observers that the column with columnIndex has changed.
void notifyColumnChanged(int columnIndex)

Adapter

You could use adapter interfaces: AdaptiveTableAdapter and DataAdaptiveTableLayoutAdapter. But to simplify the usage, library contains base adapters: BaseDataAdaptiveTableLayoutAdapter and LinkedAdaptiveTableAdapter.

BaseDataAdaptiveTableLayoutAdapter - simple adapter which works with light data. WARNING! on each row/column switch, original data will be changed.

LinkedAdaptiveTableAdapter - adapter which works with heavy data. WARNING! This type of adapter doesn't change original data. It contains matrix with changed items with links on it. To get changed data you need use AdaptiveTableLayout.getLinkedAdapterRowsModifications() and AdaptiveTableLayout.getLinkedAdapterColumnsModifications(). Don't forget to check AdaptiveTableLayout.isSolidRowHeader() flag. If it's false, you need to ignore switching first elemet in each row.

For both adapters you need to know all rows/columns widths, heights and rows/columns count before set adapter to AdaptiveTableLayout.

Fragment/Activity usage

mTableLayout = (AdaptiveTableLayout) view.findViewById(R.id.tableLayout);
...
mTableAdapter = new SampleLinkedTableAdapter(getContext(), mCsvFileDataSource);
mTableAdapter.setOnItemClickListener(...);
mTableAdapter.setOnItemLongClickListener(...);
mTableLayout.setAdapter(mTableAdapter);
...
mTableLayout.setHeaderFixed(true);
mTableLayout.setSolidRowHeader(true);
mTableAdapter.notifyDataSetChanged();

XML usage

 <com.cleveroad.adaptivetablelayout.AdaptiveTableLayout
        android:id="@+id/tableLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/toolbar"
        app:cellMargin="1dp"
        app:fixedHeaders="true"
        app:solidRowHeaders="true"
        app:dragAndDropEnabled="true"/>

Adapter usage

Adapter sample

Changelog

See changelog history.

Support

If you have any questions, issues or propositions, please create a new issue in this repository.

If you want to hire us, send an email to [email protected] or fill the form on contact page

Follow us:

Awesome Awesome Awesome Awesome Awesome

License


The MIT License (MIT)

Copyright (c) 2016 Cleveroad Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • Behavior with AppBarLayout

    Behavior with AppBarLayout

    Trying to use this lib together with AppBarLayout, to scroll Toolbar up before scrolling view itself. For this, i wrapped table containing layout to NestedScrollView, but can't achieve proper work - looks like TableLayout does not support such behavior. Could you please take a look?

    enhancement help wanted 
    opened by formatBCE 6
  • Kotlin crash

    Kotlin crash

    I can't use Kotlin. I use thos code in java works but in kotlin crash..

    mCsvFileDataSource = CsvFileDataSourceImpl(this, null) tlPipeline = findViewById<AdaptiveTableLayout>(R.id.tlPipeline) mTableAdapter = SampleLinkedTableAdapter(this, mCsvFileDataSource) tlPipeline.setAdapter(mTableAdapter)

    bug 
    opened by giuseppesorce 6
  • java.lang.IllegalStateException:You need to init matrix before work!

    java.lang.IllegalStateException:You need to init matrix before work!

    When I reload a Activity contains a AdaptiveTableLayout ,sometimes it produce a IllegalStateException, but sometimes not.

    java.lang.IllegalStateException: You need to init matrix before work!
                            at com.cleveroad.adaptivetablelayout.AdaptiveTableManager.checkForInit(AdaptiveTableManager.java:66)
                            at com.cleveroad.adaptivetablelayout.AdaptiveTableManager.getColumnByXWithShift(AdaptiveTableManager.java:226)
                            at com.cleveroad.adaptivetablelayout.AdaptiveTableLayout.addViewHolders(AdaptiveTableLayout.java:790)
                            at com.cleveroad.adaptivetablelayout.AdaptiveTableLayout.notifyDataSetChanged(AdaptiveTableLayout.java:1519)
                            at com.alphagao.youda.ui.activity.StadiumActivity$3.run(StadiumActivity.java:276)
    
    opened by gyqsophila 2
  • Scroll flicker when content does not fill the screen

    Scroll flicker when content does not fill the screen

    I construct an adapter with small views that do not fill the entire width or height of the screen. When I try to scroll now, the content flickers between the top and bottom of the AdaptiveTableLayout. When I make the cells large enough everything is fine, though.

    opened by mruijzendaal 2
  • notifyDataSetChanged() do not call onBindLeftTopHeaderViewHolder but does to every other header

    notifyDataSetChanged() do not call onBindLeftTopHeaderViewHolder but does to every other header

    I am implementing a sort action when clicking on any column header. What also concerns top left corner header.

    Table is sorted by top left corner header by default. If user clicks on any other column header, table becomes sorted by that column. I maintain the visibility of a drawable on headers to show if it is sorting ascending or descending

    When playing between column headers everything works correctly. This is, if I click on any column header onBindHeaderColumnViewHolder is called and this drawable is removed from previous column and turns visible on new column header. But drawable is never removed from top left corner header as onBindLeftTopHeaderViewHolder is never called too.

    opened by vyguera 1
  • AdaptiveTableLayout crashes when loading an empty CSV

    AdaptiveTableLayout crashes when loading an empty CSV

    I get following exception when trying to use AdaptiveTableLayout when loading an adapter with no data. Same happens on sample if loaded an empty CSV:

    java.lang.NegativeArraySizeException: -1 at com.cleveroad.adaptivetablelayout.AdaptiveTableManager.init(AdaptiveTableManager.java:59) at com.cleveroad.adaptivetablelayout.AdaptiveTableLayout.initItems(AdaptiveTableLayout.java:253) at com.cleveroad.adaptivetablelayout.AdaptiveTableLayout.setAdapter(AdaptiveTableLayout.java:312) at com.cleveroad.sample.ui.TableLayoutFragment.initAdapter(TableLayoutFragment.java:316) at com.cleveroad.sample.ui.TableLayoutFragment.onCreateView(TableLayoutFragment.java:134)

    opened by vyguera 1
  • Refactor to AndroidX

    Refactor to AndroidX

    AdaptiveTableLayout is still using Android support libraries. This blocks issue #42 among others. This is the library can't be updated to newer API Levels.

    To solve this a refactor to Android X is required.

    opened by vyguera 1
  • AdaptiveTableLayout unnecesary sets allowBackup attribute

    AdaptiveTableLayout unnecesary sets allowBackup attribute

    Setting allowBackup attribute on my own application element at AndroidManifest makes an error with AdaptiveTableLayout, as its library Manifest already sets its own value for this attribute. Therefore is required to also set tools:replace="android:allowBackup in order to replace this value.

    Error:Attribute application@allowBackup value=(false) from AndroidManifest.xml:10:9-36 is also present at [com.cleveroad:adaptivetablelayout:1.2.1] AndroidManifest.xml:12:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:8:5-24:19 to override.
    
    See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
    
    opened by vyguera 1
  • Fixed row and column?

    Fixed row and column?

    Hi, Thanks a lot for this library. Is it possible to fix a certain column at the top where the header is or below it so it doesn't leave screen while scrolling down? Also, same goes for row, whereas, I would like to pin certain column there instead of the row header? @yarovoiag-cr @ilchenko-peter

    question 
    opened by JakeWoki 1
  • read from excel file

    read from excel file

    can u help me to read from xls file and display using your adaptive able by the way i can get cellule by cellule from my excel using Jecxel API (student project mobile application in android studio still beginner)

    question 
    opened by redlaam 1
  • Crash while switching rows using the adapter which subcalsses BaseDataAdaptiveTableLayoutAdapter

    Crash while switching rows using the adapter which subcalsses BaseDataAdaptiveTableLayoutAdapter

    My code is as follows.

    static class MyAdapter extends
            BaseDataAdaptiveTableLayoutAdapter<MyAdapter.ViewHolder> {
        @Override
        protected Object[][] getItems() {
            return cells;
        }
    
        @Override
        public void onBindViewHolder(ViewHolder viewHolder, int row, int column) {
            viewHolder.text.setText(cells[row][column]);
        }
    
        // other codes...
    }
    

    It works well when dragging is not involved. When switching columns, the app doesn't crash. But if rows are switched, it crashes!

    I found the following code in the library:

    void switchTwoRows(int rowIndex, int rowToIndex) {
        for (int i = 0; i < getItems().length; i++) {
            Object cellData = getItems()[rowToIndex][i];
            getItems()[rowToIndex][i] = getItems()[rowIndex][i];
            getItems()[rowIndex][i] = cellData;
        }
    }
    

    I think getItems().length should not be used here. It just gives number of rows of my data... It should be something like getColumnCount() - 1. Is it my misunderstanding? Any comment is appreciate.

    bug 
    opened by hao33782 1
  • Adaptive Table responses slow after notifyDataSetChanged() action set more than 3 times

    Adaptive Table responses slow after notifyDataSetChanged() action set more than 3 times

    While I update the data and refresh data using notifyDataSetChanged() action more than three times. Also I changed the size of row and column it works slow. Would you please help here.

    opened by AmanDhindsa1989 0
  • Getting IllegalStateException; Please Help

    Getting IllegalStateException; Please Help

    I am trying to load data from my server. I am fetching the data from the server and feeding it to the table, but it takes around 260ms to get server response and in the meantime if I try to touch and move my finger in the empty section in the table it shows this exception.

    Getting error as AndroidRuntime: FATAL EXCEPTION: main Process: com.stocksarena.algofox, PID: 11552 java.lang.IllegalStateException: You need to init matrix before work!

    opened by ghoshavirup0 0
  • Not able to click on view

    Not able to click on view

    Kindly check my code below:

    I am not able to find click listener

    +++++++++++++++++++

    private static class TestHeaderColumnViewHolder extends ViewHolderImpl {

        TextView tvTitle, tvAddToCartCompare;
        ImageView ivProduct, ivRemove;
    
    
        private TestHeaderColumnViewHolder(@NonNull View itemView) {
            super(itemView);
            tvTitle = itemView.findViewById(R.id.tvTitle);
            tvAddToCartCompare = itemView.findViewById(R.id.tvAddToCartCompare);
            ivProduct = itemView.findViewById(R.id.ivProduct);
            ivRemove = itemView.findViewById(R.id.ivRemove);
    
        }
    
        public void bind(TestHeaderColumnViewHolder vh, int column) {
            tvTitle.setText(arrayListOfItem.get(column - 1).getProduct_name());
            Glide.with(getItemView().getContext()).load(arrayListOfItem.get(column - 1).getProduct_image()).into(ivProduct);
            **tvAddToCartCompare.setOnClickListener(view -> {
    
    
                    assert addtocartClickListner != null;
                    addtocartClickListner.addToCart(view, arrayListOfItem.get(column - 1), arrayListOfItem.get(column - 1).get_id());
    
            });**
            **ivRemove.setOnClickListener(view -> {
    
                    assert removeCompareClickLisner != null;
                    removeCompareClickLisner.removeFromCart(view, arrayListOfItem.get(column - 1), arrayListOfItem.get(column - 1).get_id());
    
            });**
        }
    }
    

    +++++++++++++++++++

    Kindly help me with solution

    Thanks

    opened by jigar1211 3
  • How to write backend code for Travel portal ?

    How to write backend code for Travel portal ?

    opened by deepakpandey23 0
Owner
Cleveroad
Professional web and mobile development company. Full-cycle IT development!
Cleveroad
Excel utility for Java to read and write data in declarative way.

Data Excel Exporter A Java wrapper using Apache POI to read and write Excel file in declarative fashion. Installation ExcelUtil is using Apache POI ve

null 27 Oct 16, 2022
A plugin to help you easily edit Swagger and OpenAPI specification files inside IntelliJ IDEA

Swagger Plugin Swagger Plugin makes it easy to edit Swagger and OpenAPI specification files inside IntelliJ IDEA. You can find it on JetBrains' plugin

Zalando SE 1.1k Dec 15, 2022
This is a Velocity plugin that makes it possible to host a modern forge server behind a Velocity proxy!

Ambassador This is a Velocity plugin that makes it possible to host a modern forge server behind a Velocity proxy! Unlike other solutions, this plugin

Adrian Bergqvist 31 Dec 28, 2022
UniFi Proxy makes it possible to integrate third-party hardware into UniFi Protect

UniFi Proxy UniFi Proxy makes it possible to integrate third-party hardware into UniFi Protect. For testing purposes only, it is recommended to purcha

Jan Heil 8 Dec 27, 2022
Generate and read big Excel files quickly

fastexcel fastexcel-writer There are not many alternatives when you have to generate xlsx Excel workbooks in Java. The most popular one (Apache POI) i

Cegid Conciliator 449 Jan 1, 2023
Program that allows employees to clock in and clock out of work. Employees who are managers can add, edit and delete employees and shifts from the database.

Clock-In-Clock-Out-System Created by: Kennedy Janto, Taylor Vandenberg, Duc Nguyen, Alex Gomez, Janista Gitbumrungsin This is a semester long project

null 6 Nov 5, 2022
A library to create, read and validate ZUGFeRD compliant invoices. Available for Java and .NET

Konik ZUGFeRD Library Is an easy to use open source implementation of the ZUGFeRD data model including various enhancements. Features Easy and underst

Konik 42 Dec 20, 2022
We have created a techblog website where a user can post technical posts and edit and update the post accordingly.

TechBlog Introduction - In this project we have created a technical blog website where we have provided functionalities such as 1) SignUp 2) Login 3)

Riya Vijay Vishwakarma 2 Jan 23, 2022
A small companion library to Mixin, designed to help you write your Mixins in a more expressive and compatible way.

MixinExtras A small companion library to Mixin, designed to help you write your Mixins in a more expressive and compatible way. More information about

null 97 Jan 7, 2023
A singular file to protect as many Minecraft servers and clients as possible from the Log4j exploit (CVE-2021-44228).

MC-Log4J-Patcher The goal of this project is to provide Minecraft players, and server owners, peace of mind in regards to the recently discovered Log4

Koupa Taylor 4 Jan 4, 2022
Bank Statement Analyzer Application that currently runs in terminal with the commands: javac Application.java java Application [file-name].csv GUI coming soon...

Bank Statement Analyzer Application that currently runs in terminal with the commands: javac Application.java java Application [file-name].csv GUI coming soon...

Hayden Hanson 0 May 21, 2022
Flutter plugin for notification read & reply

Reflex Flutter plugin for notification read & reply. Compatibility ✅ Android ❌ iOS (active issue: iOS support for reflex) Show some ❤️ and ⭐ the repo

Devs On Flutter 14 Dec 20, 2022
The shortest possible maven template / quickstarter for Java 16

The shortest possible Java 16 maven quickstarter The shortest possible Apache Maven template for Java 16 usage git clone https://github.com/AdamBien/j

Adam Bien 6 Nov 8, 2021
Harvest your animals in the most cursed way possible.

Reaping Harvest your animals in the most cursed way possible. By using the Reaper you can harvest food from animals as if you had killed them, but wit

Jam Core 4 Oct 23, 2022
An Auction website. Users can Put up items for sale, bid on currently active auctions and write reviews for items that they have won in the auctions.

Auction-Project An Auction website. Users can Put up items for sale, bid on currently active auctions and write reviews for items that they have won i

Nika Salia 3 Sep 7, 2021
Write enterprise Bitcoin applications with Spring Boot.

Write enterprise Bitcoin applications with Spring Boot. Starter projects with multiple Bitcoin related modules that you can include in your application Google Colab

DE MINING 3 Dec 11, 2022
a proxy for http & https ,write by java,no dependences for other tech

申明 本项目只是作者记录和分享Java网络编程学习心得,请勿用于非法用途,否则后果自负! 原理介绍博客: https://blog.csdn.net/wang382758656/article/details/123098032 https://juejin.cn/post/706921880022

Sand 58 May 3, 2022
@FengG0d 's Client, but he leave, I am the new owner, but, I don't know how to write Java, I need your help.

IKUN Client Help me I need help! The original Author was leave, but I don't know how to write a good client, I need Your help! to make a good IKun Cli

Chenken520 2 Sep 4, 2022
This template makes it easy to organize FTC code and allows for the Autonomous and TeleOp periods to share code.

FTC Code Organizer This template created by team 19458 Equilibrium.exe makes it easy to keep your code organized and allows the Autonomous and TeleOp

FTC 19458 Equilibrium.exe 5 Nov 10, 2022