Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
1671adf9
Commit
1671adf9
authored
Dec 14, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update MessageListAdapter
parent
f5e4d478
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
MessageListAdapter.kt
...va/chat/rocket/android/app/chatroom/MessageListAdapter.kt
+26
-3
No files found.
app/src/main/java/chat/rocket/android/app/chatroom/MessageListAdapter.kt
View file @
1671adf9
package
chat.rocket.android.app.chatroom
import
DateTimeHelper
import
android.content.Context
import
android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
...
...
@@ -8,9 +9,10 @@ import android.view.ViewGroup
import
android.widget.TextView
import
chat.rocket.android.R
import
com.facebook.drawee.view.SimpleDraweeView
import
com.stfalcon.frescoimageviewer.ImageViewer
import
kotlinx.android.synthetic.main.item_message.view.*
class
MessageListAdapter
(
private
va
r
dataSet
:
MutableList
<
Message
>
)
:
RecyclerView
.
Adapter
<
MessageListAdapter
.
ViewHolder
>()
{
class
MessageListAdapter
(
private
va
l
context
:
Context
,
private
var
dataSet
:
MutableList
<
Message
>,
private
val
listener
:
(
Message
)
->
Unit
)
:
RecyclerView
.
Adapter
<
MessageListAdapter
.
ViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
R
.
layout
.
item_message
,
parent
,
false
)
...
...
@@ -23,7 +25,25 @@ class MessageListAdapter(private var dataSet: MutableList<Message>) : RecyclerVi
holder
.
userAvatar
.
setImageURI
(
message
.
user
.
avatarUri
)
holder
.
userName
.
text
=
message
.
user
.
name
holder
.
time
.
text
=
DateTimeHelper
.
getTime
(
message
.
localDatetime
)
holder
.
content
.
text
=
message
.
content
val
textContent
=
message
.
textContent
if
(
textContent
.
isNullOrBlank
())
{
holder
.
textContent
.
visibility
=
View
.
GONE
}
else
{
holder
.
textContent
.
text
=
textContent
}
val
imageAttachmentUri
=
message
.
imageAttachmentUri
if
(
imageAttachmentUri
.
isNullOrBlank
())
{
holder
.
imageAttachment
.
visibility
=
View
.
GONE
}
else
{
holder
.
imageAttachment
.
setImageURI
(
imageAttachmentUri
)
holder
.
imageAttachment
.
setOnClickListener
({
ImageViewer
.
Builder
(
context
,
listOf
(
imageAttachmentUri
))
.
hideStatusBar
(
false
)
.
show
()
})
}
}
override
fun
getItemCount
():
Int
=
dataSet
.
size
...
...
@@ -32,6 +52,9 @@ class MessageListAdapter(private var dataSet: MutableList<Message>) : RecyclerVi
val
userAvatar
:
SimpleDraweeView
=
itemView
.
image_user_avatar
val
userName
:
TextView
=
itemView
.
text_user_name
val
time
:
TextView
=
itemView
.
text_message_time
val
content
:
TextView
=
itemView
.
text_content
val
textContent
:
TextView
=
itemView
.
text_content
val
imageAttachment
:
SimpleDraweeView
=
itemView
.
image_attachment
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment