/kin

Pass values between activities in a type-safe manner.

Primary LanguageKotlin

kin

Pass values between activities in a type-safe manner.

Usage

class A: Activity() {
  ...
  startActivity<B> {
    B::value willBe 10
  }
  ...
}

class B: Activity() {
  val value: Int by Kin.Int(defaultValue = -1)
  
  fun magicFunction() = Toast.makeText(this, "value = $value", Toast.LENGTH_SHORT).show()
}

Installation

Available via JitPack.

Step 1.

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2.

Add the dependency

	dependencies {
	        compile 'com.github.moomoon:kin:0.1'
	}