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
c54a4144
Commit
c54a4144
authored
Aug 01, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RocketChatUserAvatar.kt
parent
ed0f72dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
RocketChatUserAvatar.kt
...n/java/chat/rocket/android/helper/RocketChatUserAvatar.kt
+8
-8
No files found.
app/src/main/java/chat/rocket/android/helper/RocketChatUserAvatar.kt
View file @
c54a4144
...
@@ -61,15 +61,15 @@ object RocketChatUserAvatar {
...
@@ -61,15 +61,15 @@ object RocketChatUserAvatar {
* @return A string with username initials.
* @return A string with username initials.
*/
*/
fun
getUsernameInitials
(
username
:
String
):
String
{
fun
getUsernameInitials
(
username
:
String
):
String
{
val
name
=
username
if
(
username
.
isEmpty
())
{
.
replace
(
"[^A-Za-z0-9]"
,
"."
)
return
"?"
.
replace
(
"\\.+"
,
"."
)
}
.
replace
(
"(^\\.)|(\\.$)"
,
""
)
val
initials
=
name
.
split
(
"."
)
val
splitUsername
=
user
name
.
split
(
"."
)
if
(
initials
.
size
>
1
)
{
if
(
splitUsername
.
size
>
1
)
{
return
(
initials
[
0
].
substring
(
0
,
1
)
+
initials
[
initials
.
size
-
1
].
substring
(
0
,
1
)).
toUpperCase
()
return
(
splitUsername
[
0
].
substring
(
0
,
1
)
+
splitUsername
[
splitUsername
.
size
-
1
].
substring
(
0
,
1
)).
toUpperCase
()
}
else
{
}
else
{
return
(
name
.
replace
(
"[^A-Za-z0-9]"
,
""
).
substring
(
0
,
2
))
.
toUpperCase
()
return
username
.
toUpperCase
()
}
}
}
}
...
...
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