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

Update classes using the FrescoHelper and add placeholder to inline attachment/image.

parent f7c75a2f
......@@ -6,7 +6,7 @@ import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import chat.rocket.android.widget.helper.FrescoAvatarHelper;
import chat.rocket.android.widget.helper.FrescoHelper;
import com.facebook.drawee.view.SimpleDraweeView;
public class RocketChatAvatar extends FrameLayout {
......@@ -41,13 +41,8 @@ public class RocketChatAvatar extends FrameLayout {
draweeView = findViewById(R.id.drawee_avatar);
}
public void loadImage(String imageUrl) {
FrescoAvatarHelper
.loadImage(draweeView, imageUrl);
}
public void showFailureImage() {
FrescoAvatarHelper
.showFailureImage(draweeView);
public void loadImage(String imageUri) {
FrescoHelper
.loadImage(draweeView, imageUri);
}
}
\ No newline at end of file
......@@ -14,9 +14,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;
import chat.rocket.android.widget.AbsoluteUrl;
import chat.rocket.android.widget.R;
import chat.rocket.android.widget.helper.FrescoHelper;
......@@ -24,6 +21,8 @@ import chat.rocket.core.models.Attachment;
import chat.rocket.core.models.AttachmentAuthor;
import chat.rocket.core.models.AttachmentField;
import chat.rocket.core.models.AttachmentTitle;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;
/**
*/
......@@ -120,8 +119,8 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
authorBox.setVisibility(VISIBLE);
FrescoHelper.setupDraweeAndLoadImage(absolutize(author.getIconUrl()),
(SimpleDraweeView) attachmentView.findViewById(R.id.author_icon));
FrescoHelper
.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());
......@@ -188,7 +187,8 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
thumbImage.setVisibility(GONE);
} else {
thumbImage.setVisibility(VISIBLE);
FrescoHelper.setupDraweeAndLoadImage(absolutize(thumbUrl), thumbImage);
FrescoHelper
.loadImageWithCustomization(thumbImage, absolutize(thumbUrl));
}
final TextView refText = (TextView) refBox.findViewById(R.id.text);
......@@ -253,17 +253,18 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
boolean autoloadImage) {
if (autoloadImage) {
load.setVisibility(GONE);
FrescoHelper.setupDraweeAndLoadImage(url, drawee);
FrescoHelper
.loadImageWithCustomization(drawee, url);
return;
}
FrescoHelper.setupDrawee(drawee);
load.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
load.setVisibility(GONE);
load.setOnClickListener(null);
FrescoHelper.loadImage(url, drawee);
FrescoHelper
.loadImageWithCustomization(drawee, url);
}
});
}
......
......@@ -11,12 +11,12 @@ import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import chat.rocket.android.widget.helper.FrescoHelper;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;
import java.util.Map;
import chat.rocket.android.widget.R;
import chat.rocket.android.widget.helper.FrescoHelper;
import chat.rocket.android.widget.helper.ImageFormat;
import chat.rocket.core.models.WebContent;
import chat.rocket.core.models.WebContentHeaders;
......@@ -95,7 +95,8 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
if (TextUtils.isEmpty(imageURL)) {
image.setVisibility(View.GONE);
} else {
FrescoHelper.setupDraweeAndLoadImage(imageURL, image);
FrescoHelper
.loadImageWithCustomization(image, imageURL);
image.setVisibility(View.VISIBLE);
}
......@@ -143,17 +144,18 @@ public class RocketChatMessageUrlsLayout extends LinearLayout {
boolean autoloadImage) {
if (autoloadImage) {
load.setVisibility(GONE);
FrescoHelper.setupDraweeAndLoadImage(url, drawee);
FrescoHelper
.loadImageWithCustomization(drawee, url);
return;
}
FrescoHelper.setupDrawee(drawee);
load.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
load.setVisibility(GONE);
load.setOnClickListener(null);
FrescoHelper.loadImage(url, drawee);
FrescoHelper
.loadImageWithCustomization(drawee, url);
}
});
}
......
......@@ -106,6 +106,7 @@
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginBottom="8dp"
fresco:placeholderImage="@drawable/image_dummy"
fresco:actualImageScaleType="fitStart" />
<TextView
......
......@@ -10,6 +10,7 @@
android:id="@+id/message_inline_image"
android:layout_width="match_parent"
android:layout_height="150dp"
fresco:placeholderImage="@drawable/image_dummy"
fresco:actualImageScaleType="fitStart" />
<TextView
......
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