This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AndroidPlaygroundActivity : DaggerAppCompatActivity() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseFragment : DaggerFragment() { | |
// Code emitted for brevity | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DetailsFragment : BaseFragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val githubRepoEntity = arguments?.getParcelable<GithubRepoEntity>(REPOSITORY_KEY) | |
githubRepoEntity?.let { detailsViewModel.initData(it) } | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainFragment : BaseFragment() { | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View? { | |
return inflater.inflate(R.layout.fragment_main, container, false) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Toast.makeText(requireContext(), it.error, Toast.LENGTH_LONG).show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Fragment.requireAppCompatActivity(): AppCompatActivity { | |
return requireActivity() as? AppCompatActivity | |
?: throw IllegalStateException("Activity this fragment is attached to does not extend AppCompatActivity") | |
} | |
requireAppCompatActivity().supportActionBar?.title = it.toolbarTitle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity android:name=".ui.AndroidPlaygroundActivity"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
interface SingleActivityModule { | |
@SingleActivity | |
@ContributesAndroidInjector( | |
modules = [ | |
MyScopedModule::class | |
] | |
) | |
fun androidPlaygroundActivity(): AndroidPlaygroundActivity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
interface SingleActivityModule { | |
@SingleActivity | |
@ContributesAndroidInjector( | |
modules = [ | |
MyScopedModule::class, | |
FragmentModule::class | |
] | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Navigator { | |
fun goToDetailsFromMain(githubRepoEntity: GithubRepoEntity) | |
fun goToUrl(url: String) | |
} |
OlderNewer