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
5b4d6f1f
Commit
5b4d6f1f
authored
Jul 25, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update subUsername handling.
parent
297d60c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
15 deletions
+12
-15
MessageRenderer.kt
...main/java/chat/rocket/android/renderer/MessageRenderer.kt
+7
-11
UserRenderer.kt
...rc/main/java/chat/rocket/android/renderer/UserRenderer.kt
+2
-3
list_item_normal_message.xml
app/src/main/res/layout/list_item_normal_message.xml
+2
-1
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.kt
View file @
5b4d6f1f
...
...
@@ -25,11 +25,12 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
rocketChatAvatarWidget
.
loadImage
(
message
.
avatar
)
}
else
{
val
username
:
String
?
=
message
.
user
?.
username
// Load user's avatar image from Rocket.Chat URI if username is not null.
if
(
username
!=
null
)
{
// Load user's avatar image from Rocket.Chat URI.
rocketChatAvatarWidget
.
loadImage
(
RocketChatUserAvatar
(
hostname
,
username
).
imageUri
)
userNotFoundAvatarImageView
.
visibility
=
View
.
GONE
rocketChatAvatarWidget
.
visibility
=
View
.
VISIBLE
}
else
{
// Hide RocketChatAvatar widget and show an "user not found" avatar.
rocketChatAvatarWidget
.
visibility
=
View
.
GONE
userNotFoundAvatarImageView
.
visibility
=
View
.
VISIBLE
}
...
...
@@ -42,17 +43,12 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
fun
showUsername
(
usernameTextView
:
TextView
,
subUsernameTextView
:
TextView
?)
{
if
(
message
.
alias
==
null
)
{
usernameTextView
.
text
=
message
.
user
?.
username
?:
usernameTextView
.
context
.
getText
(
R
.
string
.
user_not_found
)
if
(
subUsernameTextView
!=
null
)
subUsernameTextView
.
visibility
=
View
.
GONE
}
else
{
usernameTextView
.
text
=
message
.
alias
if
(
subUsernameTextView
!=
null
)
{
if
(
message
.
user
!=
null
)
{
subUsernameTextView
.
text
=
"@"
+
message
.
user
?.
username
subUsernameTextView
.
visibility
=
View
.
VISIBLE
}
else
{
subUsernameTextView
.
visibility
=
View
.
GONE
}
val
username
:
String
?
=
message
.
user
?.
username
if
(
username
!=
null
&&
subUsernameTextView
!=
null
)
{
subUsernameTextView
.
text
=
subUsernameTextView
.
context
.
getString
(
R
.
string
.
sub_username
,
username
)
subUsernameTextView
.
visibility
=
View
.
VISIBLE
}
}
}
...
...
app/src/main/java/chat/rocket/android/renderer/UserRenderer.kt
View file @
5b4d6f1f
...
...
@@ -17,10 +17,9 @@ class UserRenderer(val user: User) {
val
username
:
String
?
=
user
.
username
if
(
username
!=
null
)
{
rocketChatAvatarWidget
.
loadImage
(
RocketChatUserAvatar
(
hostname
,
username
).
imageUri
)
}
else
{
rocketChatAvatarWidget
.
visibility
=
View
.
GONE
}
/**
* TODO Load default image for nullable username.
*/
}
/**
...
...
app/src/main/res/layout/list_item_normal_message.xml
View file @
5b4d6f1f
...
...
@@ -59,7 +59,8 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"@style/TextAppearance.RocketChat.Message.SubUsername"
tools:text=
"\@John Doe"
/>
tools:text=
"\@John Doe"
android:visibility=
"gone"
/>
<Space
android:layout_width=
"@dimen/margin_8"
...
...
app/src/main/res/values/strings.xml
View file @
5b4d6f1f
...
...
@@ -28,6 +28,7 @@
<string
name=
"dialog_user_registration_email"
>
Email
</string>
<string
name=
"dialog_user_registration_username"
>
Username
</string>
<string
name=
"sub_username"
>
\@%s
</string>
<string
name=
"user_not_found"
>
User not found
</string>
<string
name=
"dialog_user_registration_password"
>
Password
</string>
<string
name=
"fragment_home_welcome_message"
>
Welcome to Rocket.Chat.Android\nSelect a channel from the drawer.
</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