List of usage examples for android.widget ExpandableListView collapseGroup
public boolean collapseGroup(int groupPos)
From source file:Main.java
public static void collapseAll(ExpandableListView expandableListView) { int groupCount = expandableListView.getAdapter().getCount(); for (int i = 0; i < groupCount; i++) { expandableListView.collapseGroup(i); }//from w w w. ja v a 2 s .c om }
From source file:Main.java
public static void collapseAllExcept(ExpandableListView expandableListView, int index) { int groupCount = expandableListView.getAdapter().getCount(); for (int i = 0; i < groupCount; i++) { if (index != i) { expandableListView.collapseGroup(i); }//from w ww. java 2 s .c o m } }
From source file:com.mycodehurts.rapidmath.app.NavigationDrawerFragment.java
@Override public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) { if (i == 1) { return false; } else {//from ww w .j av a2s .c o m expandableListView.collapseGroup(1); selectItem(i); return true; } }
From source file:dev.drsoran.moloko.fragments.TaskListsFragment.java
@Override public void onGroupIndicatorClicked(View groupView) { final ExpandableListView listView = getExpandableListView(); final int pos = ExpandableListView .getPackedPositionGroup(listView.getExpandableListPosition(listView.getPositionForView(groupView))); if (listView.isGroupExpanded(pos)) listView.collapseGroup(pos); else//from ww w . j a v a2s. c o m listView.expandGroup(pos); }
From source file:com.vrem.wifianalyzer.wifi.accesspoint.AccessPointsAdapterGroup.java
void update(@NonNull List<WiFiDetail> wiFiDetails, ExpandableListView expandableListView) { updateGroupBy();//from ww w . ja v a 2 s . c o m if (isGroupExpandable() && expandableListView != null) { int groupCount = expandableListView.getExpandableListAdapter().getGroupCount(); for (int i = 0; i < groupCount; i++) { WiFiDetail wiFiDetail = getWiFiDetail(wiFiDetails, i); if (expanded.contains(getGroupExpandKey(wiFiDetail))) { expandableListView.expandGroup(i); } else { expandableListView.collapseGroup(i); } } } }
From source file:com.syncedsynapse.kore2.ui.TVShowEpisodeListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); seasonsEpisodesListView.setEmptyView(emptyView); seasonsEpisodesListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override//from w w w . j ava 2 s. c o m public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); } else { parent.expandGroup(groupPosition); } return true; } }); seasonsEpisodesListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // Get the movie id from the tag EpisodeViewHolder tag = (EpisodeViewHolder) v.getTag(); // Notify the activity listenerActivity.onEpisodeSelected(tvshowId, tag.episodeId); return true; } }); // Configure the adapter and start the loader adapter = new SeasonsEpisodesAdapter(getActivity()); getLoaderManager().initLoader(LOADER_SEASONS, null, this); seasonsEpisodesListView.setAdapter(adapter); setHasOptionsMenu(true); }
From source file:org.xbmc.kore.ui.TVShowEpisodeListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); seasonsEpisodesListView.setEmptyView(emptyView); seasonsEpisodesListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override// w ww . java 2s . com public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); groupsExpanded.remove(groupPosition); } else { parent.expandGroup(groupPosition); groupsExpanded.put(groupPosition, true); } return true; } }); seasonsEpisodesListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // Get the movie id from the tag EpisodeViewHolder tag = (EpisodeViewHolder) v.getTag(); // Notify the activity listenerActivity.onEpisodeSelected(tvshowId, tag.episodeId); return true; } }); setHasOptionsMenu(true); if (savedInstanceState != null) { listPosition = savedInstanceState.getInt(BUNDLE_SAVEDINSTANCE_LISTPOSITION, 0); itemPosition = savedInstanceState.getInt(BUNDLE_SAVEDINSTANCE_ITEMPOSITION, 0); groupsExpanded = (HashMap) savedInstanceState.getSerializable(BUNDLE_SAVEDINSTANCE_GROUPSEXPANDED); isReturning = true; } initLoader(); }
From source file:com.emuneee.nctrafficcams.ui.activities.MainActivity.java
private void selectGroup(ExpandableListView parent, int groupPosition, boolean simulateChildClick) { QueryType queryType = null;//from www. j a va 2s . c o m String subTitle = null; switch (groupPosition) { case DrawerListAdapter.ALL_GROUP: // selected all group item queryType = new QueryType(QueryMode.All); subTitle = (String) mDrawerAdapter.getGroup(groupPosition); break; case DrawerListAdapter.FAVORITES_GROUP: // selected favorite group item queryType = new QueryType(QueryMode.Favorites); subTitle = (String) mDrawerAdapter.getGroup(groupPosition); break; case DrawerListAdapter.CITIES_GROUP: case DrawerListAdapter.ROUTES_GROUP: // selected routes group item if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); } else { parent.expandGroup(groupPosition); } setCurrentGroup(groupPosition); if (simulateChildClick) { selectCamera(getCurrentChild()); } break; case DrawerListAdapter.NEAR_ME_GROUP: // selected favorite group item queryType = new QueryType(QueryMode.NearMe); subTitle = (String) mDrawerAdapter.getGroup(groupPosition); break; } if (queryType != null) { mFragment.getCameras(queryType); mDrawerLayout.closeDrawer(mDrawerList); mActionBar.setSubtitle(subTitle); setCurrentGroup(groupPosition); } }
From source file:org.jsharkey.grouphome.LauncherActivity.java
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); Intent homeIntent = new Intent(); homeIntent.setClassName("com.android.launcher", "com.android.launcher.Launcher"); menu.add("Default home").setIcon(R.drawable.ic_menu_home).setIntent(homeIntent); menu.add("Search").setIcon(android.R.drawable.ic_menu_search); force = menu.add("Expand all").setIcon(android.R.drawable.ic_menu_share) .setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { ExpandableListView listView = LauncherActivity.this.getExpandableListView(); ExpandableListAdapter adapter = LauncherActivity.this.getExpandableListAdapter(); switch (expandState) { case STATE_UNKNOWN: case STATE_ALL_COLLAP: // when unknown or collapsed, we force all open for (int i = 0; i < adapter.getGroupCount(); i++) listView.expandGroup(i); expandState = STATE_ALL_EXPAND; break; case STATE_ALL_EXPAND: // when expanded, we force all closed for (int i = 0; i < adapter.getGroupCount(); i++) listView.collapseGroup(i); expandState = STATE_ALL_COLLAP; break; }//from w ww. j a v a 2 s.com return true; } }); menu.add("Refresh").setIcon(R.drawable.ic_menu_refresh) .setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // clear any database mappings and local json cache // TODO: clear local json cache (when implemented) appdb.deleteAllMappings(); setListAdapter(null); new ProcessTask().execute(); return true; } }); Intent settingsIntent = new Intent(android.provider.Settings.ACTION_SETTINGS); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); menu.add("Settings").setIcon(android.R.drawable.ic_menu_preferences).setIntent(settingsIntent); return true; }
From source file:com.benefit.buy.library.http.query.AbstractAQuery.java
public T expand(int position, boolean expand) { if (view instanceof ExpandableListView) { ExpandableListView elv = (ExpandableListView) view; if (expand) { elv.expandGroup(position);//from w ww . j a va 2 s. c o m } else { elv.collapseGroup(position); } } return self(); }