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
37073556
Commit
37073556
authored
Aug 07, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some minor code refactoring
parent
66bd3831
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
54 deletions
+49
-54
MessageViewHolder.kt
...chat/rocket/android/chatroom/adapter/MessageViewHolder.kt
+49
-54
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/MessageViewHolder.kt
View file @
37073556
...
...
@@ -20,23 +20,6 @@ class MessageViewHolder(
listener
:
ActionsListener
,
reactionListener
:
EmojiReactionListener
?
=
null
)
:
BaseViewHolder
<
MessageUiModel
>(
itemView
,
listener
,
reactionListener
),
Drawable
.
Callback
{
override
fun
unscheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?)
{
with
(
itemView
)
{
text_content
.
removeCallbacks
(
what
)
}
}
override
fun
invalidateDrawable
(
p0
:
Drawable
?)
{
with
(
itemView
)
{
text_content
.
invalidate
()
}
}
override
fun
scheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?,
w
:
Long
)
{
with
(
itemView
)
{
text_content
.
postDelayed
(
what
,
w
)
}
}
init
{
with
(
itemView
)
{
...
...
@@ -46,53 +29,65 @@ class MessageViewHolder(
}
override
fun
bindViews
(
data
:
MessageUiModel
)
{
itemView
.
day_marker_layout
.
visibility
=
if
(
data
.
showDayMarker
)
{
itemView
.
day
.
text
=
data
.
currentDayMarkerText
View
.
VISIBLE
}
else
{
View
.
GONE
}
with
(
itemView
)
{
day
.
text
=
data
.
currentDayMarkerText
day_marker_layout
.
isVisible
=
data
.
showDayMarker
if
(
data
.
isFirstUnread
)
{
itemView
.
new_messages_notif
.
visibility
=
View
.
VISIBLE
}
else
{
itemView
.
new_messages_notif
.
visibility
=
View
.
GONE
}
new_messages_notif
.
isVisible
=
data
.
isFirstUnread
itemView
.
text_message_time
.
text
=
data
.
time
itemView
.
text_sender
.
text
=
data
.
senderName
text_message_time
.
text
=
data
.
time
text_sender
.
text
=
data
.
senderName
if
(
data
.
content
is
Spannable
)
{
val
spans
=
data
.
content
.
getSpans
(
0
,
data
.
content
.
length
,
ImageSpan
::
class
.
java
)
spans
.
forEach
{
if
(
it
.
drawable
is
GifDrawable
)
{
it
.
drawable
.
callback
=
this
@MessageViewHolder
(
it
.
drawable
as
GifDrawable
).
start
()
if
(
data
.
content
is
Spannable
)
{
val
spans
=
data
.
content
.
getSpans
(
0
,
data
.
content
.
length
,
ImageSpan
::
class
.
java
)
spans
.
forEach
{
if
(
it
.
drawable
is
GifDrawable
)
{
it
.
drawable
.
callback
=
this
@MessageViewHolder
(
it
.
drawable
as
GifDrawable
).
start
()
}
}
}
}
itemView
.
text_content
.
text_content
.
text
=
data
.
content
text_content
.
text_content
.
text
=
data
.
content
itemView
.
image_avatar
.
setImageURI
(
data
.
avatar
)
itemView
.
text_content
.
setTextColor
(
if
(
data
.
isTemporary
)
Color
.
GRAY
else
Color
.
BLACK
)
image_avatar
.
setImageURI
(
data
.
avatar
)
text_content
.
setTextColor
(
if
(
data
.
isTemporary
)
Color
.
GRAY
else
Color
.
BLACK
)
data
.
message
.
let
{
itemView
.
text_edit_indicator
.
isVisible
=
!
it
.
isSystemMessage
()
&&
it
.
editedBy
!=
null
itemView
.
image_star_indicator
.
isVisible
=
it
.
starred
?.
isNotEmpty
()
?:
false
data
.
message
.
let
{
text_edit_indicator
.
isVisible
=
!
it
.
isSystemMessage
()
&&
it
.
editedBy
!=
null
image_star_indicator
.
isVisible
=
it
.
starred
?.
isNotEmpty
()
?:
false
}
if
(
data
.
unread
==
null
)
{
read_receipt_view
.
isVisible
=
false
}
else
{
read_receipt_view
.
setImageResource
(
if
(
data
.
unread
==
true
)
{
R
.
drawable
.
ic_check_unread_24dp
}
else
{
R
.
drawable
.
ic_check_read_24dp
}
)
read_receipt_view
.
isVisible
=
true
}
}
}
if
(
data
.
unread
==
null
)
{
itemView
.
read_receipt_view
.
isVisible
=
false
}
else
{
itemView
.
read_receipt_view
.
setImageResource
(
if
(
data
.
unread
==
true
)
{
R
.
drawable
.
ic_check_unread_24dp
}
else
{
R
.
drawable
.
ic_check_read_24dp
}
)
itemView
.
read_receipt_view
.
isVisible
=
true
override
fun
unscheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?)
{
with
(
itemView
)
{
text_content
.
removeCallbacks
(
what
)
}
}
override
fun
invalidateDrawable
(
p0
:
Drawable
?)
{
with
(
itemView
)
{
text_content
.
invalidate
()
}
}
override
fun
scheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?,
w
:
Long
)
{
with
(
itemView
)
{
text_content
.
postDelayed
(
what
,
w
)
}
}
}
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