Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

onCellClickListener not working #46

@pizzanakin

Description

@pizzanakin

I have added an onCellClickListener to the cells in my recyclerview, which is a list of podcasts. The selected podcast should start playing when the user taps a cell in the list, but the onCellClicked method is never called. I have also added an onCellLongClicked method, and this one works fine, but it is not my intended functionality for the app.

Here is the code where I bind the data and create the listeners:

    List<DataManager.Podcast> podcasts = DownloadData.podcastList;
    List<DataManager.PodcastCell> cells = new ArrayList<>();
    for (DataManager.Podcast podcast:podcasts) {
        DataManager.PodcastCell cell = new DataManager.PodcastCell(podcast);
        cell.setOnCellClickListener(new SimpleCell.OnCellClickListener<DataManager.Podcast>() {
            @Override
            public void onCellClicked(DataManager.Podcast item) {
                Log.d("test", "CLICK");
            }
        });
        cell.setOnCellLongClickListener(new SimpleCell.OnCellLongClickListener<DataManager.Podcast>() {
            @Override
            public void onCellLongClicked(DataManager.Podcast item) {
                Log.d("test", "LONGCLICK");
            }
        });
        cells.add(cell);
    }
    recyclerView.addCells(cells);

And here's the console output when I attempt both types of clicking:
08-23 11:48:55.811 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:48:56.767 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:48:57.579 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:48:58.410 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:49:02.141 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:49:03.442 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:49:04.155 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK
08-23 11:49:05.382 8394-8394/com.gmail.lpizzanakin.myfirstvbgapp D/test: LONGCLICK

I don't see any differences between my implementations of both listeners, so I don't think there should be anything wrong with my code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions