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
8a4fb653
Commit
8a4fb653
authored
Apr 10, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix avatar URL for channels and groups.
parent
8cc38c7d
Changes
3
Hide 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 @
8a4fb653
...
@@ -74,14 +74,17 @@ class ChatRoomsAdapter(private val context: Context,
...
@@ -74,14 +74,17 @@ class ChatRoomsAdapter(private val context: Context,
}
}
private
fun
bindAvatar
(
chatRoom
:
ChatRoom
,
drawee
:
SimpleDraweeView
)
{
private
fun
bindAvatar
(
chatRoom
:
ChatRoom
,
drawee
:
SimpleDraweeView
)
{
val
avatarId
=
if
(
chatRoom
.
type
is
RoomType
.
DirectMessage
)
chatRoom
.
name
else
"@${chatRoom.name}"
if
(
chatRoom
.
type
is
RoomType
.
DirectMessage
)
{
drawee
.
setImageURI
(
chatRoom
.
client
.
url
.
avatarUrl
(
avatarId
))
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
)
{
private
fun
bindName
(
chatRoom
:
ChatRoom
,
textView
:
TextView
)
{
textView
.
textContent
=
chatRoom
.
name
textView
.
textContent
=
chatRoom
.
name
va
r
drawable
=
when
(
chatRoom
.
type
)
{
va
l
drawable
=
when
(
chatRoom
.
type
)
{
is
RoomType
.
Channel
->
{
is
RoomType
.
Channel
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_channel
,
context
)
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_channel
,
context
)
}
}
...
...
app/src/main/java/chat/rocket/android/members/viewmodel/MemberViewModel.kt
View file @
8a4fb653
...
@@ -25,7 +25,7 @@ class MemberViewModel(private val member: User, private val settings: Map<String
...
@@ -25,7 +25,7 @@ class MemberViewModel(private val member: User, private val settings: Map<String
private
fun
getUserAvatar
():
String
?
{
private
fun
getUserAvatar
():
String
?
{
val
username
=
member
.
username
?:
"?"
val
username
=
member
.
username
?:
"?"
return
baseUrl
?.
let
{
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 @
8a4fb653
...
@@ -10,8 +10,13 @@ fun String.removeTrailingSlash(): String {
...
@@ -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
{
"${removeTrailingSlash()}/avatar/${avatar.removeTrailingSlash()}?format=$format"
return
if
(
isGroupOrChannel
)
{
"${removeTrailingSlash()}/avatar/%23${avatar.removeTrailingSlash()}?format=$format"
}
else
{
"${removeTrailingSlash()}/avatar/${avatar.removeTrailingSlash()}?format=$format"
}
}
fun
String
.
serverLogoUrl
(
favicon
:
String
)
=
"${removeTrailingSlash()}/$favicon"
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