Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // startActivity(ActivityList.Main.toIntent()) で遷移
  2.  
  3. object ActivityList {
  4. const val BASE_PACKAGE_NAME = "com.mataku.amazing"
  5.  
  6. object Main : MatakuActivity {
  7. override val className: String
  8. get() = "$BASE_PACKAGE_NAME.app.ui.activity.MainActivity"
  9. }
  10.  
  11. interface MatakuActivity {
  12. val className: String
  13. }
  14.  
  15. fun packageName(debuggable: Boolean): String {
  16. return if (debuggable) {
  17. "$BASE_PACKAGE_NAME.app.dev"
  18. } else {
  19. "$BASE_PACKAGE_NAME.app"
  20. }
  21. }
  22. }
  23.  
  24. fun ActivityList.MatakuActivity.toIntent(): Intent {
  25. return Intent(Intent.ACTION_VIEW).setClassName(
  26. ActivityList.packageName(BuildConfig.DEBUG),
  27. this.className
  28. )
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement