Skip to content

Instantly share code, notes, and snippets.

@RafalManka
Last active April 28, 2019 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RafalManka/8efadc8359138179df89be362d81ad31 to your computer and use it in GitHub Desktop.
Save RafalManka/8efadc8359138179df89be362d81ad31 to your computer and use it in GitHub Desktop.
package com.example.navigationplayground
import android.app.Activity
import android.app.Application
import android.content.Intent
import android.os.Bundle
import com.example.user.SelectUserActivity
import com.example.navigation.Navigation
import com.example.contact.ContactFormModule
class App : Application(), Navigation {
override fun onCreate() {
super.onCreate()
ContactFormModule.navigation = this
}
override fun start(senderActivity: Activity, screenId: String, extras: Bundle?, requestCode: Int?) {
val intent = when (screenId) {
ContactFormModule.GoTo.selectUser -> Intent(senderActivity, SelectUserActivity::class.java)
else -> return
}
extras?.let { intent.putExtras(it) }
when {
requestCode != null -> senderActivity.startActivityForResult(intent, requestCode)
else -> senderActivity.startActivity(intent)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment