Search in sources :

Example 11 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)

Aggregations

ExpandableListAdapter (android.widget.ExpandableListAdapter)11 ExpandableListView (android.widget.ExpandableListView)8 View (android.view.View)4 AdapterView (android.widget.AdapterView)3 Paint (android.graphics.Paint)2 AbsListView (android.widget.AbsListView)2 TextView (android.widget.TextView)2 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 AlertDialog (android.support.v7.app.AlertDialog)1 ListAdapter (android.widget.ListAdapter)1 SectionIndexer (android.widget.SectionIndexer)1 WrapperListAdapter (android.widget.WrapperListAdapter)1 ExpandableBidListAdapter (com.cmput301w18t05.taskzilla.ExpandableBidListAdapter)1 User (com.cmput301w18t05.taskzilla.User)1 ViewTaskController (com.cmput301w18t05.taskzilla.controller.ViewTaskController)1 com.cmput301w18t05.taskzilla.currentUser (com.cmput301w18t05.taskzilla.currentUser)1 GetBidsByTaskIdRequest (com.cmput301w18t05.taskzilla.request.command.GetBidsByTaskIdRequest)1 ArrayList (java.util.ArrayList)1