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
263b3f63
Unverified
Commit
263b3f63
authored
Jul 27, 2018
by
Lucio Maciel
Committed by
GitHub
Jul 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'beta' into fix/fix-uppercase-scheme
parents
de699214
ebf24317
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
111 additions
and
58 deletions
+111
-58
ChatRoomAdapter.kt
...a/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
+29
-29
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+16
-13
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+56
-8
FavoriteMessagesFragment.kt
...t/android/favoritemessages/ui/FavoriteMessagesFragment.kt
+1
-2
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+1
-1
MentionsFragment.kt
.../java/chat/rocket/android/mentions/ui/MentionsFragment.kt
+1
-2
PinnedMessagesFragment.kt
...ocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
+1
-2
strings.xml
app/src/main/res/values-es/strings.xml
+1
-1
build.gradle
core/build.gradle
+5
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
View file @
263b3f63
...
...
@@ -18,10 +18,9 @@ import java.security.InvalidParameterException
class
ChatRoomAdapter
(
private
val
roomType
:
String
?
=
null
,
private
val
roomName
:
String
?
=
null
,
private
val
presenter
:
ChatRoomPresenter
?
=
null
,
private
val
actionSelectListener
:
OnActionSelected
?
=
null
,
private
val
enableActions
:
Boolean
=
true
,
private
val
reactionListener
:
EmojiReactionListener
?
=
null
,
private
val
context
:
Context
?
=
null
private
val
reactionListener
:
EmojiReactionListener
?
=
null
)
:
RecyclerView
.
Adapter
<
BaseViewHolder
<*>>()
{
private
val
dataSet
=
ArrayList
<
BaseUiModel
<*>>()
...
...
@@ -70,7 +69,7 @@ class ChatRoomAdapter(
BaseUiModel
.
ViewType
.
MESSAGE_REPLY
->
{
val
view
=
parent
.
inflate
(
R
.
layout
.
item_message_reply
)
MessageReplyViewHolder
(
view
,
actionsListener
,
reactionListener
)
{
roomName
,
permalink
->
present
er
?.
openDirectMessage
(
roomName
,
permalink
)
actionSelectListen
er
?.
openDirectMessage
(
roomName
,
permalink
)
}
}
else
->
{
...
...
@@ -212,52 +211,53 @@ class ChatRoomAdapter(
message
.
apply
{
when
(
item
.
itemId
)
{
R
.
id
.
action_message_info
->
{
presenter
?.
m
essageInfo
(
id
)
actionSelectListener
?.
showM
essageInfo
(
id
)
}
R
.
id
.
action_message_reply
->
{
if
(
roomName
!=
null
&&
roomType
!=
null
)
{
present
er
?.
citeMessage
(
roomName
,
roomType
,
id
,
true
)
actionSelectListen
er
?.
citeMessage
(
roomName
,
roomType
,
id
,
true
)
}
}
R
.
id
.
action_message_quote
->
{
if
(
roomName
!=
null
&&
roomType
!=
null
)
{
present
er
?.
citeMessage
(
roomName
,
roomType
,
id
,
false
)
actionSelectListen
er
?.
citeMessage
(
roomName
,
roomType
,
id
,
false
)
}
}
R
.
id
.
action_message_copy
->
{
present
er
?.
copyMessage
(
id
)
actionSelectListen
er
?.
copyMessage
(
id
)
}
R
.
id
.
action_message_edit
->
{
present
er
?.
editMessage
(
roomId
,
id
,
message
.
message
)
actionSelectListen
er
?.
editMessage
(
roomId
,
id
,
message
.
message
)
}
R
.
id
.
action_message_star
->
{
if
(!
item
.
isChecked
)
{
presenter
?.
starMessage
(
id
)
}
else
{
presenter
?.
unstarMessage
(
id
)
}
actionSelectListener
?.
toogleStar
(
id
,
!
item
.
isChecked
)
}
R
.
id
.
action_message_unpin
->
{
if
(!
item
.
isChecked
)
{
presenter
?.
pinMessage
(
id
)
}
else
{
presenter
?.
unpinMessage
(
id
)
}
actionSelectListener
?.
tooglePin
(
id
,
!
item
.
isChecked
)
}
R
.
id
.
action_message_delete
->
{
context
?.
let
{
val
builder
=
AlertDialog
.
Builder
(
it
)
builder
.
setTitle
(
it
.
getString
(
R
.
string
.
msg_delete_message
))
.
setMessage
(
it
.
getString
(
R
.
string
.
msg_delete_description
))
.
setPositiveButton
(
it
.
getString
(
R
.
string
.
msg_ok
))
{
_
,
_
->
presenter
?.
deleteMessage
(
roomId
,
id
)
}
.
setNegativeButton
(
it
.
getString
(
R
.
string
.
msg_cancel
))
{
_
,
_
->
}
.
show
()
}
actionSelectListener
?.
deleteMessage
(
roomId
,
id
)
}
R
.
id
.
action_menu_msg_react
->
{
actionSelectListener
?.
showReactions
(
id
)
}
else
->
{
TODO
(
"Not implemented"
)
}
R
.
id
.
action_menu_msg_react
->
presenter
?.
showReactions
(
id
)
else
->
TODO
(
"Not implemented"
)
}
}
}
}
interface
OnActionSelected
{
fun
showMessageInfo
(
id
:
String
)
fun
citeMessage
(
roomName
:
String
,
roomType
:
String
,
messageId
:
String
,
mentionAuthor
:
Boolean
)
fun
copyMessage
(
id
:
String
)
fun
editMessage
(
roomId
:
String
,
messageId
:
String
,
text
:
String
)
fun
toogleStar
(
id
:
String
,
star
:
Boolean
)
fun
tooglePin
(
id
:
String
,
pin
:
Boolean
)
fun
deleteMessage
(
roomId
:
String
,
id
:
String
)
fun
showReactions
(
id
:
String
)
fun
openDirectMessage
(
roomName
:
String
,
message
:
String
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
263b3f63
...
...
@@ -1006,7 +1006,7 @@ class ChatRoomPresenter @Inject constructor(
}
}
private
suspend
fun
subscribeTypingStatus
()
{
private
fun
subscribeTypingStatus
()
{
launch
(
CommonPool
+
strategy
.
jobs
)
{
client
.
subscribeTypingStatus
(
chatRoomId
.
toString
())
{
_
,
id
->
typingStatusSubscriptionId
=
id
...
...
@@ -1019,22 +1019,25 @@ class ChatRoomPresenter @Inject constructor(
}
private
fun
processTypingStatus
(
typingStatus
:
Pair
<
String
,
Boolean
>)
{
if
(!
typingStatusList
.
any
{
username
->
username
==
typingStatus
.
first
})
{
if
(
typingStatus
.
second
)
{
typingStatusList
.
add
(
typingStatus
.
first
)
}
}
else
{
typingStatusList
.
find
{
username
->
username
==
typingStatus
.
first
}
?.
let
{
typingStatusList
.
remove
(
it
)
if
(
typingStatus
.
first
!=
currentLoggedUsername
)
{
if
(!
typingStatusList
.
any
{
username
->
username
==
typingStatus
.
first
})
{
if
(
typingStatus
.
second
)
{
typingStatusList
.
add
(
typingStatus
.
first
)
}
}
else
{
typingStatusList
.
find
{
username
->
username
==
typingStatus
.
first
}
?.
let
{
typingStatusList
.
remove
(
it
)
if
(
typingStatus
.
second
)
{
typingStatusList
.
add
(
typingStatus
.
first
)
}
}
}
if
(
typingStatusList
.
isNotEmpty
())
{
view
.
showTypingStatus
(
typingStatusList
.
toList
())
}
else
{
view
.
hideTypingStatusView
()
}
}
if
(
typingStatusList
.
isNotEmpty
())
{
view
.
showTypingStatus
(
typingStatusList
.
toList
())
// copy typingStatusList
}
else
{
view
.
hideTypingStatusView
()
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
263b3f63
...
...
@@ -126,7 +126,8 @@ internal const val MENU_ACTION_PINNED_MESSAGES = 4
internal
const
val
MENU_ACTION_FAVORITE_MESSAGES
=
5
internal
const
val
MENU_ACTION_FILES
=
6
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
,
EmojiKeyboardListener
,
EmojiReactionListener
{
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
,
EmojiKeyboardListener
,
EmojiReactionListener
,
ChatRoomAdapter
.
OnActionSelected
{
@Inject
lateinit
var
presenter
:
ChatRoomPresenter
@Inject
...
...
@@ -200,6 +201,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
else
{
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
adapter
=
ChatRoomAdapter
(
chatRoomType
,
chatRoomName
,
this
,
reactionListener
=
this
)
}
override
fun
onCreateView
(
...
...
@@ -335,13 +339,6 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
if
(
recycler_view
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
chatRoomType
,
chatRoomName
,
presenter
,
reactionListener
=
this
@ChatRoomFragment
,
context
=
context
)
recycler_view
.
adapter
=
adapter
if
(
dataSet
.
size
>=
30
)
{
recycler_view
.
addOnScrollListener
(
endlessRecyclerViewScrollListener
)
...
...
@@ -967,4 +964,55 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
fun
setupToolbar
(
toolbarTitle
:
String
)
{
(
activity
as
ChatRoomActivity
).
showToolbarTitle
(
toolbarTitle
)
}
override
fun
showMessageInfo
(
id
:
String
)
{
presenter
.
messageInfo
(
id
)
}
override
fun
citeMessage
(
roomName
:
String
,
roomType
:
String
,
messageId
:
String
,
mentionAuthor
:
Boolean
)
{
presenter
.
citeMessage
(
roomName
,
roomType
,
messageId
,
mentionAuthor
)
}
override
fun
copyMessage
(
id
:
String
)
{
presenter
.
copyMessage
(
id
)
}
override
fun
editMessage
(
roomId
:
String
,
messageId
:
String
,
text
:
String
)
{
presenter
.
editMessage
(
roomId
,
messageId
,
text
)
}
override
fun
toogleStar
(
id
:
String
,
star
:
Boolean
)
{
if
(
star
)
{
presenter
.
starMessage
(
id
)
}
else
{
presenter
.
unstarMessage
(
id
)
}
}
override
fun
tooglePin
(
id
:
String
,
pin
:
Boolean
)
{
if
(
pin
)
{
presenter
.
pinMessage
(
id
)
}
else
{
presenter
.
unpinMessage
(
id
)
}
}
override
fun
deleteMessage
(
roomId
:
String
,
id
:
String
)
{
ui
{
val
builder
=
AlertDialog
.
Builder
(
it
)
builder
.
setTitle
(
it
.
getString
(
R
.
string
.
msg_delete_message
))
.
setMessage
(
it
.
getString
(
R
.
string
.
msg_delete_description
))
.
setPositiveButton
(
it
.
getString
(
R
.
string
.
msg_ok
))
{
_
,
_
->
presenter
.
deleteMessage
(
roomId
,
id
)
}
.
setNegativeButton
(
it
.
getString
(
R
.
string
.
msg_cancel
))
{
_
,
_
->
}
.
show
()
}
}
override
fun
showReactions
(
id
:
String
)
{
presenter
.
showReactions
(
id
)
}
override
fun
openDirectMessage
(
roomName
:
String
,
message
:
String
)
{
presenter
.
openDirectMessage
(
roomName
,
message
)
}
}
app/src/main/java/chat/rocket/android/favoritemessages/ui/FavoriteMessagesFragment.kt
View file @
263b3f63
...
...
@@ -35,7 +35,7 @@ private const val INTENT_CHAT_ROOM_ID = "chat_room_id"
class
FavoriteMessagesFragment
:
Fragment
(),
FavoriteMessagesView
{
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
adapter
:
ChatRoomAdapter
private
val
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
@Inject
lateinit
var
presenter
:
FavoriteMessagesPresenter
...
...
@@ -66,7 +66,6 @@ class FavoriteMessagesFragment : Fragment(), FavoriteMessagesView {
override
fun
showFavoriteMessages
(
favoriteMessages
:
List
<
BaseUiModel
<*
>>)
{
ui
{
if
(
recycler_view
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
recycler_view
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
)
recycler_view
.
layoutManager
=
linearLayoutManager
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
263b3f63
...
...
@@ -157,7 +157,7 @@ class MessageParser @Inject constructor(
if
(
node
is
ListItem
)
{
newLine
()
builder
.
append
(
"$number$delimiter "
)
super
.
visit
(
node
.
firstChild
as
Paragraph
)
super
.
visit
Children
(
node
.
firstChild
)
newLine
()
}
number
++
...
...
app/src/main/java/chat/rocket/android/mentions/ui/MentionsFragment.kt
View file @
263b3f63
...
...
@@ -36,7 +36,7 @@ private const val BUNDLE_CHAT_ROOM_ID = "chat_room_id"
class
MentionsFragment
:
Fragment
(),
MentionsView
{
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
adapter
:
ChatRoomAdapter
private
val
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
@Inject
lateinit
var
presenter
:
MentionsPresenter
...
...
@@ -68,7 +68,6 @@ class MentionsFragment : Fragment(), MentionsView {
override
fun
showMentions
(
mentions
:
List
<
BaseUiModel
<*
>>)
{
ui
{
if
(
recycler_view
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
recycler_view
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
)
...
...
app/src/main/java/chat/rocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
View file @
263b3f63
...
...
@@ -36,7 +36,7 @@ private const val BUNDLE_CHAT_ROOM_ID = "chat_room_id"
class
PinnedMessagesFragment
:
Fragment
(),
PinnedMessagesView
{
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
adapter
:
ChatRoomAdapter
private
val
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
@Inject
lateinit
var
presenter
:
PinnedMessagesPresenter
...
...
@@ -68,7 +68,6 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
override
fun
showPinnedMessages
(
pinnedMessages
:
List
<
BaseUiModel
<*
>>)
{
ui
{
if
(
recycler_view_pinned
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
recycler_view_pinned
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
)
...
...
app/src/main/res/values-es/strings.xml
View file @
263b3f63
...
...
@@ -38,7 +38,6 @@
<string
name=
"action_invisible"
>
Invisible
</string>
<string
name=
"action_drawing"
>
dibujo
</string>
<string
name=
"action_save_to_gallery"
>
Guardar en la galería
</string>
<string
name=
"action_share"
>
Compartir
</string>
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
...
...
@@ -275,4 +274,5 @@
<string
name=
"msg_file_description"
>
Descripción del archivo
</string>
<string
name=
"msg_send"
>
Enviar
</string>
<string
name=
"msg_sent_attachment"
>
Envió un archivo
</string>
</resources>
core/build.gradle
View file @
263b3f63
...
...
@@ -18,6 +18,11 @@ android {
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
}
packagingOptions
{
exclude
'META-INF/core.kotlin_module'
exclude
'META-INF/main.kotlin_module'
}
}
dependencies
{
...
...
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