Skip to content

Commit 66b272a

Browse files
author
Carter Hudson
committed
Implement PR feedback; update attachment vh with new bind method signature; update layout files
1 parent 057e093 commit 66b272a

File tree

16 files changed

+49
-48
lines changed

16 files changed

+49
-48
lines changed

samplejava/src/main/java/com/example/chattutorialjava/ImgurAttachmentViewHolder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ private ImgurAttachmentViewHolder(@NotNull ViewHolderImgurAttachmentBinding bind
5454
@Override
5555
public void bindData(
5656
@NotNull MessageListItem.MessageItem data,
57+
boolean isThread,
5758
@Nullable MessageListItemPayloadDiff diff
5859
) {
5960
List<Attachment> attachments = data.getMessage().getAttachments();

samplejava/src/main/res/layout/activity_channel.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
android:layout_height="match_parent">
66

77
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
8-
android:id="@+id/messages_header_view"
9-
android:layout_width="match_parent"
8+
android:id="@+id/messagesHeaderView"
9+
android:layout_width="0dp"
1010
android:layout_height="wrap_content"
1111
app:layout_constraintEnd_toEndOf="parent"
1212
app:layout_constraintStart_toStartOf="parent"
@@ -19,11 +19,11 @@
1919
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
2020
app:layout_constraintEnd_toEndOf="parent"
2121
app:layout_constraintStart_toStartOf="parent"
22-
app:layout_constraintTop_toBottomOf="@+id/messages_header_view" />
22+
app:layout_constraintTop_toBottomOf="@+id/messagesHeaderView" />
2323

2424
<io.getstream.chat.android.ui.textinput.MessageInputView
2525
android:id="@+id/messageInputView"
26-
android:layout_width="match_parent"
26+
android:layout_width="0dp"
2727
android:layout_height="wrap_content"
2828
app:layout_constraintBottom_toBottomOf="parent"
2929
app:layout_constraintEnd_toEndOf="parent"

samplejava/src/main/res/layout/activity_channel_2.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,28 @@
55
android:layout_height="match_parent">
66

77
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
8-
android:id="@+id/messages_header_view"
9-
android:layout_width="match_parent"
8+
android:id="@+id/messagesHeaderView"
9+
android:layout_width="0dp"
1010
android:layout_height="wrap_content"
1111
app:layout_constraintEnd_toEndOf="parent"
12-
app:layout_constraintHorizontal_bias="0.5"
1312
app:layout_constraintStart_toStartOf="parent"
1413
app:layout_constraintTop_toTopOf="parent" />
1514

1615
<io.getstream.chat.android.ui.messages.view.MessageListView
1716
android:id="@+id/messageListView"
18-
android:layout_width="match_parent"
17+
android:layout_width="0dp"
1918
android:layout_height="0dp"
2019
android:background="#f3f5f8"
2120
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
2221
app:layout_constraintEnd_toEndOf="parent"
23-
app:layout_constraintHorizontal_bias="0.5"
2422
app:layout_constraintStart_toStartOf="parent"
25-
app:layout_constraintTop_toBottomOf="@+id/messages_header_view" />
23+
app:layout_constraintTop_toBottomOf="@+id/messagesHeaderView" />
2624

2725
<io.getstream.chat.android.ui.textinput.MessageInputView
2826
android:id="@+id/messageInputView"
29-
android:layout_width="match_parent"
27+
android:layout_width="0dp"
3028
android:layout_height="wrap_content"
3129
app:layout_constraintBottom_toBottomOf="parent"
3230
app:layout_constraintEnd_toEndOf="parent"
33-
app:layout_constraintHorizontal_bias="0.5"
3431
app:layout_constraintStart_toStartOf="parent" />
3532
</androidx.constraintlayout.widget.ConstraintLayout>

samplejava/src/main/res/layout/activity_channel_3.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
android:layout_height="match_parent">
66

77
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
8-
android:id="@+id/messages_header_view"
9-
android:layout_width="match_parent"
8+
android:id="@+id/messagesHeaderView"
9+
android:layout_width="0dp"
1010
android:layout_height="wrap_content"
1111
app:layout_constraintEnd_toEndOf="parent"
1212
app:layout_constraintStart_toStartOf="parent"
1313
app:layout_constraintTop_toTopOf="parent" />
1414

1515
<TextView
1616
android:id="@+id/typingHeaderView"
17-
android:layout_width="match_parent"
17+
android:layout_width="0dp"
1818
android:layout_height="31dp"
1919
android:background="#CCCCCC"
2020
android:gravity="center"
2121
app:layout_constraintEnd_toEndOf="parent"
2222
app:layout_constraintStart_toStartOf="parent"
23-
app:layout_constraintTop_toBottomOf="@+id/messages_header_view" />
23+
app:layout_constraintTop_toBottomOf="@+id/messagesHeaderView" />
2424

2525
<io.getstream.chat.android.ui.messages.view.MessageListView
2626
android:id="@+id/messageListView"
@@ -34,7 +34,7 @@
3434

3535
<io.getstream.chat.android.ui.textinput.MessageInputView
3636
android:id="@+id/messageInputView"
37-
android:layout_width="match_parent"
37+
android:layout_width="0dp"
3838
android:layout_height="wrap_content"
3939
app:layout_constraintBottom_toBottomOf="parent"
4040
app:layout_constraintEnd_toEndOf="parent"

samplejava/src/main/res/layout/activity_channel_4.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:layout_height="match_parent">
66

77
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
8-
android:id="@+id/messages_header_view"
8+
android:id="@+id/messagesHeaderView"
99
android:layout_width="match_parent"
1010
android:layout_height="wrap_content"
1111
app:layout_constraintEnd_toEndOf="parent"
@@ -20,11 +20,12 @@
2020
android:gravity="center"
2121
app:layout_constraintEnd_toEndOf="parent"
2222
app:layout_constraintStart_toStartOf="parent"
23-
app:layout_constraintTop_toBottomOf="@+id/messages_header_view" />
23+
app:layout_constraintTop_toBottomOf="@+id/messagesHeaderView" />
2424

2525
<io.getstream.chat.android.ui.messages.view.MessageListView
2626
android:id="@+id/messageListView"
27-
android:layout_width="0dp"
27+
android:layout_width="match_parent"
28+
2829
android:layout_height="0dp"
2930
android:background="#f3f5f8"
3031
app:layout_constraintBottom_toTopOf="@+id/messageInputView"

samplejava/src/main/res/layout/activity_main.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
<io.getstream.chat.android.ui.channel.list.ChannelsView
88
android:id="@+id/channelsView"
9-
android:layout_width="match_parent"
9+
android:layout_width="0dp"
1010
android:layout_height="0dp"
1111
app:layout_constraintBottom_toBottomOf="parent"
12+
app:layout_constraintEnd_toEndOf="parent"
13+
app:layout_constraintStart_toStartOf="parent"
1214
app:layout_constraintTop_toTopOf="parent" />
1315

1416
</androidx.constraintlayout.widget.ConstraintLayout>

samplekotlin/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ android {
3939
}
4040

4141
dependencies {
42+
<<<<<<< Updated upstream
4243
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
4344
implementation "io.getstream:stream-chat-android-ui-components:4.5.1"
45+
=======
46+
implementation "io.getstream:stream-chat-android-ui-components:4.5.0"
47+
>>>>>>> Stashed changes
4448
implementation 'io.coil-kt:coil:1.1.1'
4549

4650
implementation "androidx.recyclerview:recyclerview:1.1.0"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel.Mode.Norma
1515
import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel.Mode.Thread
1616
import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel.State.NavigateUp
1717
import io.getstream.chat.android.client.ChatClient
18+
import io.getstream.chat.android.client.channel.subscribeFor
1819
import io.getstream.chat.android.client.events.TypingStartEvent
1920
import io.getstream.chat.android.client.events.TypingStopEvent
2021
import io.getstream.chat.android.client.models.Channel
@@ -90,7 +91,7 @@ class ChannelActivity4 : AppCompatActivity() {
9091
.instance()
9192
.channel(cid)
9293
.subscribeFor(
93-
this, TypingStartEvent::class.java, TypingStopEvent::class.java
94+
this, TypingStartEvent::class, TypingStopEvent::class
9495
) { event ->
9596
@Suppress("NON_EXHAUSTIVE_WHEN_ON_SEALED_CLASS")
9697
when (event) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ImgurAttachmentViewHolder(
2626
}
2727
}
2828

29-
override fun bindData(data: MessageListItem.MessageItem, diff: MessageListItemPayloadDiff?) {
29+
override fun bindData(data: MessageListItem.MessageItem, isThread: Boolean, diff: MessageListItemPayloadDiff?) {
3030
data.message.attachments.firstOrNull()?.imageUrl?.let { url ->
3131
binding.ivMediaThumb.apply {
3232
load(url) {

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@ import io.getstream.chat.android.ui.messages.adapter.MessageListItemViewHolderFa
88
class ImgurAttachmentViewHolderFactory : MessageListItemViewHolderFactory() {
99

1010
override fun getItemViewType(item: MessageListItem): Int {
11-
val isImgur = when (item) {
12-
is MessageListItem.MessageItem -> {
13-
item.message
14-
.attachments
15-
.firstOrNull()
16-
?.imageUrl
17-
?.contains("imgur") == true
18-
}
19-
20-
else -> false
21-
}
11+
val isImgur = (item as? MessageListItem.MessageItem)
12+
?.message
13+
?.attachments
14+
?.firstOrNull()
15+
?.imageUrl
16+
?.contains("imgur") == true
2217

2318
return if (isImgur) IMGUR else super.getItemViewType(item)
2419
}

0 commit comments

Comments
 (0)