Comments (5)
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.
@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.
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.
Alternately you can try building the library yourself with my latest commit here: https://github.com/hbmartin/ChatKit/commits/kotlin-support
from chatkit.
fix it by just call the setAdapter funtion:
mList.setAdapter(mAdapter)
thanks, @hbmartin
from chatkit.
Related Issues (20)
- Programmically change the Icon of MessageInput's Button
- Activate submit button on empty EditText field of MessageInput HOT 2
- Message time formatting (not header date formatting)
- MessageListAdapter addToStart method always add message on top of chat (instead of bottom of list) HOT 1
- Unable to create custom holder HOT 1
- Could not GET 'https://google.bintray.com/flexbox-layout/com/google/android/flexbox/1.0.0/flexbox-1.0.0.pom'. HOT 6
- how to apply readmore text?
- How to align bubbles on the top of the screen when there are only a few of them?
- Update flexbox to 3.0.0 HOT 3
- Adding message history through addToStart reverses messages' order
- Display date or "delivered" only on last message
- Can we display sender name on chat message bubble ?
- Could not resolve com.github.stfalcon-studio:Chatkit:v0.4.1. HOT 7
- Strange behavior with Custom Voice ViewHolder HOT 2
- Is it compatible with jetpack compose
- Tg HOT 1
- MessageInput Error: Application Crashes on launching DefaultMessageActivity on setcontentview method
- How to attach images on chat?
- Holder layout not working
- Fatal Exception: java.lang.UnsupportedOperationException: Somehow we couldn't create the ViewHolder for message. Please, report this issue on GitHub with full stacktrace in description.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatkit.