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
66bd3831
Commit
66bd3831
authored
Aug 06, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code minor code refactorings
parent
731e786c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
46 deletions
+41
-46
MessageViewHolder.kt
...chat/rocket/android/chatroom/adapter/MessageViewHolder.kt
+38
-43
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+3
-3
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/MessageViewHolder.kt
View file @
66bd3831
...
@@ -3,12 +3,10 @@ package chat.rocket.android.chatroom.adapter
...
@@ -3,12 +3,10 @@ package chat.rocket.android.chatroom.adapter
import
android.graphics.Color
import
android.graphics.Color
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.text.Spannable
import
android.text.Spannable
import
android.text.Spanned
import
android.text.method.LinkMovementMethod
import
android.text.method.LinkMovementMethod
import
android.text.style.ImageSpan
import
android.text.style.ImageSpan
import
android.view.View
import
android.view.View
import
androidx.core.view.isVisible
import
androidx.core.view.isVisible
import
androidx.core.view.postDelayed
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.uimodel.MessageUiModel
import
chat.rocket.android.chatroom.uimodel.MessageUiModel
import
chat.rocket.android.emoji.EmojiReactionListener
import
chat.rocket.android.emoji.EmojiReactionListener
...
@@ -48,27 +46,25 @@ class MessageViewHolder(
...
@@ -48,27 +46,25 @@ class MessageViewHolder(
}
}
override
fun
bindViews
(
data
:
MessageUiModel
)
{
override
fun
bindViews
(
data
:
MessageUiModel
)
{
with
(
itemView
)
{
itemView
.
day_marker_layout
.
visibility
=
if
(
data
.
showDayMarker
)
{
day_marker_layout
.
visibility
=
if
(
data
.
showDayMarker
)
{
itemView
.
day
.
text
=
data
.
currentDayMarkerText
day
.
text
=
data
.
currentDayMarkerText
View
.
VISIBLE
View
.
VISIBLE
}
else
{
}
else
{
View
.
GONE
View
.
GONE
}
}
if
(
data
.
isFirstUnread
)
{
if
(
data
.
isFirstUnread
)
{
new_messages_notif
.
visibility
=
View
.
VISIBLE
itemView
.
new_messages_notif
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
new_messages_notif
.
visibility
=
View
.
GONE
itemView
.
new_messages_notif
.
visibility
=
View
.
GONE
}
}
text_message_time
.
text
=
data
.
time
itemView
.
text_message_time
.
text
=
data
.
time
text_sender
.
text
=
data
.
senderName
itemView
.
text_sender
.
text
=
data
.
senderName
if
(
data
.
content
is
Spannable
)
{
if
(
data
.
content
is
Spannable
)
{
val
spans
=
data
.
content
.
getSpans
(
0
,
data
.
content
.
length
,
ImageSpan
::
class
.
java
)
val
spans
=
data
.
content
.
getSpans
(
0
,
data
.
content
.
length
,
ImageSpan
::
class
.
java
)
spans
.
forEach
{
spans
.
forEach
{
if
(
it
.
drawable
is
GifDrawable
)
{
if
(
it
.
drawable
is
GifDrawable
)
{
it
.
drawable
.
callback
=
this
@MessageViewHolder
it
.
drawable
.
callback
=
this
@MessageViewHolder
(
it
.
drawable
as
GifDrawable
).
start
()
(
it
.
drawable
as
GifDrawable
).
start
()
...
@@ -76,28 +72,27 @@ class MessageViewHolder(
...
@@ -76,28 +72,27 @@ class MessageViewHolder(
}
}
}
}
text_content
.
text_content
.
text
=
data
.
content
itemView
.
text_content
.
text_content
.
text
=
data
.
content
image_avatar
.
setImageURI
(
data
.
avatar
)
itemView
.
image_avatar
.
setImageURI
(
data
.
avatar
)
text_content
.
setTextColor
(
if
(
data
.
isTemporary
)
Color
.
GRAY
else
Color
.
BLACK
)
itemView
.
text_content
.
setTextColor
(
if
(
data
.
isTemporary
)
Color
.
GRAY
else
Color
.
BLACK
)
data
.
message
.
let
{
data
.
message
.
let
{
text_edit_indicator
.
isVisible
=
!
it
.
isSystemMessage
()
&&
it
.
editedBy
!=
null
itemView
.
text_edit_indicator
.
isVisible
=
!
it
.
isSystemMessage
()
&&
it
.
editedBy
!=
null
image_star_indicator
.
isVisible
=
it
.
starred
?.
isNotEmpty
()
?:
false
itemView
.
image_star_indicator
.
isVisible
=
it
.
starred
?.
isNotEmpty
()
?:
false
}
}
if
(
data
.
unread
==
null
)
{
if
(
data
.
unread
==
null
)
{
read_receipt_view
.
isVisible
=
false
itemView
.
read_receipt_view
.
isVisible
=
false
}
else
{
}
else
{
read_receipt_view
.
setImageResource
(
itemView
.
read_receipt_view
.
setImageResource
(
if
(
data
.
unread
==
true
)
{
if
(
data
.
unread
==
true
)
{
R
.
drawable
.
ic_check_unread_24dp
R
.
drawable
.
ic_check_unread_24dp
}
else
{
}
else
{
R
.
drawable
.
ic_check_read_24dp
R
.
drawable
.
ic_check_read_24dp
}
}
)
)
read_receipt_view
.
isVisible
=
true
itemView
.
read_receipt_view
.
isVisible
=
true
}
}
}
}
}
}
}
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
66bd3831
...
@@ -982,12 +982,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -982,12 +982,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
text_message
?.
removeCallbacks
(
what
)
text_message
?.
removeCallbacks
(
what
)
}
}
override
fun
invalidateDrawable
(
p0
:
Drawable
?)
{
override
fun
invalidateDrawable
(
who
:
Drawable
?)
{
text_message
?.
invalidate
()
text_message
?.
invalidate
()
}
}
override
fun
scheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?,
w
:
Long
)
{
override
fun
scheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?,
`when`
:
Long
)
{
text_message
?.
postDelayed
(
what
,
w
)
text_message
?.
postDelayed
(
what
,
`when`
)
}
}
override
fun
showMessageInfo
(
id
:
String
)
{
override
fun
showMessageInfo
(
id
:
String
)
{
...
...
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