Commit 7370656c authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added activity inject sample code

parent 220b3111
package com.biganto.visual.roompark.base
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.di.koin.StartUpData
import org.koin.android.scope.currentScope
class RoomParkMainActivity : AppCompatActivity() {
lateinit var entryText:TextView
private val entryDate : StartUpData by currentScope.inject()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
entryText = findViewById(R.id.entryTextView)
entryText.text = entryDate.helloText
}
}
......@@ -27,6 +27,8 @@ val appModule = module{
val scopesModule = module {
scope(named<RoomParkMainActivity>()){
scoped { StartUpData("ja pesik!") }
}
}
data class StartUpData(val helloText:String)
......@@ -7,6 +7,7 @@
tools:context=".MainActivity">
<TextView
android:id="@+id/entryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
......
......@@ -17,6 +17,6 @@ ext {
gradleVersion = '3.5.0'
koinVersion = '2.0.1'
timberVersion = '4.7.1'
picassoVersion = '2.5.2'
picassoVersion = '2.71828'
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment