Skip to content

Commit 3d8a6d9

Browse files
committed
fix(coding.code-generator): PluginActivity声明ComponentCallbacks2接口
否则原有代码以ComponentCallbacks2接口持有Activity会cast失败。如koin的android扩展get()方法。
1 parent f13856c commit 3d8a6d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

projects/sdk/coding/code-generator/src/main/kotlin/com/tencent/shadow/coding/code_generator/ActivityCodeGenerator.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.annotation.SuppressLint
66
import android.app.Activity
77
import android.app.Application
88
import android.app.NativeActivity
9+
import android.content.ComponentCallbacks2
910
import android.view.ContextThemeWrapper
1011
import android.view.KeyEvent
1112
import android.view.Window
@@ -385,8 +386,9 @@ class ActivityCodeGenerator {
385386
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
386387
.superclass(ClassName.get(RUNTIME_PACKAGE, "ShadowContext"))
387388
.addSuperinterfaces(listOf(
388-
ClassName.get(Window.Callback::class.java),
389-
ClassName.get(KeyEvent.Callback::class.java)
389+
ClassName.get(ComponentCallbacks2::class.java),
390+
ClassName.get(Window.Callback::class.java),
391+
ClassName.get(KeyEvent.Callback::class.java)
390392
))
391393
.addAnnotation(
392394
AnnotationSpec.builder(SuppressLint::class.java)

0 commit comments

Comments
 (0)