Skip to content

Commit 0109cab

Browse files
committed
fixes for the java tutorial
1 parent b16584c commit 0109cab

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5757
MessageListView messageListView = findViewById(R.id.messageListView);
5858
ChannelHeaderView channelHeaderView = findViewById(R.id.channelHeaderView);
5959
MessageInputView messageInputView = findViewById(R.id.messageInputView);
60-
TextView typingHeader = findViewById(R.id.typingHeader);
6160

6261
// Step 1 - Create 3 separate ViewModels for the views so it's easy to customize one of the components
6362
ChannelViewModelFactory factory = new ChannelViewModelFactory(cid);
@@ -109,8 +108,9 @@ public void handleOnBackPressed() {
109108
});
110109

111110
// Custom typing info header bar
111+
TextView typingHeaderView = findViewById(R.id.typingHeaderView);
112112
String nobodyTyping = "nobody is typing";
113-
typingHeader.setText(nobodyTyping);
113+
typingHeaderView.setText(nobodyTyping);
114114

115115
// Obtain a ChannelController
116116
ChatDomain.instance().getUseCases().getGetChannelController().invoke(cid).enqueue((result) -> {
@@ -120,14 +120,14 @@ public void handleOnBackPressed() {
120120
// Observe typing users
121121
channelController.getTyping().observe(this, users -> {
122122
if (users.isEmpty()) {
123-
typingHeader.setText(nobodyTyping);
123+
typingHeaderView.setText(nobodyTyping);
124124
} else {
125125
List<String> userNames = new LinkedList<>();
126126
for (User user : users) {
127127
userNames.add((String)user.getExtraData().get("name"));
128128
}
129129
String typing = "typing: " + TextUtils.join(", ", userNames);
130-
typingHeader.setText(typing);
130+
typingHeaderView.setText(typing);
131131
}
132132
});
133133
});

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5858
MessageListView messageListView = findViewById(R.id.messageListView);
5959
ChannelHeaderView channelHeaderView = findViewById(R.id.channelHeaderView);
6060
MessageInputView messageInputView = findViewById(R.id.messageInputView);
61-
TextView typingHeader = findViewById(R.id.typingHeader);
6261

6362
// Step 1 - Create 3 separate ViewModels for the views so it's easy to customize one of the components
6463
ChannelViewModelFactory factory = new ChannelViewModelFactory(cid);
@@ -110,8 +109,9 @@ public void handleOnBackPressed() {
110109
});
111110

112111
// Custom typing info header bar
112+
TextView typingHeaderView = findViewById(R.id.typingHeaderView);
113113
String nobodyTyping = "nobody is typing";
114-
typingHeader.setText(nobodyTyping);
114+
typingHeaderView.setText(nobodyTyping);
115115

116116
Set<String> currentlyTyping = new HashSet<>();
117117
ChatClient
@@ -134,7 +134,7 @@ public void handleOnBackPressed() {
134134
if (!currentlyTyping.isEmpty()) {
135135
typing = "typing: " + TextUtils.join(", ", currentlyTyping);
136136
}
137-
typingHeader.setText(typing);
137+
typingHeaderView.setText(typing);
138138
return Unit.INSTANCE;
139139
});
140140
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
app:layout_constraintTop_toTopOf="parent" />
1414

1515
<TextView
16-
android:id="@+id/typingHeader"
16+
android:id="@+id/typingHeaderView"
1717
android:layout_width="match_parent"
1818
android:layout_height="31dp"
1919
android:background="#CCCCCC"
@@ -29,7 +29,7 @@
2929
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
3030
app:layout_constraintEnd_toEndOf="parent"
3131
app:layout_constraintStart_toStartOf="parent"
32-
app:layout_constraintTop_toBottomOf="@+id/typingHeader"
32+
app:layout_constraintTop_toBottomOf="@+id/typingHeaderView"
3333
android:clipToPadding="false"
3434
android:paddingBottom="16dp"
3535
android:background="#f3f5f8"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
app:layout_constraintTop_toTopOf="parent" />
1414

1515
<TextView
16-
android:id="@+id/typingHeader"
16+
android:id="@+id/typingHeaderView"
1717
android:layout_width="match_parent"
1818
android:layout_height="31dp"
1919
android:background="#CCCCCC"
@@ -29,7 +29,7 @@
2929
app:layout_constraintBottom_toTopOf="@+id/messageInputView"
3030
app:layout_constraintEnd_toEndOf="parent"
3131
app:layout_constraintStart_toStartOf="parent"
32-
app:layout_constraintTop_toBottomOf="@+id/typingHeader"
32+
app:layout_constraintTop_toBottomOf="@+id/typingHeaderView"
3333
android:clipToPadding="false"
3434
android:paddingBottom="16dp"
3535
android:background="#f3f5f8"

0 commit comments

Comments
 (0)