Skip to content

Commit 003814b

Browse files
committed
done
1 parent 45d3e09 commit 003814b

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/hoc081988/democoroutineschannelresult/MainVM.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.hoc081988.democoroutineschannelresult
22

3+
import android.util.Log
34
import androidx.lifecycle.ViewModel
45
import kotlinx.coroutines.channels.Channel
56
import kotlinx.coroutines.flow.Flow
@@ -51,6 +52,7 @@ class MainVM : ViewModel() {
5152
checkNotNull(eventChannels[event.key]) { "Must register ${event.key} in MainSingleEvent.Companion.KEYS before using!" }
5253
.trySend(event)
5354
.getOrThrow()
55+
.also { Log.d("@@@", "Sent $event") }
5456
}
5557

5658
@Suppress("UNCHECKED_CAST")

app/src/main/java/com/hoc081988/democoroutineschannelresult/ui/dashboard/DashboardFragment.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ class DashboardFragment : Fragment() {
4646
super.onViewCreated(view, savedInstanceState)
4747

4848
binding.button.setOnClickListener {
49+
val text = binding.textInputLayout
50+
.editText!!
51+
.text
52+
?.toString()
53+
?.takeIf { it.isNotBlank() }
54+
?: return@setOnClickListener
55+
4956
mainVM.sendEvent(
5057
MainSingleEvent.DashboardFragmentResult(
51-
text = binding.textInputLayout
52-
.editText!!
53-
.text
54-
?.toString()
55-
?.takeIf { it.isNotBlank() }
56-
?: return@setOnClickListener,
58+
text = text,
5759
)
5860
)
5961

app/src/main/java/com/hoc081988/democoroutineschannelresult/ui/home/HomeFragment.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ class HomeFragment : Fragment() {
5252
super.onViewCreated(view, savedInstanceState)
5353

5454
binding.button.setOnClickListener {
55+
val text = binding.textInputLayout
56+
.editText!!
57+
.text
58+
?.toString()
59+
?.takeIf { it.isNotBlank() }
60+
?: return@setOnClickListener
61+
5562
mainVM.sendEvent(
5663
MainSingleEvent.HomeFragmentResult(
57-
text = binding.textInputLayout
58-
.editText!!
59-
.text
60-
?.toString()
61-
?.takeIf { it.isNotBlank() }
62-
?: return@setOnClickListener,
64+
text = text,
6365
)
6466
)
6567

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:id="@+id/container"
55
android:layout_width="match_parent"
6-
android:layout_height="match_parent"
7-
android:paddingTop="?attr/actionBarSize">
6+
android:layout_height="match_parent">
87

98
<com.google.android.material.bottomnavigation.BottomNavigationView
109
android:id="@+id/nav_view"

0 commit comments

Comments
 (0)