Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amalh/expandit

Custom [expandable] listview library for Android
https://github.com/amalh/expandit

android android-library android-listview custom-listview expandablelistview

Last synced: about 5 hours ago
JSON representation

Custom [expandable] listview library for Android

Awesome Lists containing this project

README

        

# Expandit
Expandit is a library for Android that offers a highly customizable expandable listview. You can even customize if "Expandit" can be expanded or not !

## Demo

* ### Sample app
This video showcases some of Expandit features ( using different list item description view, showing the list as a dialog or in-activity, making the list unexpandable and more ) :



* ### Screenshots:
The following section presents a screenshot for each code snippet.

## QuickStart

Including Expandit into the build.gradle file:
```Java
implementation 'com.github.AmalH:expandit:1.0.0'
```
Using Expandit:
* ### Using Expandit as a dialog

* Example 1
```Java
ArrayList listItemsTitles = new ArrayList<>(Arrays.asList("Overview","Getting started","Basics","Classes and objects","Functions and lambdas"
,"Others","Java Interop","Javascript"));
ArrayList defaultListItemsDetails = new ArrayList<>(Arrays.asList("description of item 1","description of item 2","description of item 3","description of item 4","description of item 5","description of item 6","description of item 7","description of item 8"));
ArrayList listItemsIcons = new ArrayList< (Arrays.asList(R.drawable.ic_overview,R.drawable.ic_start,R.drawable.ic_basics,R.drawable.ic_classesobjects,R.drawable.ic_functions,R.drawable.ic_others,R.drawable.ic_java,R.drawable.ic_javascript));
ArrayList expandedItems1 = new ArrayList<>(Arrays.asList("chapter 1", "chapter 2","chapter 2"));
ArrayList expandedItems2 = new ArrayList<>(Arrays.asList("1st chapter", "2nd chapter","3d chapter"));
HashMap listData = new HashMap(){
{
put(0,expandedItems1);
put(1,expandedItems2);
put(2,expandedItems3);
put(3,expandedItems4);
put(4,expandedItems5);
put(5,expandedItems6);
put(6,expandedItems7);
put(7,expandedItems8);
}
};

new ExpanditDialogList(MainActivity.this,"custom item details2",listItemsTitles2,listData,listItemsIcons2,listMenuId,R.layout.custom_item_details_view2)).show()
```




* Example 2
```Java
new ExpanditDialogList(MainActivity.this, "Kotlin courseslist",listItemsTitles,listData,listItemsIcons,listMenuId,defaultListItemsDetails)).show()

```





* Example 3
```Java
ExpanditDialogList myList = new ExpanditDialogList(MainActivity.this);
myList.setTitle("Non-expandable!");
myList.setListItemsTitles(listItemsTitles);
myList.setListItemsIcons(listItemsIcons);
//myList.setListItemMenu(defaultListMenu);
myList.show();
```


* ### Using Expandit as a list (in-activity)
* Example 1
```Java
addView(new ExpanditActivityList(MainActivity.this,"Kotlin courseslist",listItemsTitles,listData,listItemsIcons,listMenuId,defaultListItemsDetails));
.
OR
.
(findViewById(R.id.myList)).setAdapter(new ExpanditListAdapter(context,listItemsTitles,listData,listItemsIcons,listMenuId,defaultListItemsDetails))
```





* Example 2
```Java
addView(new ExpanditActivityList(MainActivity.this,"custom item details 1",listItemsTitles,listData,listItemsIcons,listMenuId,R.layout.custom_item_details_view));
.
OR
.
(findViewById(R.id.myList)).setAdapter(new ExpanditListAdapter(context,listItemsTitles,listData,listItemsIcons,listMenuId,customDetailsView))
```



## Getting help
If you spot a problem you can open an issue here, or you can tweet me at [@AmalHichrii](http://twitter.com/AmalHichrii).