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
Command-line tool to count per-package methods in Android .dex files

dex-method-counts Simple tool to output per-package method counts in an Android DEX executable grouped by package, to aid in getting under the 65,536

Mihai Parparita 2.6k Nov 25, 2022
Simple library to generate and view PDF in Android

PDFCreatorAndroid Simple library to generate and view PDF in Android A simple library to create and view PDF with zero dependency Or native code. Add

Tej Pratap Singh 234 Dec 11, 2022
A library which will save you a lot of time from writing the same intent creation code. it consist of many intent creation codes like Share, Contacts, Email and etc, which you can easily use.

Android-Intent-Library A library which will save you a lot of time from writing the same intent creation code. it consist of many intent creation code

Next 67 Aug 24, 2022
Android Material Design Theme UI and Tool Library. Support: 4.0.3~O

GitHub OSChina 中文 English Genius-Android Genius-Android: by Material Design style and some commonly used packages. Starting in 2015, The divided into

Qiujuer 2.3k Dec 27, 2022
Android USB host serial driver library for CDC, FTDI, Arduino and other devices.

usb-serial-for-android This is a driver library for communication with Arduinos and other USB serial hardware on Android, using the Android USB Host M

mike w 3.8k Dec 30, 2022
Android Library Finder

alfi Android Library Finder Search through thousands of android libraries that can help you scale your projects elegantly Usage Search for something a

César Ferreira 509 Dec 8, 2022
TaggerString is very light library which allows to build dynamic string resource in much more readable way.

TaggerString TaggerString is very light library which allows to build dynamic string resource in much more readable way. I guess that every Android de

polok 241 Jun 3, 2022
Remote script to create a maven compatible release of an android library (aar)

release-android-library ?? Deprecated ?? This script is deprecated in favour of: novoda/bintray-release Remote script to create a maven compatible rel

Paul Blundell 144 Dec 13, 2022
:inbox_tray: [Android Library] Hunt down all package information

Android library to hunt down package information. The library is built for simplicity and approachability. It not only eliminates most boilerplate cod

Nishant Srivastava 141 Nov 17, 2022
An android library that handles the closing of your app interactively.

Shutdown A library that handles the closing of your app interactively. Overview of Shutdown library Shutdown library handles the closing of your app i

Emmanuel Kehinde 56 Oct 5, 2022
The Kotlin fake data generator library!

Fakeit This library is a port of the Ruby gem Faker. It generates realistic fake data — like names, emails, dates, countries — for a variety of scenar

Moove It 517 Nov 20, 2022
Android Resource Manager application to manage and analysis your app resources with many features like image resize, Color, Dimens and code Analysis

Android Resource Manager application to manage and analysis your app resources with many features like image resize, Color, Dimens and code Analysis

Amr Hesham 26 Nov 16, 2022
A tool to install components of the Android SDK into a Maven repository or repository manager to use with the Android Maven Plugin, Gradle and other tools.

Maven Android SDK Deployer Original author including numerous fixes and changes: Manfred Moser [email protected] at simpligility technologies i

simpligility 1.4k Dec 27, 2022
Enhance the adb shell using busybox, supporting vi、grep and awk etc. No need root.

super-adb 用busybox加持的功能更加强大的adb shell;不需要root。 使用方法 准备工作 安装 python,注意选择安装python 2.x 安装pexpect这个python库: pip install pexpect 下载super_adb,把它放到系统路径 cp su

weishu 273 Dec 7, 2022
A tool to install components of the Android SDK into a Maven repository or repository manager to use with the Android Maven Plugin, Gradle and other tools.

Maven Android SDK Deployer Original author including numerous fixes and changes: Manfred Moser [email protected] at simpligility technologies i

simpligility 1.4k Dec 27, 2022
Analytics Tools for Kotlin Multiplatform Mobile iOS and android

Index Features Example Introduce Architecture Installation Configure Using Screen Mapper Initialization Implementation Delegate Parameters ATEventPara

LINE 16 Dec 5, 2022