Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
GangJust committed Jul 6, 2024
1 parent 4b4dbf9 commit 187cc3d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions core/src/main/java/io/github/fplus/plugin/PluginResources.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class PluginResources(
originResources
} else {
val assetManager = AssetManager::class.java.newInstance()
assetManager.findMethodInvoke<Any>(KtXposedHelpers.modulePath) {
parameterTypes(listOf(String::class.java))
}
assetManager.findMethodInvoke<Any>(KtXposedHelpers.modulePath) { name("addAssetPath") }
Resources(assetManager, originResources.displayMetrics, originResources.configuration)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.savedstate.SavedStateRegistryOwner
import androidx.savedstate.setViewTreeSavedStateRegistryOwner

open class BaseActivity : Activity(),
IXplerActivity,
IPluginActivity,
ContextAware,
LifecycleOwner,
ViewModelStoreOwner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity


open class BaseComponentActivity : ComponentActivity(), IXplerActivity {
open class BaseComponentActivity : ComponentActivity(), IPluginActivity {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.github.fplus.plugin.base

interface IXplerActivity {
interface IPluginActivity {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class XplerDialog(context: Context) : BaseXplerDialog(context) {
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
requestFeature(Window.FEATURE_NO_TITLE)
WindowCompat.setDecorFitsSystemWindows(this, false)
WindowCompat.getInsetsController(this, decorView).hide(WindowInsetsCompat.Type.systemBars())
// WindowCompat.getInsetsController(this, decorView).hide(WindowInsetsCompat.Type.systemBars())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import android.os.PersistableBundle
import androidx.annotation.Keep
import androidx.annotation.RequiresApi
import com.freegang.extension.classLoader
import io.github.fplus.plugin.base.IXplerActivity
import io.github.fplus.plugin.base.IPluginActivity
import io.github.xpler.loader.moduleClassloader
import java.lang.reflect.Method

Expand Down Expand Up @@ -135,7 +135,7 @@ class PluginInstrumentation(
if (intent?.component != null) {
try {
val pluginClazz = pluginClassloader?.loadClass(intent.component?.className)
if (pluginClazz != null && IXplerActivity::class.java.isAssignableFrom(pluginClazz)) {
if (pluginClazz != null && IPluginActivity::class.java.isAssignableFrom(pluginClazz)) {
newIntent = Intent().apply { setClassName(who!!, stubActivity) }
intent.extras?.let { newIntent.putExtras(it) }
newIntent.putExtra(PLUGIN_PROXY_ACTIVITY, pluginClazz.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import android.os.Handler
import android.os.Message
import com.freegang.extension.classLoader
import com.freegang.ktutils.log.KLogCat
import io.github.fplus.plugin.base.IXplerActivity
import io.github.fplus.plugin.base.IPluginActivity
import io.github.xpler.loader.moduleClassloader
import java.lang.reflect.InvocationHandler
import java.lang.reflect.InvocationTargetException
Expand Down Expand Up @@ -430,7 +430,7 @@ object PluginBridgeV2 {
// 是否模块Activity,
return try {
val pluginActivityClazz = classLoader.loadClass(pluginActivityClassName) ?: return false
IXplerActivity::class.java.isAssignableFrom(pluginActivityClazz)
IPluginActivity::class.java.isAssignableFrom(pluginActivityClazz)
} catch (e: ClassNotFoundException) {
false
}
Expand Down

0 comments on commit 187cc3d

Please sign in to comment.