Skip to content

How to Update the model to trigger a view change. #650

@doomtrooper

Description

@doomtrooper

I am using a OnModelClickListener to add click listener on an imageView. I want to change the image when the view is clicked. I m little confused on how to achieve the same. How to change the underlying model data? Also, I don't want to fetch all the data again. Should I change the image from the clicklistener itself? I am using a PagedListEpoxyController. I don't want to re-fetch the data again from the repository.

override fun onClick(model: ItemCustomViewModel_?, parentView: ItemCustomView?, clickedView: View?, position: Int) {
        val userName = model!!.post().publishedBy.userName
        emmiter(if (model.post().publishedBy.following) FollowEvent(userName) else UnFollowEvent(userName))
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions