Skip to content

Fix samplejava compilation error and migrate non-deprecated methods #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
import coil.request.ImageRequest;
import io.getstream.chat.android.models.Attachment;
import io.getstream.chat.android.models.Message;
import io.getstream.chat.android.ui.feature.messages.list.adapter.MessageListListenerContainer;
import io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.attachment.AttachmentFactory;
import io.getstream.chat.android.ui.feature.messages.list.adapter.MessageListListeners;
import io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.attachment.BaseAttachmentFactory;
import io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.attachment.InnerAttachmentViewHolder;

/** A custom attachment factory to show an imgur logo if the attachment URL is an imgur image. **/
public class ImgurAttachmentFactory implements AttachmentFactory {
/**
* A custom attachment factory to show an imgur logo if the attachment URL is an imgur image.
**/
public class ImgurAttachmentFactory extends BaseAttachmentFactory {


// Step 1 - Check whether the message contains an Imgur attachment
Expand All @@ -35,7 +37,7 @@ public boolean canHandle(@NonNull Message message) {
@Override
public InnerAttachmentViewHolder createViewHolder(
@NonNull Message message,
@Nullable MessageListListenerContainer listeners,
@Nullable MessageListListeners listeners,
@NonNull ViewGroup parent
) {
Attachment imgurAttachment = containsImgurAttachments(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import coil.load
import com.example.chattutorial.databinding.AttachmentImgurBinding
import io.getstream.chat.android.models.Attachment
import io.getstream.chat.android.models.Message
import io.getstream.chat.android.ui.feature.messages.list.adapter.MessageListListenerContainer
import io.getstream.chat.android.ui.feature.messages.list.adapter.MessageListListeners
import io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.attachment.AttachmentFactory
import io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.attachment.InnerAttachmentViewHolder

Expand All @@ -23,10 +23,10 @@ class ImgurAttachmentFactory : AttachmentFactory {
// over Imgur attachments
override fun createViewHolder(
message: Message,
listeners: MessageListListenerContainer?,
listeners: MessageListListeners?,
parent: ViewGroup
): InnerAttachmentViewHolder {
val imgurAttachment = message.attachments.first() { it.isImgurAttachment() }
val imgurAttachment = message.attachments.first { it.isImgurAttachment() }
val binding = AttachmentImgurBinding
.inflate(LayoutInflater.from(parent.context), null, false)
return ImgurAttachmentViewHolder(
Expand Down
Loading