-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KinectApplication, KinjectAppCompatActivity, KinjectComponentActivity…
… etc
- Loading branch information
1 parent
780d7c5
commit 927aceb
Showing
10 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.gradleMavenPublish) | ||
} | ||
|
||
android { | ||
namespace = "kinject.android.appcompat" | ||
} | ||
|
||
dependencies { | ||
api(project(":kinject-android")) | ||
implementation(libs.androidx.appcompat) | ||
} |
27 changes: 27 additions & 0 deletions
27
kinject-android-appcompat/src/main/kotlin/kinject/android/KinjectAppCompatActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package kinject.android | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import kinject.HasObjectGraph | ||
import kinject.ObjectGraph | ||
import kinject.android.KinjectApplication.Companion.KINJECT_SERVICE | ||
|
||
abstract class KinjectAppCompatActivity : AppCompatActivity(), HasObjectGraph { | ||
override val objectGraph: ObjectGraph by lazy { createObjectGraph() } | ||
|
||
protected abstract fun createObjectGraph(): ObjectGraph | ||
|
||
override fun getSystemService(name: String): Any { | ||
return when (name) { | ||
KINJECT_SERVICE -> objectGraph | ||
else -> super.getSystemService(name) | ||
} | ||
} | ||
|
||
override fun getSystemServiceName(serviceClass: Class<*>): String? { | ||
return if (serviceClass === ObjectGraph::class.java) { | ||
KINJECT_SERVICE | ||
} else { | ||
super.getSystemServiceName(serviceClass) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.gradleMavenPublish) | ||
} | ||
|
||
android { | ||
namespace = "kinject.android.compose" | ||
} | ||
|
||
dependencies { | ||
api(project(":kinject-android")) | ||
implementation(libs.androidx.activity.compose) | ||
} |
27 changes: 27 additions & 0 deletions
27
kinject-android-compose/src/main/kotlin/kinject/android/KinjectComponentActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package kinject.android | ||
|
||
import androidx.activity.ComponentActivity | ||
import kinject.HasObjectGraph | ||
import kinject.ObjectGraph | ||
import kinject.android.KinjectApplication.Companion.KINJECT_SERVICE | ||
|
||
abstract class KinjectComponentActivity : ComponentActivity(), HasObjectGraph { | ||
override val objectGraph: ObjectGraph by lazy { createObjectGraph() } | ||
|
||
protected abstract fun createObjectGraph(): ObjectGraph | ||
|
||
override fun getSystemService(name: String): Any { | ||
return when (name) { | ||
KINJECT_SERVICE -> objectGraph | ||
else -> super.getSystemService(name) | ||
} | ||
} | ||
|
||
override fun getSystemServiceName(serviceClass: Class<*>): String? { | ||
return if (serviceClass === ObjectGraph::class.java) { | ||
KINJECT_SERVICE | ||
} else { | ||
super.getSystemServiceName(serviceClass) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
kinject-android/src/main/kotlin/kinject/android/KinjectActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package kinject.android | ||
|
||
import android.app.Activity | ||
import kinject.HasObjectGraph | ||
import kinject.ObjectGraph | ||
import kinject.android.KinjectApplication.Companion.KINJECT_SERVICE | ||
|
||
abstract class KinjectActivity : Activity(), HasObjectGraph { | ||
override val objectGraph: ObjectGraph by lazy { createObjectGraph() } | ||
|
||
protected abstract fun createObjectGraph(): ObjectGraph | ||
|
||
override fun getSystemService(name: String): Any { | ||
return when (name) { | ||
KINJECT_SERVICE -> objectGraph | ||
else -> super.getSystemService(name) | ||
} | ||
} | ||
|
||
override fun getSystemServiceName(serviceClass: Class<*>): String? { | ||
return if (serviceClass === ObjectGraph::class.java) { | ||
KINJECT_SERVICE | ||
} else { | ||
super.getSystemServiceName(serviceClass) | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
kinject-android/src/main/kotlin/kinject/android/KinjectApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package kinject.android | ||
|
||
import android.app.Application | ||
import kinject.HasObjectGraph | ||
import kinject.ObjectGraph | ||
|
||
abstract class KinjectApplication : Application(), HasObjectGraph { | ||
companion object { | ||
const val KINJECT_SERVICE = "kinject" | ||
} | ||
|
||
override val objectGraph: ObjectGraph by lazy { createObjectGraph() } | ||
|
||
protected abstract fun createObjectGraph(): ObjectGraph | ||
|
||
override fun getSystemService(name: String): Any { | ||
return when (name) { | ||
KINJECT_SERVICE -> objectGraph | ||
else -> super.getSystemService(name) | ||
} | ||
} | ||
|
||
override fun getSystemServiceName(serviceClass: Class<*>): String? { | ||
return if (serviceClass === ObjectGraph::class.java) { | ||
KINJECT_SERVICE | ||
} else { | ||
super.getSystemServiceName(serviceClass) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package kinject | ||
|
||
interface HasObjectGraph { | ||
val objectGraph: ObjectGraph | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters