File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
app/src/main/java/org/imaginativeworld/simplemvvm/ui/fragments/demo_fragment_nav Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ A simple Android MVVM pattern example and template.
29
29
- Awesome module naming example (see ` AwesomeModuleConstants ` )
30
30
- Dynamic accent color from image (see ` calculatePaletteInImage() ` )
31
31
- Simple Encryption Utils (see ` EncryptionUtils ` )
32
- - Data pass example between activities and fragments
32
+ - Data pass and receive example between Activities
33
+ - Data pass and receive example between Fragments
33
34
34
35
## Extension Functions (see ` utils/extensions ` )
35
36
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import android.os.Bundle
4
4
import android.view.View
5
5
import androidx.core.os.bundleOf
6
6
import androidx.fragment.app.Fragment
7
- import androidx.fragment.app.activityViewModels
8
7
import androidx.fragment.app.setFragmentResult
8
+ import androidx.fragment.app.viewModels
9
9
import org.imaginativeworld.simplemvvm.R
10
10
import org.imaginativeworld.simplemvvm.databinding.FragmentDemoFragmentNavDetailsBinding
11
11
import org.imaginativeworld.simplemvvm.interfaces.CommonFunctions
@@ -15,7 +15,9 @@ class DemoFragmentNavDetails :
15
15
Fragment (R .layout.fragment_demo_fragment_nav_details),
16
16
CommonFunctions {
17
17
18
- private val parentViewModel: DemoFragmentNavViewModel by activityViewModels()
18
+ private val parentViewModel: DemoFragmentNavViewModel by viewModels(ownerProducer = {
19
+ requireParentFragment()
20
+ })
19
21
20
22
private lateinit var binding: FragmentDemoFragmentNavDetailsBinding
21
23
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ import android.view.View
5
5
import android.widget.AdapterView.OnItemClickListener
6
6
import android.widget.ArrayAdapter
7
7
import androidx.fragment.app.Fragment
8
- import androidx.fragment.app.activityViewModels
9
8
import androidx.fragment.app.setFragmentResultListener
9
+ import androidx.fragment.app.viewModels
10
10
import org.imaginativeworld.simplemvvm.R
11
11
import org.imaginativeworld.simplemvvm.databinding.FragmentDemoFragmentNavListBinding
12
12
import org.imaginativeworld.simplemvvm.interfaces.CommonFunctions
@@ -15,7 +15,9 @@ import timber.log.Timber
15
15
16
16
class DemoFragmentNavList : Fragment (R .layout.fragment_demo_fragment_nav_list), CommonFunctions {
17
17
18
- private val parentViewModel: DemoFragmentNavViewModel by activityViewModels()
18
+ private val parentViewModel: DemoFragmentNavViewModel by viewModels(ownerProducer = {
19
+ requireParentFragment()
20
+ })
19
21
20
22
private lateinit var binding: FragmentDemoFragmentNavListBinding
21
23
You can’t perform that action at this time.
0 commit comments