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
032a72a0
Unverified
Commit
032a72a0
authored
Apr 10, 2018
by
Rafael Kellermann Streit
Committed by
GitHub
Apr 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1064 from RocketChat/fix/room-avatar-url
[FIX] Avatar URL for channels and groups.
parents
8cc38c7d
8a4fb653
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
ChatRoomsAdapter.kt
...java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
+6
-3
MemberViewModel.kt
.../chat/rocket/android/members/viewmodel/MemberViewModel.kt
+1
-1
String.kt
...c/main/java/chat/rocket/android/util/extensions/String.kt
+7
-2
No files found.
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
View file @
032a72a0
...
...
@@ -74,14 +74,17 @@ class ChatRoomsAdapter(private val context: Context,
}
private
fun
bindAvatar
(
chatRoom
:
ChatRoom
,
drawee
:
SimpleDraweeView
)
{
val
avatarId
=
if
(
chatRoom
.
type
is
RoomType
.
DirectMessage
)
chatRoom
.
name
else
"@${chatRoom.name}"
drawee
.
setImageURI
(
chatRoom
.
client
.
url
.
avatarUrl
(
avatarId
))
if
(
chatRoom
.
type
is
RoomType
.
DirectMessage
)
{
drawee
.
setImageURI
(
chatRoom
.
client
.
url
.
avatarUrl
(
chatRoom
.
name
))
}
else
{
drawee
.
setImageURI
(
chatRoom
.
client
.
url
.
avatarUrl
(
chatRoom
.
name
,
true
))
}
}
private
fun
bindName
(
chatRoom
:
ChatRoom
,
textView
:
TextView
)
{
textView
.
textContent
=
chatRoom
.
name
va
r
drawable
=
when
(
chatRoom
.
type
)
{
va
l
drawable
=
when
(
chatRoom
.
type
)
{
is
RoomType
.
Channel
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_channel
,
context
)
}
...
...
app/src/main/java/chat/rocket/android/members/viewmodel/MemberViewModel.kt
View file @
032a72a0
...
...
@@ -25,7 +25,7 @@ class MemberViewModel(private val member: User, private val settings: Map<String
private
fun
getUserAvatar
():
String
?
{
val
username
=
member
.
username
?:
"?"
return
baseUrl
?.
let
{
baseUrl
.
avatarUrl
(
username
,
"png"
)
baseUrl
.
avatarUrl
(
username
,
format
=
"png"
)
}
}
...
...
app/src/main/java/chat/rocket/android/util/extensions/String.kt
View file @
032a72a0
...
...
@@ -10,8 +10,13 @@ fun String.removeTrailingSlash(): String {
}
}
fun
String
.
avatarUrl
(
avatar
:
String
,
format
:
String
=
"jpeg"
)
=
fun
String
.
avatarUrl
(
avatar
:
String
,
isGroupOrChannel
:
Boolean
=
false
,
format
:
String
=
"jpeg"
):
String
{
return
if
(
isGroupOrChannel
)
{
"${removeTrailingSlash()}/avatar/%23${avatar.removeTrailingSlash()}?format=$format"
}
else
{
"${removeTrailingSlash()}/avatar/${avatar.removeTrailingSlash()}?format=$format"
}
}
fun
String
.
serverLogoUrl
(
favicon
:
String
)
=
"${removeTrailingSlash()}/$favicon"
...
...
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