Skip to content

Commit 8c9be54

Browse files
committed
- Update comments for consistency, change to fully classified resource imports for Stream resources because shortened imports confuse the IDE when copy pasting
1 parent b306a5c commit 8c9be54

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

samplejava/src/main/java/com/example/chattutorial/ChannelActivity2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6060
MessageListViewModel messageListViewModel = provider.get(MessageListViewModel.class);
6161
MessageInputViewModel messageInputViewModel = provider.get(MessageInputViewModel.class);
6262

63-
// Set view factory manager for Imgur attachments
63+
// Set a view factory manager for Imgur attachments
6464
ImgurAttachmentFactory imgurAttachmentFactory = new ImgurAttachmentFactory();
6565

6666
List<ImgurAttachmentFactory> imgurAttachmentViewFactories = new ArrayList<ImgurAttachmentFactory>();

samplejava/src/main/java/com/example/chattutorial/ChannelActivity3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
7171
MessageListViewModel messageListViewModel = provider.get(MessageListViewModel.class);
7272
MessageInputViewModel messageInputViewModel = provider.get(MessageInputViewModel.class);
7373

74-
// Set view factory manager for Imgur attachments
74+
// Set a view factory manager for Imgur attachments
7575
ImgurAttachmentFactory imgurAttachmentFactory = new ImgurAttachmentFactory();
7676

7777
List<ImgurAttachmentFactory> imgurAttachmentViewFactories = new ArrayList<ImgurAttachmentFactory>();

samplejava/src/main/java/com/example/chattutorial/ChannelActivity4.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6868
MessageListViewModel messageListViewModel = provider.get(MessageListViewModel.class);
6969
MessageInputViewModel messageInputViewModel = provider.get(MessageInputViewModel.class);
7070

71-
// Set view factory manager for Imgur attachments
71+
// Set a view factory manager for Imgur attachments
7272
ImgurAttachmentFactory imgurAttachmentFactory = new ImgurAttachmentFactory();
7373

7474
List<ImgurAttachmentFactory> imgurAttachmentViewFactories = new ArrayList<ImgurAttachmentFactory>();

samplejava/src/main/java/com/example/chattutorial/ImgurAttachmentFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
public class ImgurAttachmentFactory implements AttachmentFactory {
2424

2525

26-
// 1. Check whether the message contains an Imgur attachment
26+
// Step 1 - Check whether the message contains an Imgur attachment
2727
@Override
2828
public boolean canHandle(@NonNull Message message) {
2929
return containsImgurAttachments(message) != null;
3030
}
3131

32-
// 2. Create the ViewHolder that will be used to display the Imgur logo
32+
// Step 2 - Create the ViewHolder that will be used to display the Imgur logo
3333
// over Imgur attachments
3434
@NonNull
3535
@Override
@@ -65,7 +65,7 @@ public ImgurAttachmentViewHolder(AttachmentImgurBinding binding,
6565

6666
ShapeAppearanceModel shapeAppearanceModel = binding.ivMediaThumb.getShapeAppearanceModel()
6767
.toBuilder()
68-
.setAllCornerSizes(binding.ivMediaThumb.getResources().getDimension(R.dimen.stream_ui_selected_attachment_corner_radius))
68+
.setAllCornerSizes(binding.ivMediaThumb.getResources().getDimension(io.getstream.chat.android.ui.R.dimen.stream_ui_selected_attachment_corner_radius))
6969
.build();
7070

7171
binding.ivMediaThumb.setShapeAppearanceModel(shapeAppearanceModel);
@@ -75,7 +75,7 @@ public ImgurAttachmentViewHolder(AttachmentImgurBinding binding,
7575
.data(imgurAttachment.getImageUrl())
7676
.allowHardware(false)
7777
.crossfade(true)
78-
.placeholder(R.drawable.stream_ui_picture_placeholder)
78+
.placeholder(io.getstream.chat.android.ui.R.drawable.stream_ui_picture_placeholder)
7979
.target(binding.ivMediaThumb)
8080
.build();
8181
Coil.imageLoader(binding.getRoot().getContext()).enqueue(imageRequest);

samplekotlin/src/main/java/com/example/chattutorial/ChannelActivity2.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ChannelActivity2 : AppCompatActivity() {
4242
val messageListViewModel: MessageListViewModel by viewModels { factory }
4343
val messageInputViewModel: MessageInputViewModel by viewModels { factory }
4444

45-
// Set view factory manager for Imgur attachments
45+
// Set a view factory manager for Imgur attachments
4646
val imgurAttachmentViewFactory = ImgurAttachmentFactory()
4747
val attachmentViewFactory = AttachmentFactoryManager(listOf(imgurAttachmentViewFactory))
4848
binding.messageListView.setAttachmentFactoryManager(attachmentViewFactory)

samplekotlin/src/main/java/com/example/chattutorial/ChannelActivity4.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ChannelActivity4 : AppCompatActivity() {
4646
val messageListViewModel: MessageListViewModel by viewModels { factory }
4747
val messageInputViewModel: MessageInputViewModel by viewModels { factory }
4848

49-
// Set view factory manager for Imgur attachments
49+
// Set a view factory manager for Imgur attachments
5050
val imgurAttachmentViewFactory = ImgurAttachmentFactory()
5151
val attachmentViewFactory = AttachmentFactoryManager(listOf(imgurAttachmentViewFactory))
5252
binding.messageListView.setAttachmentFactoryManager(attachmentViewFactory)

samplekotlin/src/main/java/com/example/chattutorial/ImgurAttachmentFactory.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import io.getstream.chat.android.ui.message.list.adapter.viewholder.attachment.I
1313
/** A custom attachment factory to show an imgur logo if the attachment URL is an imgur image. */
1414
class ImgurAttachmentFactory : AttachmentFactory {
1515

16-
// 1. Check whether the message contains an Imgur attachment
16+
// Step 1 - Check whether the message contains an Imgur attachment
1717
override fun canHandle(message: Message): Boolean {
1818
val imgurAttachment = message.attachments.firstOrNull { it.isImgurAttachment() }
1919
return imgurAttachment != null
2020
}
2121

22-
// 2. Create the ViewHolder that will be used to display the Imgur logo
22+
// Step 2 - Create the ViewHolder that will be used to display the Imgur logo
2323
// over Imgur attachments
2424
override fun createViewHolder(
2525
message: Message,
@@ -47,12 +47,12 @@ class ImgurAttachmentFactory : AttachmentFactory {
4747
binding.ivMediaThumb.apply {
4848
shapeAppearanceModel = shapeAppearanceModel
4949
.toBuilder()
50-
.setAllCornerSizes(resources.getDimension(R.dimen.stream_ui_selected_attachment_corner_radius))
50+
.setAllCornerSizes(resources.getDimension(io.getstream.chat.android.ui.R.dimen.stream_ui_selected_attachment_corner_radius))
5151
.build()
5252
load(imgurAttachment.imageUrl) {
5353
allowHardware(false)
5454
crossfade(true)
55-
placeholder(R.drawable.stream_ui_picture_placeholder)
55+
placeholder(io.getstream.chat.android.ui.R.drawable.stream_ui_picture_placeholder)
5656
}
5757
}
5858
}

0 commit comments

Comments
 (0)