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!");
}
}
}
}
}
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();
}
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!");
}
}
}
}
}
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);
}
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);
}
}
}
}
Aggregations