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
33796d86
Commit
33796d86
authored
Feb 04, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support on the chat view for reply/quote actions
parent
5d68045a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+8
-0
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+30
-2
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
33796d86
...
...
@@ -42,6 +42,14 @@ interface ChatRoomView : LoadingView, MessageView {
*/
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
MessageViewModel
)
/**
* Show reply status above the message composer.
*
* @param replyMarkdown The markdown of the message reply.
* @param quotedMessage The message to quote.
*/
fun
showReplyStatus
(
replyMarkdown
:
String
,
quotedMessage
:
String
)
fun
disableMessageInput
()
fun
enableMessageInput
(
clear
:
Boolean
=
false
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
33796d86
...
...
@@ -45,6 +45,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
private
lateinit
var
chatRoomType
:
String
private
var
isChatRoomReadOnly
:
Boolean
=
false
private
lateinit
var
adapter
:
ChatRoomAdapter
private
lateinit
var
citationSnackbar
:
CitationSnackbar
private
var
citation
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -67,6 +69,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
super
.
onViewCreated
(
view
,
savedInstanceState
)
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
)
setupComposer
()
setupCitationSnackbar
()
}
override
fun
onDestroyView
()
{
...
...
@@ -77,7 +80,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
override
fun
showMessages
(
dataSet
:
List
<
MessageViewModel
>,
serverUrl
:
String
)
{
activity
?.
apply
{
if
(
recycler_view
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
serverUrl
,
presenter
)
adapter
=
ChatRoomAdapter
(
serverUrl
,
chatRoomType
,
chatRoomName
,
presenter
)
recycler_view
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
true
)
recycler_view
.
layoutManager
=
linearLayoutManager
...
...
@@ -126,6 +129,14 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
adapter
.
removeItem
(
msgId
)
}
override
fun
showReplyStatus
(
replyMarkdown
:
String
,
quotedMessage
:
String
)
{
activity
?.
apply
{
citation
=
replyMarkdown
citationSnackbar
.
text
=
quotedMessage
citationSnackbar
.
show
()
}
}
override
fun
showLoading
()
=
view_loading
.
setVisible
(
true
)
override
fun
hideLoading
()
=
view_loading
.
setVisible
(
false
)
...
...
@@ -139,7 +150,24 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
text_room_is_read_only
.
setVisible
(
true
)
top_container
.
setVisible
(
false
)
}
else
{
text_send
.
setOnClickListener
{
sendMessage
(
text_message
.
textContent
)
}
text_send
.
setOnClickListener
{
var
textMessage
=
citation
?:
""
textMessage
=
textMessage
+
text_message
.
textContent
sendMessage
(
textMessage
)
clearCitation
()
}
}
}
private
fun
setupCitationSnackbar
()
{
citationSnackbar
=
CitationSnackbar
.
make
(
message_list_container
,
""
)
citationSnackbar
.
cancelView
.
setOnClickListener
({
clearCitation
()
})
}
private
fun
clearCitation
()
{
citation
=
null
citationSnackbar
.
dismiss
()
}
}
\ 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