### Install AdaptiveTableLayout Library via Gradle Source: https://github.com/cleveroad/adaptivetablelayout/blob/master/README.md Add the AdaptiveTableLayout library as a dependency in your Android project's `build.gradle` file to include it in your application. ```groovy dependencies { implementation "com.cleveroad:adaptivetablelayout:1.2.1" } ``` -------------------------------- ### Initialize and Configure AdaptiveTableLayout in Android Activity/Fragment Source: https://github.com/cleveroad/adaptivetablelayout/blob/master/README.md This snippet demonstrates how to initialize the AdaptiveTableLayout in an Android Activity or Fragment, set up an adapter (e.g., SampleLinkedTableAdapter), attach item click and long click listeners, and configure layout properties such as header fixation and solid row headers. It concludes with notifying the adapter of data changes. ```Groovy 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(); ``` -------------------------------- ### AdaptiveTableLayout Class API Reference Source: https://github.com/cleveroad/adaptivetablelayout/blob/master/README.md API documentation for the AdaptiveTableLayout class, detailing methods for querying and setting table properties such as header fixation, row header solidity, drag-and-drop enablement, and data adapter management. ```APIDOC // Return fixed headers mode boolean isHeaderFixed(); // Return solid row headers mode boolean isSolidRowHeader() // Return drag and drop mode boolean isDragAndAndDropEnabled() // 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) // 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) ``` -------------------------------- ### AdaptiveTableLayout Adapter Interfaces and Base Implementations Source: https://github.com/cleveroad/adaptivetablelayout/blob/master/README.md Overview of the core adapter interfaces and their base implementations for the AdaptiveTableLayout library. It details the characteristics and usage considerations for BaseDataAdaptiveTableLayoutAdapter (for light data, modifies original data) and LinkedAdaptiveTableAdapter (for heavy data, preserves original data via linked modifications). It also highlights methods for retrieving modifications from LinkedAdaptiveTableAdapter and important flags to check. ```APIDOC Interfaces: AdaptiveTableAdapter DataAdaptiveTableLayoutAdapter Base Adapters: BaseDataAdaptiveTableLayoutAdapter: Description: Simple adapter for light data. WARNING! On each row/column switch, original data will be changed. LinkedAdaptiveTableAdapter: Description: Adapter for heavy data. WARNING! This type of adapter doesn't change original data. It contains a matrix with changed items with links on it. Methods: AdaptiveTableLayout.getLinkedAdapterRowsModifications(): Retrieves modified rows from LinkedAdaptiveTableAdapter. AdaptiveTableLayout.getLinkedAdapterColumnsModifications(): Retrieves modified columns from LinkedAdaptiveTableAdapter. Considerations: AdaptiveTableLayout.isSolidRowHeader(): Check this flag. If false, ignore switching the first element in each row. Common Requirement: For both BaseDataAdaptiveTableLayoutAdapter and LinkedAdaptiveTableAdapter, all row/column widths, heights, and rows/columns count must be known before setting the adapter to AdaptiveTableLayout. ``` -------------------------------- ### Define AdaptiveTableLayout in Android XML Layout Source: https://github.com/cleveroad/adaptivetablelayout/blob/master/README.md This XML snippet illustrates how to declare an AdaptiveTableLayout in an Android layout file. It includes common attributes such as width, height, layout positioning relative to other views, cell margin, and flags for fixed headers, solid row headers, and enabling drag-and-drop functionality. ```XML ``` -------------------------------- ### Define AdaptiveTableLayout in XML Layout Source: https://github.com/cleveroad/adaptivetablelayout/blob/master/README.md Integrate the AdaptiveTableLayout view into your Android layout XML, configuring properties like cell margins, fixed headers, solid row headers, and drag-and-drop capabilities. ```XML ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.