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
7d58b105
Commit
7d58b105
authored
Aug 04, 2017
by
Lucio Maciel
Committed by
GitHub
Aug 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #377 from filipedelimabrito/avatar-with-username-initials
Remove user not found handling.
parents
8ac51b53
d6b188cc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
174 additions
and
201 deletions
+174
-201
AbstractMessageViewHolder.java
...roid/layouthelper/chatroom/AbstractMessageViewHolder.java
+0
-2
MessageNormalViewHolder.java
...ndroid/layouthelper/chatroom/MessageNormalViewHolder.java
+1
-1
MessageSystemViewHolder.java
...ndroid/layouthelper/chatroom/MessageSystemViewHolder.java
+1
-1
MessageRenderer.kt
...main/java/chat/rocket/android/renderer/MessageRenderer.kt
+11
-12
UserRenderer.kt
...rc/main/java/chat/rocket/android/renderer/UserRenderer.kt
+4
-2
ic_user_not_found_avatar_black_24dp.xml
...main/res/drawable/ic_user_not_found_avatar_black_24dp.xml
+0
-9
list_item_normal_message.xml
app/src/main/res/layout/list_item_normal_message.xml
+91
-99
list_item_system_message.xml
app/src/main/res/layout/list_item_system_message.xml
+66
-74
strings.xml
app/src/main/res/values/strings.xml
+0
-1
No files found.
app/src/main/java/chat/rocket/android/layouthelper/chatroom/AbstractMessageViewHolder.java
View file @
7d58b105
...
@@ -13,7 +13,6 @@ import chat.rocket.core.SyncState;
...
@@ -13,7 +13,6 @@ import chat.rocket.core.SyncState;
public
abstract
class
AbstractMessageViewHolder
extends
ModelViewHolder
<
PairedMessage
>
{
public
abstract
class
AbstractMessageViewHolder
extends
ModelViewHolder
<
PairedMessage
>
{
protected
final
RocketChatAvatar
avatar
;
protected
final
RocketChatAvatar
avatar
;
protected
final
ImageView
userNotFoundAvatarImageView
;
protected
final
ImageView
errorImageView
;
protected
final
ImageView
errorImageView
;
protected
final
TextView
username
;
protected
final
TextView
username
;
protected
final
TextView
subUsername
;
protected
final
TextView
subUsername
;
...
@@ -30,7 +29,6 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
...
@@ -30,7 +29,6 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
public
AbstractMessageViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
public
AbstractMessageViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
super
(
itemView
);
super
(
itemView
);
avatar
=
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
avatar
=
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
userNotFoundAvatarImageView
=
itemView
.
findViewById
(
R
.
id
.
userNotFoundAvatarImageView
);
errorImageView
=
itemView
.
findViewById
(
R
.
id
.
errorImageView
);
errorImageView
=
itemView
.
findViewById
(
R
.
id
.
errorImageView
);
username
=
itemView
.
findViewById
(
R
.
id
.
username
);
username
=
itemView
.
findViewById
(
R
.
id
.
username
);
subUsername
=
itemView
.
findViewById
(
R
.
id
.
sub_username
);
subUsername
=
itemView
.
findViewById
(
R
.
id
.
sub_username
);
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageNormalViewHolder.java
View file @
7d58b105
...
@@ -29,7 +29,7 @@ public class MessageNormalViewHolder extends AbstractMessageViewHolder {
...
@@ -29,7 +29,7 @@ public class MessageNormalViewHolder extends AbstractMessageViewHolder {
@Override
@Override
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
MessageRenderer
messageRenderer
=
new
MessageRenderer
(
pairedMessage
.
target
,
autoloadImages
);
MessageRenderer
messageRenderer
=
new
MessageRenderer
(
pairedMessage
.
target
,
autoloadImages
);
messageRenderer
.
showAvatar
(
avatar
,
hostname
,
userNotFoundAvatarImageView
);
messageRenderer
.
showAvatar
(
avatar
,
hostname
);
messageRenderer
.
showUsername
(
username
,
subUsername
);
messageRenderer
.
showUsername
(
username
,
subUsername
);
messageRenderer
.
showTimestampOrMessageState
(
timestamp
);
messageRenderer
.
showTimestampOrMessageState
(
timestamp
);
messageRenderer
.
showBody
(
body
);
messageRenderer
.
showBody
(
body
);
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageSystemViewHolder.java
View file @
7d58b105
...
@@ -24,7 +24,7 @@ public class MessageSystemViewHolder extends AbstractMessageViewHolder {
...
@@ -24,7 +24,7 @@ public class MessageSystemViewHolder extends AbstractMessageViewHolder {
@Override
@Override
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
MessageRenderer
messageRenderer
=
new
MessageRenderer
(
pairedMessage
.
target
,
autoloadImages
);
MessageRenderer
messageRenderer
=
new
MessageRenderer
(
pairedMessage
.
target
,
autoloadImages
);
messageRenderer
.
showAvatar
(
avatar
,
hostname
,
userNotFoundAvatarImageView
);
messageRenderer
.
showAvatar
(
avatar
,
hostname
);
messageRenderer
.
showUsername
(
username
,
subUsername
);
messageRenderer
.
showUsername
(
username
,
subUsername
);
messageRenderer
.
showTimestampOrMessageState
(
timestamp
);
messageRenderer
.
showTimestampOrMessageState
(
timestamp
);
if
(
pairedMessage
.
target
!=
null
)
{
if
(
pairedMessage
.
target
!=
null
)
{
...
...
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.kt
View file @
7d58b105
package
chat.rocket.android.renderer
package
chat.rocket.android.renderer
import
android.view.View
import
android.view.View
import
android.widget.ImageView
import
android.widget.TextView
import
android.widget.TextView
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.helper.DateTime
import
chat.rocket.android.helper.DateTime
...
@@ -19,10 +18,9 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
...
@@ -19,10 +18,9 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
/**
/**
* Show user's avatar image in RocketChatAvatar widget.
* Show user's avatar image in RocketChatAvatar widget.
*/
*/
fun
showAvatar
(
rocketChatAvatarWidget
:
RocketChatAvatar
,
hostname
:
String
,
userNotFoundAvatarImageView
:
ImageView
)
{
fun
showAvatar
(
rocketChatAvatarWidget
:
RocketChatAvatar
,
hostname
:
String
)
{
val
username
:
String
?
=
message
.
user
?.
username
val
username
:
String
?
=
message
.
user
?.
username
if
(
username
!=
null
)
{
if
(
username
!=
null
)
{
userNotFoundAvatarImageView
.
visibility
=
View
.
GONE
val
placeholderDrawable
=
UserAvatarHelper
.
getTextDrawable
(
username
,
rocketChatAvatarWidget
.
context
)
val
placeholderDrawable
=
UserAvatarHelper
.
getTextDrawable
(
username
,
rocketChatAvatarWidget
.
context
)
if
(
message
.
avatar
!=
null
)
{
if
(
message
.
avatar
!=
null
)
{
// Load user's avatar image from Oauth provider URI.
// Load user's avatar image from Oauth provider URI.
...
@@ -32,7 +30,6 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
...
@@ -32,7 +30,6 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
}
}
}
else
{
}
else
{
rocketChatAvatarWidget
.
visibility
=
View
.
GONE
rocketChatAvatarWidget
.
visibility
=
View
.
GONE
userNotFoundAvatarImageView
.
visibility
=
View
.
VISIBLE
}
}
}
}
...
@@ -40,17 +37,19 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
...
@@ -40,17 +37,19 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
* Show username in textView.
* Show username in textView.
*/
*/
fun
showUsername
(
usernameTextView
:
TextView
,
subUsernameTextView
:
TextView
?)
{
fun
showUsername
(
usernameTextView
:
TextView
,
subUsernameTextView
:
TextView
?)
{
val
username
:
String
?
=
message
.
user
?.
username
if
(
username
!=
null
)
{
if
(
message
.
alias
==
null
)
{
if
(
message
.
alias
==
null
)
{
usernameTextView
.
text
=
message
.
user
?.
username
?:
usernameTextView
.
context
.
getText
(
R
.
string
.
user_not_found
)
usernameTextView
.
text
=
username
}
else
{
}
else
{
usernameTextView
.
text
=
message
.
alias
usernameTextView
.
text
=
message
.
alias
val
username
:
String
?
=
message
.
user
?.
username
if
(
subUsernameTextView
!=
null
)
{
if
(
username
!=
null
&&
subUsernameTextView
!=
null
)
{
subUsernameTextView
.
text
=
subUsernameTextView
.
context
.
getString
(
R
.
string
.
sub_username
,
username
)
subUsernameTextView
.
text
=
subUsernameTextView
.
context
.
getString
(
R
.
string
.
sub_username
,
username
)
subUsernameTextView
.
visibility
=
View
.
VISIBLE
subUsernameTextView
.
visibility
=
View
.
VISIBLE
}
}
}
}
}
}
}
/**
/**
* Show timestamp or message state in textView.
* Show timestamp or message state in textView.
...
...
app/src/main/java/chat/rocket/android/renderer/UserRenderer.kt
View file @
7d58b105
...
@@ -3,7 +3,6 @@ package chat.rocket.android.renderer
...
@@ -3,7 +3,6 @@ package chat.rocket.android.renderer
import
android.view.View
import
android.view.View
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.TextView
import
android.widget.TextView
import
chat.rocket.android.R
import
chat.rocket.android.widget.RocketChatAvatar
import
chat.rocket.android.widget.RocketChatAvatar
import
chat.rocket.android.widget.helper.UserAvatarHelper
import
chat.rocket.android.widget.helper.UserAvatarHelper
import
chat.rocket.core.models.User
import
chat.rocket.core.models.User
...
@@ -26,7 +25,10 @@ class UserRenderer(val user: User) {
...
@@ -26,7 +25,10 @@ class UserRenderer(val user: User) {
* Show username in textView.
* Show username in textView.
*/
*/
fun
showUsername
(
textView
:
TextView
)
{
fun
showUsername
(
textView
:
TextView
)
{
textView
.
text
=
user
.
username
?:
textView
.
context
.
getText
(
R
.
string
.
user_not_found
)
val
username
:
String
?
=
user
.
username
if
(
username
!=
null
)
{
textView
.
text
=
username
}
}
}
/**
/**
...
...
app/src/main/res/drawable/ic_user_not_found_avatar_black_24dp.xml
deleted
100644 → 0
View file @
8ac51b53
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:pathData=
"M-0,0L24,0L24,24L-0,24L-0,0ZM11.963,17.661L12.036,17.661L17.162,17.661C17.162,13.975 13.979,13.915 13.178,12.982L13.082,12.474C14.095,11.946 14.807,10.699 14.807,9.245C14.807,7.313 13.55,5.746 12,5.746C10.45,5.746 9.193,7.313 9.193,9.245C9.193,10.712 9.917,11.966 10.944,12.486L10.86,12.933C10.129,13.913 6.837,13.912 6.837,17.661L11.963,17.661Z"
android:fillColor=
"#FF000000"
/>
</vector>
\ No newline at end of file
app/src/main/res/layout/list_item_normal_message.xml
View file @
7d58b105
...
@@ -20,14 +20,6 @@
...
@@ -20,14 +20,6 @@
android:layout_height=
"32dp"
android:layout_height=
"32dp"
android:layout_margin=
"8dp"
/>
android:layout_margin=
"8dp"
/>
<ImageView
android:id=
"@+id/userNotFoundAvatarImageView"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_margin=
"8dp"
app:srcCompat=
"@drawable/ic_user_not_found_avatar_black_24dp"
android:visibility=
"gone"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/list_item_system_message.xml
View file @
7d58b105
...
@@ -19,14 +19,6 @@
...
@@ -19,14 +19,6 @@
android:layout_height=
"32dp"
android:layout_height=
"32dp"
android:layout_margin=
"8dp"
/>
android:layout_margin=
"8dp"
/>
<ImageView
android:id=
"@+id/userNotFoundAvatarImageView"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_margin=
"8dp"
app:srcCompat=
"@drawable/ic_user_not_found_avatar_black_24dp"
android:visibility=
"gone"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/values/strings.xml
View file @
7d58b105
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
<string
name=
"dialog_user_registration_email"
>
Email
</string>
<string
name=
"dialog_user_registration_email"
>
Email
</string>
<string
name=
"dialog_user_registration_username"
>
Username
</string>
<string
name=
"dialog_user_registration_username"
>
Username
</string>
<string
name=
"sub_username"
>
\@%s
</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=
"dialog_user_registration_password"
>
Password
</string>
<string
name=
"fragment_home_welcome_message"
>
Welcome to Rocket.Chat.Android\nSelect a channel from the drawer.
</string>
<string
name=
"fragment_home_welcome_message"
>
Welcome to Rocket.Chat.Android\nSelect a channel from the drawer.
</string>
<string
name=
"fragment_input_hostname_hostname"
>
Hostname
</string>
<string
name=
"fragment_input_hostname_hostname"
>
Hostname
</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