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
96dd998f
Unverified
Commit
96dd998f
authored
Jul 04, 2018
by
divyanshu bhargava
Committed by
GitHub
Jul 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #36 from RocketChat/develop
merge
parents
36598c5d
a43d55b8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
4 deletions
+35
-4
ImageAttachmentViewHolder.kt
...ket/android/chatroom/adapter/ImageAttachmentViewHolder.kt
+2
-0
ImageAttachmentUiModel.kt
...rocket/android/chatroom/uimodel/ImageAttachmentUiModel.kt
+2
-0
UiModelMapper.kt
...ava/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
+14
-1
message_attachment.xml
app/src/main/res/layout/message_attachment.xml
+16
-2
image_actions.xml
app/src/main/res/menu/image_actions.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/ImageAttachmentViewHolder.kt
View file @
96dd998f
...
...
@@ -28,6 +28,8 @@ class ImageAttachmentViewHolder(
}.
build
()
image_attachment
.
controller
=
controller
file_name
.
text
=
data
.
attachmentTitle
file_description
.
text
=
data
.
attachmentDescription
file_text
.
text
=
data
.
attachmentText
image_attachment
.
setOnClickListener
{
ImageHelper
.
openImage
(
context
,
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/ImageAttachmentUiModel.kt
View file @
96dd998f
...
...
@@ -10,6 +10,8 @@ data class ImageAttachmentUiModel(
override
val
messageId
:
String
,
override
val
attachmentUrl
:
String
,
override
val
attachmentTitle
:
CharSequence
,
val
attachmentText
:
String
?,
val
attachmentDescription
:
String
?,
override
val
id
:
Long
,
override
var
reactions
:
List
<
ReactionUiModel
>,
override
var
nextDownStreamMessage
:
BaseUiModel
<*>?
=
null
,
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
View file @
96dd998f
...
...
@@ -13,6 +13,7 @@ import androidx.core.text.buildSpannedString
import
androidx.core.text.color
import
androidx.core.text.scale
import
chat.rocket.android.R
import
chat.rocket.android.app.RocketChatApplication.Companion.context
import
chat.rocket.android.chatroom.domain.MessageReply
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.helper.MessageHelper
...
...
@@ -45,6 +46,8 @@ import kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.withContext
import
okhttp3.HttpUrl
import
java.security.InvalidParameterException
import
java.util.*
import
java.util.Collections.emptyList
import
javax.inject.Inject
@PerFragment
...
...
@@ -285,10 +288,12 @@ class UiModelMapper @Inject constructor(
private
fun
mapFileAttachment
(
message
:
Message
,
attachment
:
FileAttachment
):
BaseUiModel
<
*
>?
{
val
attachmentUrl
=
attachmentUrl
(
attachment
)
val
attachmentTitle
=
attachmentTitle
(
attachment
)
val
attachmentText
=
attachmentText
(
attachment
)
val
attachmentDescription
=
attachmentDescription
(
attachment
)
val
id
=
attachmentId
(
message
,
attachment
)
return
when
(
attachment
)
{
is
ImageAttachment
->
ImageAttachmentUiModel
(
message
,
attachment
,
message
.
id
,
attachmentUrl
,
attachmentTitle
,
id
,
getReactions
(
message
),
attachmentUrl
,
attachmentTitle
,
attachmentText
,
attachmentDescription
,
id
,
getReactions
(
message
),
preview
=
message
.
copy
(
message
=
context
.
getString
(
R
.
string
.
msg_preview_photo
)))
is
VideoAttachment
->
VideoAttachmentUiModel
(
message
,
attachment
,
message
.
id
,
attachmentUrl
,
attachmentTitle
,
id
,
getReactions
(
message
),
...
...
@@ -338,6 +343,14 @@ class UiModelMapper @Inject constructor(
}
}
private
fun
attachmentText
(
attachment
:
FileAttachment
):
String
?
{
return
attachment
.
text
}
private
fun
attachmentDescription
(
attachment
:
FileAttachment
):
String
?
{
return
attachment
.
description
}
private
suspend
fun
mapMessage
(
message
:
Message
):
MessageUiModel
=
withContext
(
CommonPool
)
{
val
sender
=
getSenderName
(
message
)
val
time
=
getTime
(
message
.
timestamp
)
...
...
app/src/main/res/layout/message_attachment.xml
View file @
96dd998f
...
...
@@ -10,6 +10,20 @@
android:paddingEnd=
"@dimen/screen_edge_left_and_right_margins"
android:paddingStart=
"72dp"
>
<TextView
android:id=
"@+id/file_name"
style=
"@style/Message.TextView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:text=
"Filename.png"
/>
<TextView
android:id=
"@+id/file_description"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:text=
"Some description"
/>
<com.facebook.drawee.view.SimpleDraweeView
android:id=
"@+id/image_attachment"
android:layout_width=
"match_parent"
...
...
@@ -34,10 +48,10 @@
</FrameLayout>
<TextView
android:id=
"@+id/file_
name
"
android:id=
"@+id/file_
text
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:text=
"
Filename.png
"
/>
tools:text=
"
Some text
"
/>
<include
layout=
"@layout/layout_reactions"
...
...
app/src/main/res/menu/image_actions.xml
View file @
96dd998f
...
...
@@ -6,5 +6,5 @@
android:id=
"@+id/action_save_image"
android:icon=
"@drawable/ic_file_download_white_24dp"
android:title=
"@string/action_save_to_gallery"
a
ndroid
:showAsAction=
"always"
/>
a
pp
:showAsAction=
"always"
/>
</menu>
\ 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