Code Monkey home page Code Monkey logo

Comments (5)

hbmartin avatar hbmartin commented on May 18, 2024

It seems the problem is that mAdapter has been declared with type Adapter
so you probably have a line that looks like var mAdapter: Adapter when it should look like var mAdapter: DialogsListAdapter

from chatkit.

strahe avatar strahe commented on May 18, 2024

@hbmartin
this is the fragment:


class DialogsListFragment: BaseMainFragment() {

    private lateinit var mToolbar: Toolbar
    private lateinit var mList: DialogsList
    private lateinit var mAdapter: DialogsListAdapter<Dialog>

    @Nullable
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val view = inflater.inflate(R.layout.dialog_list_fragment, container, false)
        initView(view)
        return view
    }

    private fun initView(view: View) {
        mList = view.findViewById<DialogsList>(R.id.dialogsList)
        mToolbar = view.findViewById<Toolbar>(R.id.toolbar)
        mToolbar.title = "Message"

    }

    override fun onLazyInitView(savedInstanceState: Bundle?) {
        super.onLazyInitView(savedInstanceState)

        val manager = LinearLayoutManager(_mActivity)

        mAdapter = DialogsListAdapter(R.layout.dialog_view_holder,
                DialogViewHolder::class.java,
                ImageLoader { imageView: ImageView, url: String ->
                    Picasso.with(this.context).load(url).into(imageView)
                })
        mAdapter.setItems(DialogsFixtures().getDialogs())

        mList.adapter = mAdapter
        mList.layoutManager = manager
    }
}

from chatkit.

hbmartin avatar hbmartin commented on May 18, 2024

hmm, maybe try mList.adapter = mAdapter as DialogsListAdapter
otherwise you might have to write a Kotlin extension to handle the setter's class confusion

from chatkit.

hbmartin avatar hbmartin commented on May 18, 2024

Alternately you can try building the library yourself with my latest commit here: https://github.com/hbmartin/ChatKit/commits/kotlin-support

from chatkit.

strahe avatar strahe commented on May 18, 2024

fix it by just call the setAdapter funtion:
mList.setAdapter(mAdapter)

thanks, @hbmartin

from chatkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.