11package cz.skywall.multimoduleexample.home.ui.home
22
3+ import android.annotation.SuppressLint
34import android.content.Intent
45import android.content.SharedPreferences
56import android.os.Bundle
67import android.view.LayoutInflater
78import android.view.View
89import android.view.ViewGroup
9- import android.widget.TextView
1010import cz.skywal.mutimoduleexmaple.dummy_service.DummyService
11+ import cz.skywall.multimoduleexample.home.R
12+ import cz.skywall.multimoduleexample.common.R as CR
13+ import cz.skywall.multimoduleexample.R as AR
1114import cz.skywall.multimoduleexample.home.base.BaseFragment
1215import cz.skywall.multimoduleexample.home.data.repository.DummyRepository
1316import cz.skywall.multimoduleexample.home.data.repository.DummyRepository2
1417import cz.skywall.multimoduleexample.network.ApiService
18+ import kotlinx.android.synthetic.main.fragment_home.*
1519import javax.inject.Inject
1620
1721class HomeFragment : BaseFragment () {
@@ -29,23 +33,30 @@ class HomeFragment : BaseFragment() {
2933 lateinit var dummyRepository2: DummyRepository2
3034
3135
36+ override fun inject () {
37+ homeComponent.plus(HomeFragmentModule ()).inject(this )
38+ }
39+
3240 override fun onCreateView (
3341 inflater : LayoutInflater ,
3442 container : ViewGroup ? ,
3543 savedInstanceState : Bundle ?
3644 ): View {
37- return TextView (requireActivity()).apply { text = " Home Fragment" }
38- }
39-
40- override fun inject () {
41- homeComponent.plus(HomeFragmentModule ()).inject(this )
42-
43- requireActivity().startService(Intent (requireActivity(), DummyService ::class .java))
45+ return inflater.inflate(R .layout.fragment_home, container, false )
4446 }
4547
48+ @SuppressLint(" SetTextI18n" )
4649 override fun onViewCreated (view : View , savedInstanceState : Bundle ? ) {
4750 sharedPreferences.all
4851 dummyRepository.toString()
4952 dummyRepository2.toString()
53+
54+ requireActivity().startService(Intent (requireActivity(), DummyService ::class .java))
55+
56+ combined_text.text =
57+ """ Combined:
58+ ${resources.getString(CR .string.string_from_common)}
59+ ${resources.getString(AR .string.string_from_app)}
60+ ${resources.getString(R .string.string_from_home)} """
5061 }
5162}
0 commit comments