Example usage for android.widget ExpandableListView expandGroup

List of usage examples for android.widget ExpandableListView expandGroup

Introduction

In this page you can find the example usage for android.widget ExpandableListView expandGroup.

Prototype

public boolean expandGroup(int groupPos) 

Source Link

Document

Expand a group in the grouped list view

Usage

From source file:Main.java

public static void expendAll(ExpandableListView expandableListView) {
    if (expandableListView == null || expandableListView.getAdapter() == null) {
        return;/*from w w w. j a v a2s .c o m*/
    }
    int groupCount = expandableListView.getAdapter().getCount();
    // System.out.println("+++++++++++++");
    // System.out.println(groupCount);
    for (int i = 0; i < groupCount; i++) {
        try {
            expandableListView.expandGroup(i);
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
}

From source file:in.andres.kandroid.ui.ProjectInactiveTasksFragment.java

@Override
public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectInactiveTasksFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
        lv.expandGroup(i);
}

From source file:in.andres.kandroid.ui.ProjectOverdueTasksFragment.java

@Override
public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectOverdueTasksFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
        lv.expandGroup(i);
}

From source file:in.andres.kandroid.ui.ProjectTasksFragment.java

@Override
public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectTaskFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
        lv.expandGroup(i);
}

From source file:org.mifos.androidclient.util.listadapters.SimpleExpandableListAdapter.java

@Override
public View getGroupView(int groupPos, boolean isExpanded, View convertView, ViewGroup parent) {
    View row;/*from  ww  w.j  av  a  2  s  .co m*/
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.simple_list_group, parent, false);
    } else {
        row = convertView;
    }
    SimpleListItem item = (SimpleListItem) getGroup(groupPos);
    if (item != null) {
        TextView label = (TextView) row.findViewById(R.id.simple_list_item_label);
        if (getChildrenCount(groupPos) > 0) {
            label.setText(mContext.getString(R.string.clientsList_listGroupLabel_withChildren,
                    item.getListLabel(), getChildrenCount(groupPos)));
        } else {
            label.setText(item.getListLabel());
        }
    }
    synchronized (mExpandGroups) {
        if (mExpandGroups == true) {
            ExpandableListView list = (ExpandableListView) parent;
            list.expandGroup(groupPos);
        }
    }
    return row;
}

From source file:org.maikelwever.droidpile.ViewMessageActivity.java

public void renderMessage(ParsedMailpileMessage message) {
    if (message == null) {
        return;/*from  w  w w . j a va 2  s.  c  o m*/
    }
    adapter.addItem(message);
    adapter.notifyDataSetChanged();

    if (this.parsedMessage == null) {
        this.parsedMessage = message;
        ExpandableListView listView = (ExpandableListView) findViewById(R.id.view_message_listview);
        listView.expandGroup(0);

        for (int x = 0; x < message.threadMessageIds.length(); x++) {
            try {
                String messageId = message.threadMessageIds.getString(x);
                this.messagesToDownload.addLast(messageId);
            } catch (JSONException e) {
                Log.d("droidpile", "Errourr", e);
            }
        }

        messagesToDownload.getFirst();
        messagesToDownload.removeFirst();
    }

    if (messagesToDownload.size() > 0) {
        new FetchMessageTask().execute(messagesToDownload.getFirst());
        messagesToDownload.removeFirst();
    }

    if (progressDialog != null) {
        progressDialog.dismiss();
        progressDialog = null;
    }
}

From source file:com.vrem.wifianalyzer.wifi.accesspoint.AccessPointsAdapterGroup.java

void update(@NonNull List<WiFiDetail> wiFiDetails, ExpandableListView expandableListView) {
    updateGroupBy();// 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: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);//  w  ww . j a v a2 s.  co  m
    else
        listView.expandGroup(pos);
}

From source file:com.robandjen.comicsapp.FullscreenActivity.java

void showCurrentComic(String url) {
    if (url == null || url.isEmpty()) {
        url = mComicList.get(mCurComic).getURL();
    }//www  .  j ava 2s. co  m

    final WebView contentView = (WebView) findViewById(R.id.fullscreen_content);
    contentView.stopLoading();

    //Load about:blank to clear any extra data and have a well defined URL in history
    contentView.loadUrl("about:blank");
    contentView.loadUrl(url);
    contentView.clearHistory();
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(mComicList.get(mCurComic).getName());
    }
    updateShare(url);

    ExpandableListView elv = (ExpandableListView) findViewById(R.id.comic_drawer);
    long packedPos = mAdapter.comicsPosToPackedPos(mCurComic);

    //Selection doesn't work if expandGroup isn't called or group already expanded. ?????
    elv.expandGroup(ExpandableListView.getPackedPositionGroup(packedPos));
    elv.setSelectedChild(ExpandableListView.getPackedPositionGroup(packedPos),
            ExpandableListView.getPackedPositionChild(packedPos), true);
    elv.setItemChecked(elv.getFlatListPosition(packedPos), true);
}

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  ww  w . j av  a 2 s . co 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);
}