use of android.widget.ExpandableListView in project android_frameworks_base by ParanoidAndroid.
the class ExpandableListActivity method onContentChanged.
/**
* Updates the screen state (current list and other views) when the
* content changes.
*
* @see Activity#onContentChanged()
*/
@Override
public void onContentChanged() {
super.onContentChanged();
View emptyView = findViewById(com.android.internal.R.id.empty);
mList = (ExpandableListView) findViewById(com.android.internal.R.id.list);
if (mList == null) {
throw new RuntimeException("Your content must have a ExpandableListView whose id attribute is " + "'android.R.id.list'");
}
if (emptyView != null) {
mList.setEmptyView(emptyView);
}
mList.setOnChildClickListener(this);
mList.setOnGroupExpandListener(this);
mList.setOnGroupCollapseListener(this);
if (mFinishedStart) {
setListAdapter(mAdapter);
}
mFinishedStart = true;
}
use of android.widget.ExpandableListView in project androidquery by androidquery.
the class Common method shouldDelay.
public static boolean shouldDelay(int groupPosition, int childPosition, View convertView, ViewGroup parent, String url) {
if (url == null || BitmapAjaxCallback.isMemoryCached(url)) {
return false;
}
AbsListView lv = (AbsListView) parent;
OnScrollListener sl = (OnScrollListener) parent.getTag(AQuery.TAG_SCROLL_LISTENER);
if (sl == null) {
sl = new Common();
lv.setOnScrollListener(sl);
parent.setTag(AQuery.TAG_SCROLL_LISTENER, sl);
}
Integer scrollState = (Integer) lv.getTag(AQuery.TAG_NUM);
if (scrollState == null || scrollState == OnScrollListener.SCROLL_STATE_IDLE || scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
return false;
}
long packed = childPosition;
if (parent instanceof ExpandableListView) {
packed = ExpandableListView.getPackedPositionForChild(groupPosition, childPosition);
}
convertView.setTag(AQuery.TAG_NUM, packed);
return true;
}
use of android.widget.ExpandableListView in project androidquery by androidquery.
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.ExpandableListView in project android_frameworks_base by DirtyUnicorns.
the class RenderSessionImpl method postInflateProcess.
/**
* Post process on a view hierarchy that was just inflated.
* <p/>
* At the moment this only supports TabHost: If {@link TabHost} is detected, look for the
* {@link TabWidget}, and the corresponding {@link FrameLayout} and make new tabs automatically
* based on the content of the {@link FrameLayout}.
* @param view the root view to process.
* @param layoutlibCallback callback to the project.
* @param skip the view and it's children are not processed.
*/
// For the use of Pair
@SuppressWarnings("deprecation")
private void postInflateProcess(View view, LayoutlibCallback layoutlibCallback, View skip) throws PostInflateException {
if (view == skip) {
return;
}
if (view instanceof TabHost) {
setupTabHost((TabHost) view, layoutlibCallback);
} else if (view instanceof QuickContactBadge) {
QuickContactBadge badge = (QuickContactBadge) view;
badge.setImageToDefault();
} else if (view instanceof AdapterView<?>) {
// get the view ID.
int id = view.getId();
BridgeContext context = getContext();
// get a ResourceReference from the integer ID.
ResourceReference listRef = context.resolveId(id);
if (listRef != null) {
SessionParams params = getParams();
AdapterBinding binding = params.getAdapterBindings().get(listRef);
// if there was no adapter binding, trying to get it from the call back.
if (binding == null) {
binding = layoutlibCallback.getAdapterBinding(listRef, context.getViewKey(view), view);
}
if (binding != null) {
if (view instanceof AbsListView) {
if ((binding.getFooterCount() > 0 || binding.getHeaderCount() > 0) && view instanceof ListView) {
ListView list = (ListView) view;
boolean skipCallbackParser = false;
int count = binding.getHeaderCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getHeaderAt(i), list, false, skipCallbackParser);
if (pair.getFirst() != null) {
list.addHeaderView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
count = binding.getFooterCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getFooterAt(i), list, false, skipCallbackParser);
if (pair.getFirst() != null) {
list.addFooterView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
}
if (view instanceof ExpandableListView) {
((ExpandableListView) view).setAdapter(new FakeExpandableAdapter(listRef, binding, layoutlibCallback));
} else {
((AbsListView) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
}
} else if (view instanceof AbsSpinner) {
((AbsSpinner) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
}
}
}
} else if (view instanceof ViewGroup) {
mInflater.postInflateProcess(view);
ViewGroup group = (ViewGroup) view;
final int count = group.getChildCount();
for (int c = 0; c < count; c++) {
View child = group.getChildAt(c);
postInflateProcess(child, layoutlibCallback, skip);
}
}
}
use of android.widget.ExpandableListView in project ETSMobile-Android2 by ApplETS.
the class EventsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_events, container, false);
expandableListView = (AnimatedExpandableListView) v.findViewById(R.id.expandable_list_view);
progressBar = (ProgressBar) v.findViewById(R.id.progress_bar);
progressBar.setProgress(0);
expandableListAdapter = new EvenementCommunauteAdapter(getActivity(), events, expandableListView);
expandableListView.setAdapter(expandableListAdapter);
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
// expansion/collapse.
if (expandableListView.isGroupExpanded(groupPosition)) {
expandableListView.collapseGroupWithAnimation(groupPosition);
} else {
expandableListView.expandGroupWithAnimation(groupPosition);
}
return true;
}
});
AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
return v;
}
Aggregations