Commit 59a8a6e5 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Remove serverUrl param from PinnedMessagesAdapter

parent 5a4563c1
......@@ -10,7 +10,6 @@ interface PinnedMessagesView : MessageView, LoadingView {
* Show list of pinned messages for the current room.
*
* @param pinnedMessages The list of pinned messages.
* @param serverUrl The url of the current server.
*/
fun showPinnedMessages(pinnedMessages: List<MessageViewModel>, serverUrl: String)
fun showPinnedMessages(pinnedMessages: List<MessageViewModel>)
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ import kotlinx.android.synthetic.main.avatar.view.*
import kotlinx.android.synthetic.main.item_message.view.*
import kotlinx.android.synthetic.main.message_attachment.view.*
class PinnedMessagesAdapter(private val serverUrl: String) : RecyclerView.Adapter<PinnedMessagesAdapter.ViewHolder>() {
class PinnedMessagesAdapter : RecyclerView.Adapter<PinnedMessagesAdapter.ViewHolder>() {
init {
setHasStableIds(true)
......@@ -29,7 +29,7 @@ class PinnedMessagesAdapter(private val serverUrl: String) : RecyclerView.Adapte
val dataSet = ArrayList<MessageViewModel>()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder =
ViewHolder(parent.inflate(R.layout.item_message), serverUrl)
ViewHolder(parent.inflate(R.layout.item_message))
override fun onBindViewHolder(holder: ViewHolder, position: Int) = holder.bind(dataSet[position])
......@@ -72,8 +72,7 @@ class PinnedMessagesAdapter(private val serverUrl: String) : RecyclerView.Adapte
return dataSet[position].id.hashCode().toLong()
}
class ViewHolder(itemView: View,
val serverUrl: String) : RecyclerView.ViewHolder(itemView) {
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
private lateinit var messageViewModel: MessageViewModel
......
......@@ -8,7 +8,6 @@ import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import chat.rocket.android.R
import chat.rocket.android.chatroom.presentation.PinnedMessagesPresenter
import chat.rocket.android.chatroom.presentation.PinnedMessagesView
......@@ -72,10 +71,10 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
override fun showGenericErrorMessage() = showMessage(getString(R.string.msg_generic_error))
override fun showPinnedMessages(pinnedMessages: List<MessageViewModel>, serverUrl: String) {
override fun showPinnedMessages(pinnedMessages: List<MessageViewModel>) {
activity?.apply {
if (recycler_view_pinned.adapter == null) {
adapter = PinnedMessagesAdapter(serverUrl)
adapter = PinnedMessagesAdapter()
recycler_view_pinned.adapter = adapter
val linearLayoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
recycler_view_pinned.layoutManager = linearLayoutManager
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment