Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class GroupChannelChatActivity : AppCompatActivity(), GroupChannelChatView, GroupChannelChatAdapter.OnItemClickListener {
private val EXTRA_CHANNEL_URL = "EXTRA_CHANNEL_URL"
@Inject
lateinit var presenter: GroupChannelChatPresenterImpl
private lateinit var recyclerView: RecyclerView
private lateinit var adapter: GroupChannelChatAdapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_gchat)
BaseApp.app(this).injector.inject(this)
presenter.setView(this)
setListeners()
setUpRecyclerView()
}
override fun onResume() {
super.onResume()
presenter.onResume(this, getChannelURl())
}
override fun onPause() {
super.onPause()
presenter.onPause()
}
override fun insert(messages: MutableList<BaseMessage>) {
edit_gchat_message.setText("")
adapter.insert(messages)
recyclerView.scrollToPosition(0)
}
override fun update(messages: MutableList<BaseMessage>) {
adapter.update(messages)
}
override fun remove(messages: MutableList<BaseMessage>) {
adapter.remove(messages)
}
override fun markAllRead() {
adapter.markAsRead()
}
override fun clear() {
adapter.clear()
}
private fun setListeners() {
button_gchat_share.setOnClickListener {
presenter.shareLocation(this)
}
}
private fun setUpRecyclerView() {
adapter = GroupChannelChatAdapter(this, this)
recyclerView = recycler_gchat
recyclerView.adapter = adapter
val layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this)
layoutManager.reverseLayout = true
recyclerView.layoutManager = layoutManager
recyclerView.scrollToPosition(0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.