Commit e75dee33 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update RoomFileListAdapter.kt

parent 8c1aa05b
package chat.rocket.android.layouthelper.chatroom.list package chat.rocket.android.layouthelper.chatroom.list
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.helper.DateTime
import chat.rocket.android.widget.message.RocketChatMessageAttachmentsLayout import chat.rocket.android.widget.message.RocketChatMessageAttachmentsLayout
import chat.rocket.core.models.Attachment import chat.rocket.core.models.Attachment
import kotlinx.android.synthetic.main.day.view.*
import kotlinx.android.synthetic.main.item_room_file.view.* import kotlinx.android.synthetic.main.item_room_file.view.*
import java.sql.Timestamp
/** /**
* Created by Filipe de Lima Brito (filipedelimabrito@gmail.com) on 9/22/17. * Created by Filipe de Lima Brito (filipedelimabrito@gmail.com) on 9/22/17.
...@@ -20,7 +25,10 @@ class RoomFileListAdapter(private var dataSet: List<Attachment>) : RecyclerView. ...@@ -20,7 +25,10 @@ class RoomFileListAdapter(private var dataSet: List<Attachment>) : RecyclerView.
} }
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.attachment.appendAttachmentView(dataSet[position], true) val attachment = dataSet[position]
holder.newDay.text = DateTime.fromEpocMs(Timestamp.valueOf(attachment.timestamp).time, DateTime.Format.DATE)
holder.attachment.appendAttachmentView(attachment, true)
} }
override fun getItemCount(): Int = dataSet.size override fun getItemCount(): Int = dataSet.size
...@@ -32,6 +40,7 @@ class RoomFileListAdapter(private var dataSet: List<Attachment>) : RecyclerView. ...@@ -32,6 +40,7 @@ class RoomFileListAdapter(private var dataSet: List<Attachment>) : RecyclerView.
} }
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val newDay: TextView = itemView.day
val attachment: RocketChatMessageAttachmentsLayout = itemView.attachment val attachment: RocketChatMessageAttachmentsLayout = itemView.attachment
} }
} }
\ No newline at end of file
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