Here are the examples of the java api class android.widget.ExpandableListAdapter taken from open source projects.
1. BookCatalogueClassic#collapseAll()
Project: Book-Catalogue
File: BookCatalogueClassic.java
File: BookCatalogueClassic.java
/** * Collapse all Author Groups * * @param clearCurrent - Also clear the currentGroup ArrayList */ public void collapseAll(boolean clearCurrent) { // there is no current group anymore ExpandableListView view = this.getExpandableListView(); ExpandableListAdapter ad = view.getExpandableListAdapter(); int numAuthors = ad.getGroupCount(); int i = 0; while (i < numAuthors) { view.collapseGroup(i); //if (!expand) { // break; //} i++; } if (clearCurrent) { currentGroup = new ArrayList<Integer>(); } collapsed = true; }
2. BookCatalogueClassic#expandAll()
Project: Book-Catalogue
File: BookCatalogueClassic.java
File: BookCatalogueClassic.java
/** * Expand all Groups */ public void expandAll() { ExpandableListView view = this.getExpandableListView(); ExpandableListAdapter ad = view.getExpandableListAdapter(); int numAuthors = ad.getGroupCount(); currentGroup = new ArrayList<Integer>(); int i = 0; while (i < numAuthors) { adjustCurrentGroup(i, 1, false, false); view.expandGroup(i); i++; } collapsed = false; }
3. ExpandableListConnector#isEmpty()
Project: HoloEverywhere
File: ExpandableListConnector.java
File: ExpandableListConnector.java
@Override public boolean isEmpty() { ExpandableListAdapter adapter = getAdapter(); return adapter != null ? adapter.isEmpty() : true; }
4. ExpandableListConnector#getFilter()
Project: HoloEverywhere
File: ExpandableListConnector.java
File: ExpandableListConnector.java
@Override public Filter getFilter() { ExpandableListAdapter adapter = getAdapter(); if (adapter instanceof Filterable) { return ((Filterable) adapter).getFilter(); } else { return null; } }
5. ExpandableListConnector#findGroupPosition()
Project: HoloEverywhere
File: ExpandableListConnector.java
File: ExpandableListConnector.java
int findGroupPosition(long groupIdToMatch, int seedGroupPosition) { int count = mExpandableListAdapter.getGroupCount(); if (count == 0) { return AdapterView.INVALID_POSITION; } if (groupIdToMatch == AdapterView.INVALID_ROW_ID) { return AdapterView.INVALID_POSITION; } seedGroupPosition = Math.max(0, seedGroupPosition); seedGroupPosition = Math.min(count - 1, seedGroupPosition); long endTime = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS; long rowId; int first = seedGroupPosition; int last = seedGroupPosition; boolean next = false; boolean hitFirst; boolean hitLast; ExpandableListAdapter adapter = getAdapter(); if (adapter == null) { return AdapterView.INVALID_POSITION; } while (SystemClock.uptimeMillis() <= endTime) { rowId = adapter.getGroupId(seedGroupPosition); if (rowId == groupIdToMatch) { return seedGroupPosition; } hitLast = last == count - 1; hitFirst = first == 0; if (hitLast && hitFirst) { break; } if (hitFirst || next && !hitLast) { last++; seedGroupPosition = last; next = false; } else if (hitLast || !next && !hitFirst) { first--; seedGroupPosition = first; next = true; } } return AdapterView.INVALID_POSITION; }
6. ExpandableListViewAssert#hasExpandableListAdapter()
Project: assertj-android
File: ExpandableListViewAssert.java
File: ExpandableListViewAssert.java
public ExpandableListViewAssert hasExpandableListAdapter(ExpandableListAdapter adapter) { isNotNull(); ExpandableListAdapter actualAdapter = actual.getExpandableListAdapter(); // assertThat(actualAdapter).overridingErrorMessage("Expected expandable list adapter <%s> but was <%s>.", adapter, // actualAdapter).isSameAs(adapter); return this; }
7. MainActivity#initViews()
Project: android-intents
File: MainActivity.java
File: MainActivity.java
private void initViews(List<Group> groups) { ExpandableListAdapter adapter = new ItemsAdapter(this, groups); setListAdapter(adapter); }