use of android.widget.ExpandableListView 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.ExpandableListView in project SmartAndroidSource by jaychou2012.
the class AbstractAQuery method adapter.
/**
* Set the adapter of an ExpandableListView.
*
* @param adapter adapter
* @return self
*/
public T adapter(ExpandableListAdapter adapter) {
if (view instanceof ExpandableListView) {
ExpandableListView av = (ExpandableListView) view;
av.setAdapter(adapter);
}
return self();
}
use of android.widget.ExpandableListView in project MVCHelper by LuckyJayce.
the class ListViewHandler method handleSetAdapter.
@Override
public boolean handleSetAdapter(View contentView, Object viewAdapter, ILoadMoreView loadMoreView, OnClickListener onClickLoadMoreListener) {
final ListView listView = (ListView) contentView;
boolean hasInit = false;
if (loadMoreView != null) {
loadMoreView.init(new ListViewFootViewAdder(listView), onClickLoadMoreListener);
hasInit = true;
}
if (listView instanceof ExpandableListView) {
((ExpandableListView) listView).setAdapter((ExpandableListAdapter) viewAdapter);
} else {
listView.setAdapter((ListAdapter) viewAdapter);
}
return hasInit;
}
use of android.widget.ExpandableListView in project AndroidDevMetrics by frogermcs.
the class ActivitiesMetricsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.adm_fragment_activities_metrics, container, false);
lvActivitiesMetrics = (ExpandableListView) view.findViewById(R.id.lvActivitiesMetrics);
tvEmpty = (TextView) view.findViewById(R.id.tvEmpty);
return view;
}
use of android.widget.ExpandableListView in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
InputStream raw = getResources().openRawResource(R.raw.sample);
BufferedReader in = new BufferedReader(new InputStreamReader(raw));
String str;
StringBuffer buf = new StringBuffer();
try {
while ((str = in.readLine()) != null) {
buf.append(str);
buf.append('\n');
}
in.close();
JSONObject model = new JSONObject(buf.toString());
ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv);
adapter = new JSONExpandableListAdapter(getLayoutInflater(), model);
elv.setAdapter(adapter);
elv.setOnChildClickListener(this);
elv.setOnGroupClickListener(this);
elv.setOnGroupExpandListener(this);
elv.setOnGroupCollapseListener(this);
} catch (Exception e) {
Log.e(getClass().getName(), "Exception reading JSON", e);
}
}
Aggregations