Skip to content

Instantly share code, notes, and snippets.

@2hamed
Created December 23, 2018 14:52
Show Gist options
  • Select an option

  • Save 2hamed/98f0c7e97b9065c8c3d0352303d6a313 to your computer and use it in GitHub Desktop.

Select an option

Save 2hamed/98f0c7e97b9065c8c3d0352303d6a313 to your computer and use it in GitHub Desktop.
class FragmentOne: Fragment() {
@Inject
lateinit var navEvents: PublishProcessor<NavEvent>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(context!!.applicationContext as App).di.inject(this)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
inflater.inflate(R.layout.fragment_one, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
button.setOnClickListener {
navEvents.onNext(NavEvent(NavEvent.Destination.TWO))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment