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
d6b226c4
Commit
d6b226c4
authored
Jun 11, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show users who have read the messages on a separate screen
parent
5a8ef679
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
515 additions
and
3 deletions
+515
-3
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+5
-0
ReadReceiptAdapter.kt
...ket/android/chatinformation/adapter/ReadReceiptAdapter.kt
+48
-0
MessageInfoFragmentModule.kt
...t/android/chatinformation/di/MessageInfoFragmentModule.kt
+30
-0
MessageInfoFragmentProvider.kt
...android/chatinformation/di/MessageInfoFragmentProvider.kt
+12
-0
MessageInfoPresenter.kt
...roid/chatinformation/presentation/MessageInfoPresenter.kt
+43
-0
MessageInfoView.kt
...t/android/chatinformation/presentation/MessageInfoView.kt
+11
-0
MessageInfoActivity.kt
.../rocket/android/chatinformation/ui/MessageInfoActivity.kt
+64
-0
MessageInfoFragment.kt
.../rocket/android/chatinformation/ui/MessageInfoFragment.kt
+111
-0
ReadReceiptViewModel.kt
...android/chatinformation/viewmodel/ReadReceiptViewModel.kt
+7
-0
ChatRoomAdapter.kt
...a/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
+16
-1
ChatRoomNavigator.kt
...rocket/android/chatroom/presentation/ChatRoomNavigator.kt
+6
-0
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+6
-0
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+1
-1
ViewModelMapper.kt
...chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
+24
-0
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+7
-1
UserHelper.kt
app/src/main/java/chat/rocket/android/helper/UserHelper.kt
+5
-0
ic_action_info_outline_24dp.xml
app/src/main/res/drawable/ic_action_info_outline_24dp.xml
+10
-0
fragment_message_info.xml
app/src/main/res/layout/fragment_message_info.xml
+55
-0
item_read_receipt.xml
app/src/main/res/layout/item_read_receipt.xml
+44
-0
message_actions.xml
app/src/main/res/menu/message_actions.xml
+5
-0
strings.xml
app/src/main/res/values-es/strings.xml
+1
-0
strings.xml
app/src/main/res/values-fr/strings.xml
+1
-0
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+1
-0
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
d6b226c4
...
...
@@ -74,6 +74,11 @@
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
/>
<activity
android:name=
".chatinformation.ui.MessageInfoActivity"
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
/>
<!-- TODO: Change to fragment-->
<activity
android:name=
".settings.password.ui.PasswordActivity"
...
...
app/src/main/java/chat/rocket/android/chatinformation/adapter/ReadReceiptAdapter.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.adapter
import
android.support.v7.widget.RecyclerView
import
android.view.View
import
android.view.ViewGroup
import
chat.rocket.android.R
import
chat.rocket.android.chatinformation.adapter.ReadReceiptAdapter.ReadReceiptViewHolder
import
chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import
chat.rocket.android.util.extensions.inflate
import
kotlinx.android.synthetic.main.avatar.view.*
import
kotlinx.android.synthetic.main.item_read_receipt.view.*
class
ReadReceiptAdapter
:
RecyclerView
.
Adapter
<
ReadReceiptViewHolder
>()
{
private
val
data
=
ArrayList
<
ReadReceiptViewModel
>()
init
{
setHasStableIds
(
true
)
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ReadReceiptViewHolder
{
return
ReadReceiptViewHolder
(
parent
.
inflate
(
R
.
layout
.
item_read_receipt
,
false
))
}
override
fun
getItemCount
():
Int
{
return
data
.
size
}
override
fun
onBindViewHolder
(
holder
:
ReadReceiptViewHolder
,
position
:
Int
)
{
holder
.
bind
(
data
[
position
])
}
fun
addAll
(
items
:
List
<
ReadReceiptViewModel
>)
{
data
.
clear
()
data
.
addAll
(
items
)
notifyItemRangeInserted
(
0
,
items
.
size
)
}
class
ReadReceiptViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
fun
bind
(
readReceipt
:
ReadReceiptViewModel
)
{
with
(
itemView
)
{
image_avatar
.
setImageURI
(
readReceipt
.
avatar
)
receipt_name
.
text
=
readReceipt
.
name
receipt_time
.
text
=
readReceipt
.
time
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatinformation/di/MessageInfoFragmentModule.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.di
import
android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.chatinformation.presentation.MessageInfoView
import
chat.rocket.android.chatinformation.ui.MessageInfoFragment
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
@Module
@PerFragment
class
MessageInfoFragmentModule
{
@Provides
fun
messageInfoView
(
frag
:
MessageInfoFragment
):
MessageInfoView
{
return
frag
}
@Provides
fun
provideLifecycleOwner
(
frag
:
MessageInfoFragment
):
LifecycleOwner
{
return
frag
}
@Provides
fun
provideCancelStrategy
(
owner
:
LifecycleOwner
,
jobs
:
Job
):
CancelStrategy
{
return
CancelStrategy
(
owner
,
jobs
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatinformation/di/MessageInfoFragmentProvider.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.di
import
chat.rocket.android.chatinformation.ui.MessageInfoFragment
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
@Module
abstract
class
MessageInfoFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
MessageInfoFragmentModule
::
class
])
abstract
fun
provideMessageInfoFragment
():
MessageInfoFragment
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatinformation/presentation/MessageInfoPresenter.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.presentation
import
chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import
chat.rocket.android.chatroom.viewmodel.ViewModelMapper
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.MessagesRepository
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.common.RocketChatException
import
chat.rocket.core.internal.rest.getMessageReadReceipts
import
chat.rocket.core.internal.rest.queryUsers
import
timber.log.Timber
import
javax.inject.Inject
class
MessageInfoPresenter
@Inject
constructor
(
private
val
view
:
MessageInfoView
,
private
val
strategy
:
CancelStrategy
,
private
val
mapper
:
ViewModelMapper
,
serverInteractor
:
GetCurrentServerInteractor
,
factory
:
ConnectionManagerFactory
)
{
private
val
currentServer
=
serverInteractor
.
get
()
!!
private
val
manager
=
factory
.
create
(
currentServer
)
private
val
client
=
manager
.
client
fun
loadReadReceipts
(
messageId
:
String
)
{
launchUI
(
strategy
)
{
try
{
view
.
showLoading
()
val
readReceipts
=
client
.
getMessageReadReceipts
(
messageId
=
messageId
).
result
view
.
showReadReceipts
(
mapper
.
map
(
readReceipts
))
}
catch
(
ex
:
RocketChatException
)
{
Timber
.
e
(
ex
)
view
.
showGenericErrorMessage
()
}
finally
{
view
.
hideLoading
()
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatinformation/presentation/MessageInfoView.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.presentation
import
chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import
chat.rocket.android.core.behaviours.LoadingView
interface
MessageInfoView
:
LoadingView
{
fun
showGenericErrorMessage
()
fun
showReadReceipts
(
messageReceipts
:
List
<
ReadReceiptViewModel
>)
}
app/src/main/java/chat/rocket/android/chatinformation/ui/MessageInfoActivity.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.ui
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
chat.rocket.android.R
import
chat.rocket.android.chatinformation.ui.MessageInfoFragment.Companion.TAG_MESSAGE_INFO_FRAGMENT
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.android.util.extensions.textContent
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.support.HasSupportFragmentInjector
import
kotlinx.android.synthetic.main.app_bar_chat_room.*
import
javax.inject.Inject
fun
Context
.
messageInformationIntent
(
messageId
:
String
):
Intent
{
return
Intent
(
this
,
MessageInfoActivity
::
class
.
java
).
apply
{
putExtra
(
INTENT_MESSAGE_ID
,
messageId
)
}
}
private
const
val
INTENT_MESSAGE_ID
=
"message_id"
class
MessageInfoActivity
:
AppCompatActivity
(),
HasSupportFragmentInjector
{
@Inject
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_chat_room
)
setupToolbar
()
val
messageId
=
intent
.
getStringExtra
(
INTENT_MESSAGE_ID
)
requireNotNull
(
messageId
)
{
"no message_id provided in Intent extras"
}
if
(
supportFragmentManager
.
findFragmentByTag
(
TAG_MESSAGE_INFO_FRAGMENT
)
==
null
)
{
addFragment
(
TAG_MESSAGE_INFO_FRAGMENT
,
R
.
id
.
fragment_container
)
{
newInstance
(
messageId
=
messageId
)
}
}
}
private
fun
setupToolbar
()
{
text_room_name
.
textContent
=
"Informações da mensagem"
setSupportActionBar
(
toolbar
)
supportActionBar
?.
setDisplayShowTitleEnabled
(
false
)
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_arrow_back_white_24dp
)
toolbar
.
setNavigationOnClickListener
{
finishActivity
()
}
}
private
fun
finishActivity
()
{
super
.
onBackPressed
()
overridePendingTransition
(
R
.
anim
.
close_enter
,
R
.
anim
.
close_exit
)
}
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
{
return
fragmentDispatchingAndroidInjector
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatinformation/ui/MessageInfoFragment.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.ui
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v7.widget.DefaultItemAnimator
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
chat.rocket.android.R
import
chat.rocket.android.chatinformation.adapter.ReadReceiptAdapter
import
chat.rocket.android.chatinformation.presentation.MessageInfoPresenter
import
chat.rocket.android.chatinformation.presentation.MessageInfoView
import
chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.core.model.ReadReceipt
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_message_info.*
import
javax.inject.Inject
fun
newInstance
(
messageId
:
String
):
Fragment
{
return
MessageInfoFragment
().
apply
{
arguments
=
Bundle
(
1
).
apply
{
putString
(
BUNDLE_MESSAGE_ID
,
messageId
)
}
}
}
private
const
val
BUNDLE_MESSAGE_ID
=
"message_id"
class
MessageInfoFragment
:
Fragment
(),
MessageInfoView
{
@Inject
lateinit
var
presenter
:
MessageInfoPresenter
private
lateinit
var
adapter
:
ReadReceiptAdapter
private
lateinit
var
endlessRecyclerViewScrollListener
:
EndlessRecyclerViewScrollListener
private
lateinit
var
messageId
:
String
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
AndroidSupportInjection
.
inject
(
this
)
setHasOptionsMenu
(
true
)
val
bundle
=
arguments
if
(
bundle
!=
null
)
{
messageId
=
bundle
.
getString
(
BUNDLE_MESSAGE_ID
)
}
else
{
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_message_info
,
container
,
false
)
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
setupRecyclerView
()
presenter
.
loadReadReceipts
(
messageId
=
messageId
)
}
override
fun
onDestroyView
()
{
super
.
onDestroyView
()
receipt_list
.
removeOnScrollListener
(
endlessRecyclerViewScrollListener
)
}
private
fun
setupRecyclerView
()
{
// Initialize the endlessRecyclerViewScrollListener so we don't NPE at onDestroyView
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
true
)
adapter
=
ReadReceiptAdapter
()
linearLayoutManager
.
stackFromEnd
=
true
receipt_list
.
layoutManager
=
linearLayoutManager
receipt_list
.
itemAnimator
=
DefaultItemAnimator
()
receipt_list
.
adapter
=
adapter
endlessRecyclerViewScrollListener
=
object
:
EndlessRecyclerViewScrollListener
(
receipt_list
.
layoutManager
as
LinearLayoutManager
)
{
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
recyclerView
:
RecyclerView
?)
{
}
}
}
override
fun
showGenericErrorMessage
()
{
showToast
(
R
.
string
.
msg_generic_error
)
}
override
fun
showLoading
()
{
view_loading
.
setVisible
(
true
)
view_loading
.
show
()
}
override
fun
hideLoading
()
{
view_loading
.
hide
()
view_loading
.
setVisible
(
false
)
}
override
fun
showReadReceipts
(
messageReceipts
:
List
<
ReadReceiptViewModel
>)
{
adapter
.
addAll
(
messageReceipts
)
}
companion
object
{
const
val
TAG_MESSAGE_INFO_FRAGMENT
=
"MessageInfoFragment"
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatinformation/viewmodel/ReadReceiptViewModel.kt
0 → 100644
View file @
d6b226c4
package
chat.rocket.android.chatinformation.viewmodel
data class
ReadReceiptViewModel
(
val
avatar
:
String
,
val
name
:
String
,
val
time
:
String
)
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
View file @
d6b226c4
...
...
@@ -5,7 +5,19 @@ import android.view.MenuItem
import
android.view.ViewGroup
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.presentation.ChatRoomPresenter
import
chat.rocket.android.chatroom.viewmodel.*
import
chat.rocket.android.chatroom.viewmodel.AudioAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.AuthorAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.BaseFileAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.BaseViewModel
import
chat.rocket.android.chatroom.viewmodel.ColorAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.GenericFileAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.ImageAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.MessageAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.MessageReplyViewModel
import
chat.rocket.android.chatroom.viewmodel.MessageViewModel
import
chat.rocket.android.chatroom.viewmodel.UrlPreviewViewModel
import
chat.rocket.android.chatroom.viewmodel.VideoAttachmentViewModel
import
chat.rocket.android.chatroom.viewmodel.toViewType
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.widget.emoji.EmojiReactionListener
import
chat.rocket.core.model.Message
...
...
@@ -203,6 +215,9 @@ class ChatRoomAdapter(
override
fun
onActionSelected
(
item
:
MenuItem
,
message
:
Message
)
{
message
.
apply
{
when
(
item
.
itemId
)
{
R
.
id
.
action_message_info
->
{
presenter
?.
messageInfo
(
id
)
}
R
.
id
.
action_message_reply
->
{
if
(
roomName
!=
null
&&
roomType
!=
null
)
{
presenter
?.
citeMessage
(
roomName
,
roomType
,
id
,
true
)
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomNavigator.kt
View file @
d6b226c4
package
chat.rocket.android.chatroom.presentation
import
chat.rocket.android.R
import
chat.rocket.android.chatinformation.ui.messageInformationIntent
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatroom.ui.chatRoomIntent
import
chat.rocket.android.server.ui.changeServerIntent
...
...
@@ -49,4 +50,9 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
isChatRoomReadOnly
,
chatRoomLastSeen
,
isChatRoomSubscribed
,
isChatRoomCreator
,
chatRoomMessage
))
activity
.
overridePendingTransition
(
R
.
anim
.
open_enter
,
R
.
anim
.
open_exit
)
}
fun
toMessageInformation
(
messageId
:
String
)
{
activity
.
startActivity
(
activity
.
messageInformationIntent
(
messageId
=
messageId
))
activity
.
overridePendingTransition
(
R
.
anim
.
open_enter
,
R
.
anim
.
open_exit
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
d6b226c4
...
...
@@ -851,4 +851,10 @@ class ChatRoomPresenter @Inject constructor(
}
}
}
fun
messageInfo
(
messageId
:
String
)
{
launchUI
(
strategy
)
{
navigator
.
toMessageInformation
(
messageId
=
messageId
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
d6b226c4
...
...
@@ -146,4 +146,4 @@ interface ChatRoomView : LoadingView, MessageView {
* to reply.
*/
fun
openDirectMessage
(
chatRoom
:
ChatRoom
,
permalink
:
String
)
}
\ No newline at end of file
}
app/src/main/java/chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
View file @
d6b226c4
...
...
@@ -13,14 +13,18 @@ import androidx.core.text.buildSpannedString
import
androidx.core.text.color
import
androidx.core.text.scale
import
chat.rocket.android.R
import
chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import
chat.rocket.android.chatroom.domain.MessageReply
import
chat.rocket.android.helper.MessageHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.ChatRoomsInteractor
import
chat.rocket.android.server.domain.GetActiveUsersInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.android.server.domain.UsersRepository
import
chat.rocket.android.server.domain.baseUrl
import
chat.rocket.android.server.domain.messageReadReceiptEnabled
import
chat.rocket.android.server.domain.useRealName
...
...
@@ -30,6 +34,7 @@ import chat.rocket.android.widget.emoji.EmojiParser
import
chat.rocket.core.model.ChatRoom
import
chat.rocket.core.model.Message
import
chat.rocket.core.model.MessageType
import
chat.rocket.core.model.ReadReceipt
import
chat.rocket.core.model.Value
import
chat.rocket.core.model.attachment.Attachment
import
chat.rocket.core.model.attachment.AudioAttachment
...
...
@@ -52,7 +57,9 @@ class ViewModelMapper @Inject constructor(
private
val
context
:
Context
,
private
val
parser
:
MessageParser
,
private
val
roomsInteractor
:
ChatRoomsInteractor
,
private
val
usersRepository
:
UsersRepository
,
private
val
messageHelper
:
MessageHelper
,
private
val
userHelper
:
UserHelper
,
tokenRepository
:
TokenRepository
,
serverInteractor
:
GetCurrentServerInteractor
,
getSettingsInteractor
:
GetSettingsInteractor
,
...
...
@@ -90,6 +97,23 @@ class ViewModelMapper @Inject constructor(
return
@withContext
list
}
suspend
fun
map
(
readReceipts
:
List
<
ReadReceipt
>
):
List
<
ReadReceiptViewModel
>
=
withContext
(
CommonPool
)
{
val
list
=
arrayListOf
<
ReadReceiptViewModel
>()
readReceipts
.
forEach
{
list
.
add
(
ReadReceiptViewModel
(
avatar
=
baseUrl
.
avatarUrl
(
it
.
user
.
username
?:
""
),
name
=
userHelper
.
displayName
(
it
.
user
),
time
=
DateTimeHelper
.
getTime
(
DateTimeHelper
.
getLocalDateTime
(
it
.
timestamp
))
)
)
}
return
@withContext
list
}
private
suspend
fun
translate
(
message
:
Message
,
roomViewModel
:
RoomViewModel
...
...
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
d6b226c4
...
...
@@ -8,6 +8,8 @@ import chat.rocket.android.authentication.server.di.ServerFragmentProvider
import
chat.rocket.android.authentication.signup.di.SignupFragmentProvider
import
chat.rocket.android.authentication.twofactor.di.TwoFAFragmentProvider
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.chatinformation.di.MessageInfoFragmentProvider
import
chat.rocket.android.chatinformation.ui.MessageInfoActivity
import
chat.rocket.android.chatroom.di.ChatRoomFragmentProvider
import
chat.rocket.android.chatroom.di.ChatRoomModule
import
chat.rocket.android.chatroom.di.FavoriteMessagesFragmentProvider
...
...
@@ -72,4 +74,8 @@ abstract class ActivityBuilder {
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
ChangeServerModule
::
class
])
abstract
fun
bindChangeServerActivity
():
ChangeServerActivity
}
\ No newline at end of file
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
MessageInfoFragmentProvider
::
class
])
abstract
fun
bindMessageInfoActiviy
():
MessageInfoActivity
}
app/src/main/java/chat/rocket/android/helper/UserHelper.kt
View file @
d6b226c4
...
...
@@ -5,6 +5,7 @@ import chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.SettingsRepository
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.common.model.SimpleUser
import
chat.rocket.common.model.User
import
javax.inject.Inject
...
...
@@ -26,6 +27,10 @@ class UserHelper @Inject constructor(
return
if
(
settings
.
useRealName
())
user
.
name
?:
user
.
username
else
user
.
username
}
fun
displayName
(
user
:
SimpleUser
):
String
{
return
if
(
settings
.
useRealName
())
user
.
name
?:
user
.
username
?:
""
else
user
.
username
?:
""
}
/**
* Return current logged user's display name.
*
...
...
app/src/main/res/drawable/ic_action_info_outline_24dp.xml
0 → 100644
View file @
d6b226c4
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:tint=
"#999999"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
>
<path
android:fillColor=
"@color/actionMenuColor"
android:pathData=
"M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"
/>
</vector>
app/src/main/res/layout/fragment_message_info.xml
0 → 100644
View file @
d6b226c4
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/root_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".chatinformation.ui.MessageInfoActivity"
>
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/view_loading"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
app:indicatorColor=
"@color/colorBlack"
app:indicatorName=
"BallPulseIndicator"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:visibility=
"visible"
/>
<TextView
android:id=
"@+id/text_read_by"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:layout_marginTop=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"8dp"
android:text=
"Lida por"
app:layout_constraintBottom_toTopOf=
"@+id/receipt_list"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/receipt_list"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:scrollbars=
"vertical"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_read_by"
/>
<include
android:id=
"@+id/layout_message_attachment_options"
layout=
"@layout/message_attachment_options"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"5dp"
android:visibility=
"gone"
app:layout_constraintBottom_toTopOf=
"@id/layout_message_composer"
/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/item_read_receipt.xml
0 → 100644
View file @
d6b226c4
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
>
<TextView
android:id=
"@+id/receipt_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"8dp"
android:layout_marginStart=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/receipt_time"
app:layout_constraintStart_toEndOf=
"@+id/avatar_layout"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"John Doe"
/>
<include
android:id=
"@+id/avatar_layout"
layout=
"@layout/avatar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/receipt_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:layout_marginEnd=
"8dp"
android:layout_marginTop=
"8dp"
android:gravity=
"center"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"04/06/2018 14:18:36"
/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/menu/message_actions.xml
View file @
d6b226c4
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@+id/action_message_info"
android:icon=
"@drawable/ic_action_info_outline_24dp"
android:title=
"@string/action_msg_info"
/>
<item
android:id=
"@+id/action_message_reply"
android:icon=
"@drawable/ic_action_message_reply_24dp"
...
...
app/src/main/res/values-es/strings.xml
View file @
d6b226c4
...
...
@@ -143,6 +143,7 @@
<!-- Message actions -->
<string
name=
"action_msg_reply"
>
Respuesta
</string>
<string
name=
"action_msg_info"
>
Información del mensaje
</string>
<string
name=
"action_msg_edit"
>
Editar
</string>
<string
name=
"action_msg_copy"
>
Copiar
</string>
<string
name=
"action_msg_quote"
>
Citar
</string>
...
...
app/src/main/res/values-fr/strings.xml
View file @
d6b226c4
...
...
@@ -142,6 +142,7 @@
<!-- Message actions -->
<string
name=
"action_msg_reply"
>
Répondre
</string>
<string
name=
"action_msg_info"
>
Informations sur le message
</string>
<string
name=
"action_msg_edit"
>
Modifier
</string>
<string
name=
"action_msg_copy"
>
Copier
</string>
<string
name=
"action_msg_quote"
>
Citation
</string>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
d6b226c4
...
...
@@ -144,6 +144,7 @@
<!-- Message actions -->
<string
name=
"action_msg_reply"
>
जवाब दें
</string>
<string
name=
"action_msg_info"
>
संदेश जानकारी
</string>
<string
name=
"action_msg_edit"
>
संपादन करें
</string>
<string
name=
"action_msg_copy"
>
कॉपी
</string>
<string
name=
"action_msg_quote"
>
उद्धरण
</string>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
d6b226c4
...
...
@@ -133,6 +133,7 @@
<!-- Message actions -->
<string
name=
"action_msg_reply"
>
Responder
</string>
<string
name=
"action_msg_info"
>
Informações da mensagem
</string>
<string
name=
"action_msg_edit"
>
Editar
</string>
<string
name=
"action_msg_copy"
>
Copiar
</string>
<string
name=
"action_msg_quote"
>
Citar
</string>
...
...
app/src/main/res/values/strings.xml
View file @
d6b226c4
...
...
@@ -132,6 +132,7 @@
<!-- Message actions -->
<string
name=
"action_msg_reply"
>
Reply
</string>
<string
name=
"action_msg_info"
>
Message info
</string>
<string
name=
"action_msg_edit"
>
Edit
</string>
<string
name=
"action_msg_copy"
>
Copy
</string>
<string
name=
"action_msg_quote"
>
Quote
</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