Example usage for android.widget ExpandableListView getExpandableListAdapter

List of usage examples for android.widget ExpandableListView getExpandableListAdapter

Introduction

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

Prototype

public ExpandableListAdapter getExpandableListAdapter() 

Source Link

Document

Gets the adapter that provides data to this view.

Usage

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 w  w  w .  jav  a  2 s  . co  m
}

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);// ww  w .  j  a v  a  2s.  c  o m
}

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 w  w  w.j  a  va  2 s  .  co m*/
}

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

void update(@NonNull List<WiFiDetail> wiFiDetails, ExpandableListView expandableListView) {
    updateGroupBy();/* ww  w.  j  a va  2s .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:org.mifos.androidclient.main.CollectionSheetActivity.java

@Override
public boolean onChildClick(ExpandableListView parent, View view, int groupPos, int childPos, long id) {
    CollectionSheetCustomer customer = (CollectionSheetCustomer) parent.getExpandableListAdapter()
            .getChild(groupPos, childPos);
    CollectionSheetHolder.setCurrentCustomer(customer);
    Intent intent = new Intent().setClass(this, CollectionSheetCustomerActivity.class);
    intent.putExtra(CollectionSheetCustomer.BUNDLE_KEY, customer);
    startActivity(intent);/*from  w  w  w .  j  a v a2s  .  c o m*/
    return true;
}

From source file:org.mifos.androidclient.main.LastRepaymentReportActivity.java

@Override
public boolean onChildClick(ExpandableListView parent, View view, int groupPos, int childPos, long id) {
    Intent intent = new Intent().setClass(this, AccountDetailsActivity.class);
    AccountBasicInformation acc = (AccountBasicInformation) parent.getExpandableListAdapter().getChild(groupPos,
            childPos);/*from   w  ww.  j av a2 s .co m*/
    intent.putExtra(AccountBasicInformation.BUNDLE_KEY, acc);
    startActivity(intent);
    return true;
}

From source file:org.mifos.androidclient.main.CustomerDetailsActivity.java

@Override
public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPos, int childPos,
        long id) {
    AccountsExpandableListAdapter adapter = (AccountsExpandableListAdapter) expandableListView
            .getExpandableListAdapter();
    AccountBasicInformation account = (AccountBasicInformation) adapter.getChild(groupPos, childPos);
    Intent intent = new Intent().setClass(this, AccountDetailsActivity.class);
    intent.putExtra(AccountBasicInformation.BUNDLE_KEY, account);
    startActivity(intent);/*from   w  w  w.  j  av a2  s.  c  o  m*/
    return true;
}

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

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (((MainActivity) getActivity()).getProject() != null) {
        assert getView() != null : "ProjectTaskFragment: getView() returned null";
        getView().findViewById(R.id.fragment_dash_errortext).setVisibility(View.GONE);
        getView().findViewById(R.id.expandable_list).setVisibility(View.VISIBLE);
        mColumn = (KanboardColumn) getArguments().getSerializable("column");
        ProjectTaskAdapter listAdapter = new ProjectTaskAdapter(getContext(),
                ((MainActivity) getActivity()).getProject(),
                ((MainActivity) getActivity()).getProject().getGroupedActiveTasks().get(mColumn.getId()), true);
        ((ExpandableListView) getView().findViewById(R.id.expandable_list)).setAdapter(listAdapter);
        for (int i = 0; i < listAdapter.getGroupCount(); i++)
            ((ExpandableListView) getView().findViewById(R.id.expandable_list)).expandGroup(i);
        ((ExpandableListView) getView().findViewById(R.id.expandable_list))
                .setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
                    @Override//from  w  w w  .j  a v a 2 s.c o  m
                    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                            int childPosition, long id) {
                        Log.i(Constants.TAG, "Launching TaskDetailActivity from ProjectTasksFragment.");
                        MainActivity mainActivity = (MainActivity) getActivity();
                        if (childPosition == parent.getExpandableListAdapter().getChildrenCount(groupPosition)
                                - 1) {
                            Intent intent = new Intent(getContext(), TaskEditActivity.class);
                            intent.putExtra("columnid", mColumn.getId());
                            intent.putExtra("projectid", ((MainActivity) getActivity()).getProject().getId());
                            intent.putExtra("swimlaneid", ((MainActivity) getActivity()).getProject()
                                    .getSwimlanes().get(groupPosition).getId());
                            intent.putExtra("projectusers",
                                    (Hashtable<Integer, String>) mainActivity.getProject().getProjectUsers());
                            startActivityForResult(intent, Constants.RequestEditTask);
                            return true;
                        }

                        KanboardProject project = ((MainActivity) getActivity()).getProject();
                        KanboardTask clickedTask = project.getGroupedActiveTasks().get(mColumn.getId())
                                .get(project.getSwimlanes().get(groupPosition).getId()).get(childPosition);
                        Intent taskIntent = new Intent(getContext(), TaskDetailActivity.class);
                        taskIntent.putExtra("task", clickedTask);
                        taskIntent.putExtra("me", ((MainActivity) getActivity()).getMe());
                        taskIntent.putExtra("column", mColumn);
                        taskIntent.putExtra("swimlane", project.getSwimlanes().get(groupPosition));
                        if (clickedTask.getCategoryId() > 0)
                            taskIntent.putExtra("category",
                                    project.getCategoryHashtable().get(clickedTask.getCategoryId()));
                        startActivityForResult(taskIntent, Constants.RequestEditTask);
                        return true;
                    }
                });
    } else {
        assert getView() != null : "ProjectTaskFragment: getView() returned null";
        getView().findViewById(R.id.fragment_dash_errortext).setVisibility(View.VISIBLE);
        getView().findViewById(R.id.expandable_list).setVisibility(View.GONE);
    }
}

From source file:org.mozilla.gecko.AwesomeBar.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);
    ListView list = (ListView) view;
    Object selectedItem = null;//ww w  .j a v a2  s .  co m
    String title = "";

    if (list == findViewById(R.id.history_list)) {
        if (!(menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) {
            Log.e(LOGTAG, "menuInfo is not ExpandableListContextMenuInfo");
            return;
        }

        ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
        int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
        int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);

        // Check if long tap is on a header row
        if (groupPosition < 0 || childPosition < 0)
            return;

        ExpandableListView exList = (ExpandableListView) list;
        selectedItem = exList.getExpandableListAdapter().getChild(groupPosition, childPosition);

        // The history list is backed by a SimpleExpandableListAdapter
        @SuppressWarnings("rawtypes")
        Map map = (Map) selectedItem;
        title = (String) map.get(URLColumns.TITLE);
    } else {
        if (!(menuInfo instanceof AdapterView.AdapterContextMenuInfo)) {
            Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo");
            return;
        }

        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        selectedItem = list.getItemAtPosition(info.position);

        if (!(selectedItem instanceof Cursor)) {
            Log.e(LOGTAG, "item at " + info.position + " is not a Cursor");
            return;
        }

        Cursor cursor = (Cursor) selectedItem;
        title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));

        // Don't show the context menu for folders
        if (list == findViewById(R.id.bookmarks_list)
                && cursor.getInt(cursor.getColumnIndexOrThrow(Bookmarks.IS_FOLDER)) == 1) {
            selectedItem = null;
        }
    }

    if (selectedItem == null || !((selectedItem instanceof Cursor) || (selectedItem instanceof Map))) {
        mContextMenuSubject = null;
        return;
    }

    mContextMenuSubject = selectedItem;

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.awesomebar_contextmenu, menu);

    if (list != findViewById(R.id.bookmarks_list)) {
        MenuItem removeBookmarkItem = menu.findItem(R.id.remove_bookmark);
        removeBookmarkItem.setVisible(false);
    }

    menu.setHeaderTitle(title);
}

From source file:org.jitsi.android.gui.contactlist.ContactListFragment.java

/**
 * /*from   ww  w  .  j av  a2  s.co  m*/
 */
@Override
public boolean onChildClick(ExpandableListView listView, View v, int groupPosition, int childPosition,
        long id) {
    BaseContactListAdapter adapter = (BaseContactListAdapter) listView.getExpandableListAdapter();

    int position = adapter.getListIndex(groupPosition, childPosition);

    contactListView.setSelection(position);
    adapter.invalidateViews();

    Object clicked = adapter.getChild(groupPosition, childPosition);
    if (!(clicked instanceof MetaContact)) {
        logger.debug("No meta contact at " + groupPosition + ", " + childPosition);
        return false;
    }

    MetaContact metaContact = (MetaContact) clicked;

    if (!metaContact.getContactsForOperationSet(OperationSetBasicInstantMessaging.class).isEmpty()) {
        startChatActivity(metaContact);
        return true;
    }
    return false;
}