File tree Expand file tree Collapse file tree 5 files changed +25
-14
lines changed
java/com/hoc081988/democoroutineschannelresult Expand file tree Collapse file tree 5 files changed +25
-14
lines changed Original file line number Diff line number Diff line change 11package com.hoc081988.democoroutineschannelresult
22
3+ import android.util.Log
34import androidx.lifecycle.ViewModel
45import kotlinx.coroutines.channels.Channel
56import 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" )
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments