Skip to content

Commit b7e9bb7

Browse files
author
Carter Hudson
committed
replace old elements with new ui component elements
1 parent a4ba435 commit b7e9bb7

22 files changed

+202
-186
lines changed

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = "1.4.10"
3+
ext.kotlin_version = '1.4.10'
44
repositories {
55
google()
66
jcenter()
7+
maven { url "https://jitpack.io" }
78
}
89
dependencies {
910
classpath "com.android.tools.build:gradle:4.1.0"
@@ -15,6 +16,7 @@ allprojects {
1516
repositories {
1617
google()
1718
jcenter()
19+
maven { url "https://jitpack.io" }
1820
}
1921
}
2022

samplejava/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ android {
3333
}
3434

3535
dependencies {
36-
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
37-
implementation "io.getstream:stream-chat-android:4.4.5"
38-
implementation "io.coil-kt:coil:1.0.0"
36+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
37+
implementation "io.getstream:stream-chat-android-ui-components:4.5.0"
38+
implementation "io.coil-kt:coil:1.1.1"
3939

40-
implementation "androidx.lifecycle:lifecycle-viewmodel:2.3.0-beta01"
40+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-rc01"
4141
implementation "androidx.appcompat:appcompat:1.2.0"
4242
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
4343
implementation 'androidx.activity:activity-ktx:1.1.0'

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

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

7-
<com.getstream.sdk.chat.view.ChannelHeaderView
7+
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
88
android:id="@+id/channelHeaderView"
99
android:layout_width="match_parent"
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

15-
<com.getstream.sdk.chat.view.MessageListView
15+
<io.getstream.chat.android.ui.messages.view.MessageListView
1616
android:id="@+id/messageListView"
1717
android:layout_width="0dp"
1818
android:layout_height="0dp"
@@ -23,7 +23,7 @@
2323
app:layout_constraintStart_toStartOf="parent"
2424
app:layout_constraintTop_toBottomOf="@+id/channelHeaderView" />
2525

26-
<com.getstream.sdk.chat.view.messageinput.MessageInputView
26+
<io.getstream.chat.android.ui.textinput.MessageInputView
2727
android:id="@+id/messageInputView"
2828
android:layout_width="match_parent"
2929
android:layout_height="wrap_content"

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

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

7-
<com.getstream.sdk.chat.view.ChannelHeaderView
7+
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
88
android:id="@+id/channelHeaderView"
99
android:layout_width="match_parent"
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

15-
<com.getstream.sdk.chat.view.MessageListView
15+
<io.getstream.chat.android.ui.messages.view.MessageListView
1616
android:id="@+id/messageListView"
1717
android:layout_width="0dp"
1818
android:layout_height="0dp"
@@ -22,14 +22,9 @@
2222
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
2323
app:layout_constraintEnd_toEndOf="parent"
2424
app:layout_constraintStart_toStartOf="parent"
25+
app:layout_constraintTop_toBottomOf="@+id/channelHeaderView" />
2526

26-
app:layout_constraintTop_toBottomOf="@+id/channelHeaderView"
27-
app:streamMessageBackgroundColorMine="#70af74"
28-
app:streamMessageBackgroundColorTheirs="#FFF"
29-
app:streamMessageTextColorMine="#FFF"
30-
app:streamMessageTextColorTheirs="#000" />
31-
32-
<com.getstream.sdk.chat.view.messageinput.MessageInputView
27+
<io.getstream.chat.android.ui.textinput.MessageInputView
3328
android:id="@+id/messageInputView"
3429
android:layout_width="match_parent"
3530
android:layout_height="wrap_content"

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

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

7-
<com.getstream.sdk.chat.view.ChannelHeaderView
7+
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
88
android:id="@+id/channelHeaderView"
99
android:layout_width="match_parent"
1010
android:layout_height="wrap_content"
@@ -22,24 +22,19 @@
2222
app:layout_constraintStart_toStartOf="parent"
2323
app:layout_constraintTop_toBottomOf="@+id/channelHeaderView" />
2424

25-
<com.getstream.sdk.chat.view.MessageListView
25+
<io.getstream.chat.android.ui.messages.view.MessageListView
2626
android:id="@+id/messageListView"
2727
android:layout_width="0dp"
2828
android:layout_height="0dp"
29+
android:background="#f3f5f8"
30+
android:clipToPadding="false"
31+
android:paddingBottom="16dp"
2932
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
3033
app:layout_constraintEnd_toEndOf="parent"
3134
app:layout_constraintStart_toStartOf="parent"
32-
app:layout_constraintTop_toBottomOf="@+id/typingHeaderView"
33-
android:clipToPadding="false"
34-
android:paddingBottom="16dp"
35-
android:background="#f3f5f8"
36-
app:streamMessageTextColorMine="#FFF"
37-
app:streamMessageBackgroundColorMine="#70af74"
38-
app:streamMessageTextColorTheirs="#000"
39-
app:streamMessageBackgroundColorTheirs="#FFF"
40-
/>
35+
app:layout_constraintTop_toBottomOf="@+id/typingHeaderView" />
4136

42-
<com.getstream.sdk.chat.view.messageinput.MessageInputView
37+
<io.getstream.chat.android.ui.textinput.MessageInputView
4338
android:id="@+id/messageInputView"
4439
android:layout_width="match_parent"
4540
android:layout_height="wrap_content"

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

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

7-
<com.getstream.sdk.chat.view.ChannelHeaderView
7+
<io.getstream.chat.android.ui.messages.header.MessagesHeaderView
88
android:id="@+id/channelHeaderView"
99
android:layout_width="match_parent"
1010
android:layout_height="wrap_content"
@@ -22,24 +22,18 @@
2222
app:layout_constraintStart_toStartOf="parent"
2323
app:layout_constraintTop_toBottomOf="@+id/channelHeaderView" />
2424

25-
<com.getstream.sdk.chat.view.MessageListView
25+
<io.getstream.chat.android.ui.messages.view.MessageListView
2626
android:id="@+id/messageListView"
2727
android:layout_width="0dp"
2828
android:layout_height="0dp"
2929
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
3030
app:layout_constraintEnd_toEndOf="parent"
3131
app:layout_constraintStart_toStartOf="parent"
3232
app:layout_constraintTop_toBottomOf="@+id/typingHeaderView"
33-
android:clipToPadding="false"
34-
android:paddingBottom="16dp"
3533
android:background="#f3f5f8"
36-
app:streamMessageTextColorMine="#FFF"
37-
app:streamMessageBackgroundColorMine="#70af74"
38-
app:streamMessageTextColorTheirs="#000"
39-
app:streamMessageBackgroundColorTheirs="#FFF"
4034
/>
4135

42-
<com.getstream.sdk.chat.view.messageinput.MessageInputView
36+
<io.getstream.chat.android.ui.textinput.MessageInputView
4337
android:id="@+id/messageInputView"
4438
android:layout_width="match_parent"
4539
android:layout_height="wrap_content"

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
android:layout_width="match_parent"
55
android:layout_height="match_parent">
66

7-
<com.getstream.sdk.chat.view.channels.ChannelsView
7+
<io.getstream.chat.android.ui.channel.list.ChannelListView
88
android:id="@+id/channelsView"
99
android:layout_width="match_parent"
1010
android:layout_height="0dp"
1111
app:layout_constraintBottom_toBottomOf="parent"
1212
app:layout_constraintTop_toTopOf="parent"
13-
app:streamChannelPreviewLayout="@layout/stream_item_channel"
14-
app:streamReadStateAvatarHeight="15dp"
15-
app:streamReadStateAvatarWidth="15dp"
16-
app:streamReadStateTextSize="9sp"
17-
app:streamShowReadState="true" />
13+
app:streamChannelPreviewLayout="@layout/stream_item_channel" />
1814

1915
</androidx.constraintlayout.widget.ConstraintLayout>

samplekotlin/build.gradle

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

4141
dependencies {
42-
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
43-
implementation "io.getstream:stream-chat-android:4.4.5"
44-
implementation "io.coil-kt:coil:1.0.0"
42+
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.21'
43+
implementation "io.getstream:stream-chat-android-ui-components:4.5.0"
44+
implementation 'io.coil-kt:coil:1.1.1'
4545

46-
implementation "androidx.lifecycle:lifecycle-viewmodel:2.3.0-beta01"
46+
implementation "androidx.recyclerview:recyclerview:1.1.0"
47+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-rc01'
4748
implementation "androidx.appcompat:appcompat:1.2.0"
4849
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
4950
implementation 'androidx.activity:activity-ktx:1.1.0'

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import androidx.appcompat.app.AppCompatActivity
99
import com.example.chattutorial.databinding.ActivityChannelBinding
1010
import com.getstream.sdk.chat.viewmodel.ChannelHeaderViewModel
1111
import com.getstream.sdk.chat.viewmodel.MessageInputViewModel
12-
import com.getstream.sdk.chat.viewmodel.bindView
1312
import com.getstream.sdk.chat.viewmodel.factory.ChannelViewModelFactory
1413
import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel
1514
import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel.Mode.Normal
1615
import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel.Mode.Thread
1716
import com.getstream.sdk.chat.viewmodel.messages.MessageListViewModel.State.NavigateUp
18-
import com.getstream.sdk.chat.viewmodel.messages.bindView
1917
import io.getstream.chat.android.client.models.Channel
18+
import io.getstream.chat.android.ui.messages.header.bindView
19+
import io.getstream.chat.android.ui.messages.view.bindView
20+
import io.getstream.chat.android.ui.textinput.bindView
2021

2122
class ChannelActivity : AppCompatActivity() {
2223

@@ -67,11 +68,12 @@ class ChannelActivity : AppCompatActivity() {
6768
}
6869

6970
// Step 6 - Handle back button behaviour correctly when you're in a thread
70-
binding.channelHeaderView.onBackClick = {
71+
val handleBackPressed = {
7172
messageListViewModel.onEvent(MessageListViewModel.Event.BackButtonPressed)
7273
}
74+
binding.channelHeaderView.setBackButtonClickListener(handleBackPressed)
7375
onBackPressedDispatcher.addCallback(this) {
74-
binding.channelHeaderView.onBackClick()
76+
handleBackPressed()
7577
}
7678
}
7779

0 commit comments

Comments
 (0)