Search in sources :

Example 6 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project HoloEverywhere by Prototik.

the class ExpandableListConnector method findGroupPosition.

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;
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter)

Example 7 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project assertj-android by square.

the class ExpandableListViewAssert method hasExpandableListAdapter.

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;
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter)

Aggregations

ExpandableListAdapter (android.widget.ExpandableListAdapter)7 ExpandableListView (android.widget.ExpandableListView)4 Paint (android.graphics.Paint)2 View (android.view.View)2 AbsListView (android.widget.AbsListView)2 AdapterView (android.widget.AdapterView)2 ListAdapter (android.widget.ListAdapter)1 SectionIndexer (android.widget.SectionIndexer)1 WrapperListAdapter (android.widget.WrapperListAdapter)1