Search in sources :

Example 1 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project SmartAndroidSource by jaychou2012.

the class Common method onScrollStateChanged.

private void onScrollStateChanged(ExpandableListView elv, int scrollState) {
    elv.setTag(AQuery.TAG_NUM, scrollState);
    if (scrollState == SCROLL_STATE_IDLE) {
        int first = elv.getFirstVisiblePosition();
        int last = elv.getLastVisiblePosition();
        int count = last - first;
        ExpandableListAdapter ela = elv.getExpandableListAdapter();
        for (int i = 0; i <= count; i++) {
            long packed = elv.getExpandableListPosition(i + first);
            int group = ExpandableListView.getPackedPositionGroup(packed);
            int child = ExpandableListView.getPackedPositionChild(packed);
            if (group >= 0) {
                View convertView = elv.getChildAt(i);
                Long targetPacked = (Long) convertView.getTag(AQuery.TAG_NUM);
                if (targetPacked != null && targetPacked.longValue() == packed) {
                    if (child == -1) {
                        ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);
                    } else {
                        ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);
                    }
                    convertView.setTag(AQuery.TAG_NUM, null);
                } else {
                //AQUtility.debug("skip!");
                }
            }
        }
    }
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView)

Example 2 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project SmartAndroidSource by jaychou2012.

the class AbstractAQuery method expand.

public T expand(boolean expand) {
    if (view instanceof ExpandableListView) {
        ExpandableListView elv = (ExpandableListView) view;
        ExpandableListAdapter ela = elv.getExpandableListAdapter();
        if (ela != null) {
            int count = ela.getGroupCount();
            for (int i = 0; i < count; i++) {
                if (expand) {
                    elv.expandGroup(i);
                } else {
                    elv.collapseGroup(i);
                }
            }
        }
    }
    return self();
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) ExpandableListView(android.widget.ExpandableListView) Paint(android.graphics.Paint)

Example 3 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project androidquery by androidquery.

the class Common method onScrollStateChanged.

private void onScrollStateChanged(ExpandableListView elv, int scrollState) {
    elv.setTag(AQuery.TAG_NUM, scrollState);
    if (scrollState == SCROLL_STATE_IDLE) {
        int first = elv.getFirstVisiblePosition();
        int last = elv.getLastVisiblePosition();
        int count = last - first;
        ExpandableListAdapter ela = elv.getExpandableListAdapter();
        for (int i = 0; i <= count; i++) {
            long packed = elv.getExpandableListPosition(i + first);
            int group = ExpandableListView.getPackedPositionGroup(packed);
            int child = ExpandableListView.getPackedPositionChild(packed);
            if (group >= 0) {
                View convertView = elv.getChildAt(i);
                Long targetPacked = (Long) convertView.getTag(AQuery.TAG_NUM);
                if (targetPacked != null && targetPacked.longValue() == packed) {
                    if (child == -1) {
                        ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);
                    } else {
                        ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);
                    }
                    convertView.setTag(AQuery.TAG_NUM, null);
                } else {
                // AQUtility.debug("skip!");
                }
            }
        }
    }
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView)

Example 4 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project Thrift-box by Sash0k.

the class ExpandableListFragment method ensureList.

private void ensureList() {
    if (mExpandableList != null) {
        return;
    }
    View root = getView();
    if (root == null) {
        throw new IllegalStateException("Content view not yet created");
    }
    if (root instanceof ExpandableListView) {
        mExpandableList = (ExpandableListView) root;
    } else {
        mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID);
        if (mStandardEmptyView == null) {
            mEmptyView = root.findViewById(android.R.id.empty);
        } else {
            mStandardEmptyView.setVisibility(View.GONE);
        }
        mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID);
        mExpandableListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID);
        View rawExpandableListView = root.findViewById(android.R.id.list);
        if (!(rawExpandableListView instanceof ExpandableListView)) {
            if (rawExpandableListView == null) {
                throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
            }
            throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class");
        }
        mExpandableList = (ExpandableListView) rawExpandableListView;
        if (mEmptyView != null) {
            mExpandableList.setEmptyView(mEmptyView);
        } else if (mEmptyText != null) {
            mStandardEmptyView.setText(mEmptyText);
            mExpandableList.setEmptyView(mStandardEmptyView);
        }
    }
    mExpandableListShown = true;
    mExpandableList.setOnItemClickListener(mOnClickListener);
    // add invisible indicator
    mExpandableList.setGroupIndicator(getResources().getDrawable(R.drawable.expandable_list_icon_selector));
    if (mAdapter != null) {
        ExpandableListAdapter adapter = mAdapter;
        mAdapter = null;
        setListAdapter(adapter);
    } else {
        // have our data right away and start with the progress indicator.
        if (mProgressContainer != null) {
            setListShown(false, false);
        }
    }
    mHandler.post(mRequestFocus);
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Example 5 with ExpandableListAdapter

use of android.widget.ExpandableListAdapter in project AnExplorer by 1hakr.

the class RootsFragment method restoreExpandedState.

private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        ExpandableListAdapter adapter = mAdapter;
        if (adapter != null) {
            for (int i = 0; i < adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id))
                    list.expandGroup(i);
            }
        }
    }
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) ExpandableListView(android.widget.ExpandableListView)

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