Commit 53901664 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update classes.

parent 8471796e
...@@ -5,9 +5,9 @@ import android.widget.ImageView ...@@ -5,9 +5,9 @@ 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
import chat.rocket.android.helper.RocketChatUserAvatar
import chat.rocket.android.widget.AbsoluteUrl import chat.rocket.android.widget.AbsoluteUrl
import chat.rocket.android.widget.RocketChatAvatar import chat.rocket.android.widget.RocketChatAvatar
import chat.rocket.android.widget.helper.UserAvatarHelper
import chat.rocket.android.widget.message.RocketChatMessageAttachmentsLayout import chat.rocket.android.widget.message.RocketChatMessageAttachmentsLayout
import chat.rocket.android.widget.message.RocketChatMessageLayout import chat.rocket.android.widget.message.RocketChatMessageLayout
import chat.rocket.android.widget.message.RocketChatMessageUrlsLayout import chat.rocket.android.widget.message.RocketChatMessageUrlsLayout
...@@ -23,12 +23,12 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) { ...@@ -23,12 +23,12 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
val username: String? = message.user?.username val username: String? = message.user?.username
if (username != null) { if (username != null) {
userNotFoundAvatarImageView.visibility = View.GONE userNotFoundAvatarImageView.visibility = View.GONE
val placeholderDrawable = RocketChatUserAvatar.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.
rocketChatAvatarWidget.loadImage(message.avatar, placeholderDrawable) rocketChatAvatarWidget.loadImage(message.avatar, placeholderDrawable)
} else { } else {
rocketChatAvatarWidget.loadImage(RocketChatUserAvatar.getUri(hostname, username), placeholderDrawable) rocketChatAvatarWidget.loadImage(UserAvatarHelper.getUri(hostname, username), placeholderDrawable)
} }
} else { } else {
rocketChatAvatarWidget.visibility = View.GONE rocketChatAvatarWidget.visibility = View.GONE
......
...@@ -4,8 +4,8 @@ import android.view.View ...@@ -4,8 +4,8 @@ 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.R
import chat.rocket.android.helper.RocketChatUserAvatar
import chat.rocket.android.widget.RocketChatAvatar import chat.rocket.android.widget.RocketChatAvatar
import chat.rocket.android.widget.helper.UserAvatarHelper
import chat.rocket.core.models.User import chat.rocket.core.models.User
class UserRenderer(val user: User) { class UserRenderer(val user: User) {
...@@ -16,7 +16,7 @@ class UserRenderer(val user: User) { ...@@ -16,7 +16,7 @@ class UserRenderer(val user: User) {
fun showAvatar(rocketChatAvatarWidget: RocketChatAvatar, hostname: String) { fun showAvatar(rocketChatAvatarWidget: RocketChatAvatar, hostname: String) {
val username: String? = user.username val username: String? = user.username
if (username != null) { if (username != null) {
rocketChatAvatarWidget.loadImage(RocketChatUserAvatar.getUri(hostname, username), RocketChatUserAvatar.getTextDrawable(username, rocketChatAvatarWidget.context)) rocketChatAvatarWidget.loadImage(UserAvatarHelper.getUri(hostname, username), UserAvatarHelper.getTextDrawable(username, rocketChatAvatarWidget.context))
} else { } else {
rocketChatAvatarWidget.visibility = View.GONE rocketChatAvatarWidget.visibility = View.GONE
} }
......
...@@ -41,6 +41,6 @@ public class RocketChatAvatar extends FrameLayout { ...@@ -41,6 +41,6 @@ public class RocketChatAvatar extends FrameLayout {
} }
public void loadImage(String imageUri, Drawable placeholderDrawable) { public void loadImage(String imageUri, Drawable placeholderDrawable) {
FrescoHelper.loadImage(simpleDraweeViewAvatar, imageUri, placeholderDrawable); FrescoHelper.INSTANCE.loadImage(simpleDraweeViewAvatar, imageUri, placeholderDrawable);
} }
} }
\ No newline at end of file
...@@ -119,8 +119,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout { ...@@ -119,8 +119,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
authorBox.setVisibility(VISIBLE); authorBox.setVisibility(VISIBLE);
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization((SimpleDraweeView) attachmentView.findViewById(R.id.author_icon), absolutize(author.getIconUrl()));
.loadImageWithCustomization((SimpleDraweeView) attachmentView.findViewById(R.id.author_icon), absolutize(author.getIconUrl()));
final TextView authorName = (TextView) attachmentView.findViewById(R.id.author_name); final TextView authorName = (TextView) attachmentView.findViewById(R.id.author_name);
authorName.setText(author.getName()); authorName.setText(author.getName());
...@@ -187,8 +186,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout { ...@@ -187,8 +186,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
thumbImage.setVisibility(GONE); thumbImage.setVisibility(GONE);
} else { } else {
thumbImage.setVisibility(VISIBLE); thumbImage.setVisibility(VISIBLE);
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization(thumbImage, absolutize(thumbUrl));
.loadImageWithCustomization(thumbImage, absolutize(thumbUrl));
} }
final TextView refText = (TextView) refBox.findViewById(R.id.text); final TextView refText = (TextView) refBox.findViewById(R.id.text);
...@@ -253,8 +251,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout { ...@@ -253,8 +251,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
boolean autoloadImage) { boolean autoloadImage) {
if (autoloadImage) { if (autoloadImage) {
load.setVisibility(GONE); load.setVisibility(GONE);
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
.loadImageWithCustomization(drawee, url);
return; return;
} }
...@@ -263,8 +260,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout { ...@@ -263,8 +260,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
public void onClick(View v) { public void onClick(View v) {
load.setVisibility(GONE); load.setVisibility(GONE);
load.setOnClickListener(null); load.setOnClickListener(null);
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
.loadImageWithCustomization(drawee, url);
} }
}); });
} }
......
...@@ -95,8 +95,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout { ...@@ -95,8 +95,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
if (TextUtils.isEmpty(imageURL)) { if (TextUtils.isEmpty(imageURL)) {
image.setVisibility(View.GONE); image.setVisibility(View.GONE);
} else { } else {
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization(image, imageURL);
.loadImageWithCustomization(image, imageURL);
image.setVisibility(View.VISIBLE); image.setVisibility(View.VISIBLE);
} }
...@@ -144,8 +143,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout { ...@@ -144,8 +143,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
boolean autoloadImage) { boolean autoloadImage) {
if (autoloadImage) { if (autoloadImage) {
load.setVisibility(GONE); load.setVisibility(GONE);
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
.loadImageWithCustomization(drawee, url);
return; return;
} }
...@@ -154,8 +152,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout { ...@@ -154,8 +152,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
public void onClick(View v) { public void onClick(View v) {
load.setVisibility(GONE); load.setVisibility(GONE);
load.setOnClickListener(null); load.setOnClickListener(null);
FrescoHelper FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
.loadImageWithCustomization(drawee, url);
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment