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
29a51143
Commit
29a51143
authored
Feb 02, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing things.
parent
f00301c0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
20 deletions
+47
-20
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+13
-4
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+4
-4
ChatRoomAdapter.kt
...n/java/chat/rocket/android/chatroom/ui/ChatRoomAdapter.kt
+3
-3
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+5
-5
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+4
-4
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+9
-0
strings.xml
app/src/main/res/values/strings.xml
+9
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
29a51143
package
chat.rocket.android.chatroom.presentation
import
chat.rocket.android.chatroom.viewmodel.MessageViewModelMapper
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.launchUI
import
chat.rocket.common.model.roomTypeOf
...
...
@@ -13,6 +15,7 @@ import chat.rocket.core.internal.realtime.unsubscibre
import
chat.rocket.core.internal.rest.messages
import
chat.rocket.core.internal.rest.sendMessage
import
chat.rocket.core.model.Message
import
chat.rocket.core.model.Value
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.channels.Channel
import
kotlinx.coroutines.experimental.launch
...
...
@@ -21,12 +24,18 @@ import javax.inject.Inject
class
ChatRoomPresenter
@Inject
constructor
(
private
val
view
:
ChatRoomView
,
private
val
strategy
:
CancelStrategy
,
getSettingsInteractor
:
GetSettingsInteractor
,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
factory
:
RocketChatClientFactory
,
private
val
mapper
:
MessageViewModelMapper
)
{
private
val
client
=
factory
.
create
(
serverInteractor
.
get
()
!!
)
private
val
roomMessages
=
ArrayList
<
Message
>()
private
var
subId
:
String
?
=
null
private
var
settings
:
Map
<
String
,
Value
<
Any
>>?
=
null
init
{
settings
=
getSettingsInteractor
.
get
(
serverInteractor
.
get
()
!!
)
}
private
val
stateChannel
=
Channel
<
State
>()
...
...
@@ -51,8 +60,8 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
ex
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
view
.
showGenericErrorMessage
()
}
}
finally
{
view
.
hideLoading
()
}
...
...
@@ -71,8 +80,8 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
ex
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
view
.
showGenericErrorMessage
()
}
view
.
enableMessageInput
()
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
29a51143
package
chat.rocket.android.chatroom.presentation
import
chat.rocket.android.chatroom.viewmodel.MessageViewModel
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.core.model.Message
interface
ChatRoomView
:
LoadingView
,
MessageView
{
...
...
@@ -12,7 +12,7 @@ interface ChatRoomView : LoadingView, MessageView {
* @param dataSet The data set to show.
* @param serverUrl The server URL.
*/
fun
showMessages
(
dataSet
:
List
<
Message
>,
serverUrl
:
String
)
fun
showMessages
(
dataSet
:
List
<
Message
ViewModel
>,
serverUrl
:
String
)
/**
* Send a message to a chat room.
...
...
@@ -26,14 +26,14 @@ interface ChatRoomView : LoadingView, MessageView {
*
* @param message The (recent) message sent to a chat room.
*/
fun
showNewMessage
(
message
:
Message
)
fun
showNewMessage
(
message
:
Message
ViewModel
)
/**
* Dispatch a update to the recycler views adapter about a changed message.
*
* @param index The index of the changed message
*/
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
Message
)
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
Message
ViewModel
)
fun
disableMessageInput
()
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomAdapter.kt
View file @
29a51143
...
...
@@ -119,8 +119,8 @@ class ChatRoomAdapter(private val serverUrl: String) : RecyclerView.Adapter<Chat
drawee
.
setVisible
(
true
)
imageUnknownAvatar
.
setVisible
(
false
)
}.
ifNull
{
drawee
.
setVisible
(
false
)
imageUnknownAvatar
.
setVisible
(
true
)
}
drawee
.
setVisible
(
false
)
imageUnknownAvatar
.
setVisible
(
true
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
29a51143
...
...
@@ -12,11 +12,11 @@ import android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.presentation.ChatRoomPresenter
import
chat.rocket.android.chatroom.presentation.ChatRoomView
import
chat.rocket.android.chatroom.viewmodel.MessageViewModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.textContent
import
chat.rocket.core.model.Message
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_chat_room.*
import
kotlinx.android.synthetic.main.message_composer.*
...
...
@@ -75,10 +75,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
super
.
onDestroyView
()
}
override
fun
showMessages
(
dataSet
:
List
<
Message
>,
serverUrl
:
String
)
{
override
fun
showMessages
(
dataSet
:
List
<
Message
ViewModel
>,
serverUrl
:
String
)
{
activity
?.
apply
{
if
(
recycler_view
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
this
,
serverUrl
)
adapter
=
ChatRoomAdapter
(
serverUrl
)
recycler_view
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
true
)
recycler_view
.
layoutManager
=
linearLayoutManager
...
...
@@ -102,7 +102,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
}
}
override
fun
showNewMessage
(
message
:
Message
)
{
override
fun
showNewMessage
(
message
:
Message
ViewModel
)
{
text_message
.
textContent
=
""
adapter
.
addItem
(
message
)
recycler_view
.
smoothScrollToPosition
(
0
)
...
...
@@ -119,7 +119,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
if
(
clear
)
text_message
.
textContent
=
""
}
override
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
Message
)
{
override
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
Message
ViewModel
)
{
adapter
.
updateItem
(
index
,
message
)
}
...
...
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
29a51143
...
...
@@ -13,7 +13,7 @@ import chat.rocket.android.profile.presentation.ProfilePresenter
import
chat.rocket.android.profile.presentation.ProfileView
import
chat.rocket.android.util.getObservable
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisib
ility
import
chat.rocket.android.util.setVisib
le
import
chat.rocket.android.util.textContent
import
dagger.android.support.AndroidSupportInjection
import
io.reactivex.rxkotlin.Observables
...
...
@@ -62,7 +62,7 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
currentUsername
=
username
currentEmail
=
email
profile_container
.
setVisib
ility
(
true
)
profile_container
.
setVisib
le
(
true
)
listenToChanges
()
}
...
...
@@ -71,11 +71,11 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
override
fun
showLoading
()
{
enableUserInput
(
false
)
view_loading
.
setVisib
ility
(
true
)
view_loading
.
setVisib
le
(
true
)
}
override
fun
hideLoading
()
{
view_loading
.
setVisib
ility
(
false
)
view_loading
.
setVisib
le
(
false
)
enableUserInput
(
true
)
}
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
29a51143
...
...
@@ -47,4 +47,13 @@
<string
name=
"msg_you"
>
Você
</string>
<string
name=
"msg_unknown"
>
Desconhecido
</string>
<!-- System messages -->
<string
name=
"message_room_name_changed"
>
Nome da sala alterado para: %1$s por %2$s
</string>
<string
name=
"message_user_added_by"
>
Usuário %1$s adicionado por %2$s
</string>
<string
name=
"message_user_removed_by"
>
Usuário %1$s removido por %2$s
</string>
<string
name=
"message_user_left"
>
Saiu da sala.
</string>
<string
name=
"message_user_joined_channel"
>
Entrou no sala.
</string>
<string
name=
"message_welcome"
>
Bem-vindo, %s
</string>
<string
name=
"message_removed"
>
Mensagem removida
</string>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
29a51143
...
...
@@ -49,4 +49,13 @@
<string
name=
"msg_you"
>
You
</string>
<string
name=
"msg_unknown"
>
Unknown
</string>
<!-- System messages -->
<string
name=
"message_room_name_changed"
>
Room name changed to: %1$s by %2$s
</string>
<string
name=
"message_user_added_by"
>
User %1$s added by %2$s
</string>
<string
name=
"message_user_removed_by"
>
User %1$s removed by %2$s
</string>
<string
name=
"message_user_left"
>
Has left the channel.
</string>
<string
name=
"message_user_joined_channel"
>
Has joined the channel.
</string>
<string
name=
"message_welcome"
>
Welcome %s
</string>
<string
name=
"message_removed"
>
Message removed
</string>
</resources>
\ 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