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
import android.widget.TextView
import chat.rocket.android.R
import chat.rocket.android.helper.DateTime
import chat.rocket.android.helper.RocketChatUserAvatar
import chat.rocket.android.widget.AbsoluteUrl
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.RocketChatMessageLayout
import chat.rocket.android.widget.message.RocketChatMessageUrlsLayout
......@@ -23,12 +23,12 @@ class MessageRenderer(val message: Message, val autoLoadImage: Boolean) {
val username: String? = message.user?.username
if (username != null) {
userNotFoundAvatarImageView.visibility = View.GONE
val placeholderDrawable = RocketChatUserAvatar.getTextDrawable(username, rocketChatAvatarWidget.context)
val placeholderDrawable = UserAvatarHelper.getTextDrawable(username, rocketChatAvatarWidget.context)
if (message.avatar != null) {
// Load user's avatar image from Oauth provider URI.
rocketChatAvatarWidget.loadImage(message.avatar, placeholderDrawable)
} else {
rocketChatAvatarWidget.loadImage(RocketChatUserAvatar.getUri(hostname, username), placeholderDrawable)
rocketChatAvatarWidget.loadImage(UserAvatarHelper.getUri(hostname, username), placeholderDrawable)
}
} else {
rocketChatAvatarWidget.visibility = View.GONE
......
......@@ -4,8 +4,8 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import chat.rocket.android.R
import chat.rocket.android.helper.RocketChatUserAvatar
import chat.rocket.android.widget.RocketChatAvatar
import chat.rocket.android.widget.helper.UserAvatarHelper
import chat.rocket.core.models.User
class UserRenderer(val user: User) {
......@@ -16,7 +16,7 @@ class UserRenderer(val user: User) {
fun showAvatar(rocketChatAvatarWidget: RocketChatAvatar, hostname: String) {
val username: String? = user.username
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 {
rocketChatAvatarWidget.visibility = View.GONE
}
......
......@@ -41,6 +41,6 @@ public class RocketChatAvatar extends FrameLayout {
}
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 {
authorBox.setVisibility(VISIBLE);
FrescoHelper
.loadImageWithCustomization((SimpleDraweeView) attachmentView.findViewById(R.id.author_icon), absolutize(author.getIconUrl()));
FrescoHelper.INSTANCE.loadImageWithCustomization((SimpleDraweeView) attachmentView.findViewById(R.id.author_icon), absolutize(author.getIconUrl()));
final TextView authorName = (TextView) attachmentView.findViewById(R.id.author_name);
authorName.setText(author.getName());
......@@ -187,8 +186,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
thumbImage.setVisibility(GONE);
} else {
thumbImage.setVisibility(VISIBLE);
FrescoHelper
.loadImageWithCustomization(thumbImage, absolutize(thumbUrl));
FrescoHelper.INSTANCE.loadImageWithCustomization(thumbImage, absolutize(thumbUrl));
}
final TextView refText = (TextView) refBox.findViewById(R.id.text);
......@@ -253,8 +251,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
boolean autoloadImage) {
if (autoloadImage) {
load.setVisibility(GONE);
FrescoHelper
.loadImageWithCustomization(drawee, url);
FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
return;
}
......@@ -263,8 +260,7 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
public void onClick(View v) {
load.setVisibility(GONE);
load.setOnClickListener(null);
FrescoHelper
.loadImageWithCustomization(drawee, url);
FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
}
});
}
......
......@@ -95,8 +95,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
if (TextUtils.isEmpty(imageURL)) {
image.setVisibility(View.GONE);
} else {
FrescoHelper
.loadImageWithCustomization(image, imageURL);
FrescoHelper.INSTANCE.loadImageWithCustomization(image, imageURL);
image.setVisibility(View.VISIBLE);
}
......@@ -144,8 +143,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
boolean autoloadImage) {
if (autoloadImage) {
load.setVisibility(GONE);
FrescoHelper
.loadImageWithCustomization(drawee, url);
FrescoHelper.INSTANCE.loadImageWithCustomization(drawee, url);
return;
}
......@@ -154,8 +152,7 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
public void onClick(View v) {
load.setVisibility(GONE);
load.setOnClickListener(null);
FrescoHelper
.loadImageWithCustomization(drawee, url);
FrescoHelper.INSTANCE.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