Skip to content

Instantly share code, notes, and snippets.

@GeorgCantor
Created March 12, 2021 20:16
Show Gist options
  • Save GeorgCantor/0358ec13b6d049f0aa0880b97dd16608 to your computer and use it in GitHub Desktop.
Save GeorgCantor/0358ec13b6d049f0aa0880b97dd16608 to your computer and use it in GitHub Desktop.
class HomeFragment : Fragment(R.layout.fragment_home) {
private var binding: FragmentHomeBinding? = null
private val viewModel by inject<HomeViewModel>()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding = FragmentHomeBinding.bind(view)
viewModel.pictures.observe(viewLifecycleOwner) {
binding?.headerRecycler?.adapter = HeaderAdapter(it)
binding?.feedRecycler?.adapter = FeedAdapter(it)
}
}
override fun onDestroy() {
super.onDestroy()
binding = null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment