Closed aasitnikov closed 4 years ago
Amazed with this cool and simple implementation of FragmentFactory support!
class ProfileScreen(private val id: ProfileId) : SupportAppScreen() {
override fun getFragmentParams() = ProfileFragment.params(id)
}
class ProfileFragment : Fragment() {
companion object {
private const val ID = "id"
fun params(id: ProfileId) = FragmentParams(
ProfileFragment::class.java,
Bundle().apply { putString(ID, id.value) }
}
}
@adolgiy Glad to hear it)
By the way, you can use bundleOf()
from core-ktx for even more concise code:
bundleOf(ID to id.value)
Closes #109