com.didichuxing.doraemonkit.plugin.processor.DoKitComponentHandler.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dokitx-plugin Show documentation
Show all versions of dokitx-plugin Show documentation
DoKit is an efficiency platform for the entire life cycle of general front-end product research and development.
package com.didichuxing.doraemonkit.plugin.processor
import com.didichuxing.doraemonkit.plugin.println
import org.xml.sax.Attributes
import org.xml.sax.helpers.DefaultHandler
/**
* ================================================
* 作 者:jint(金台)
* 版 本:1.0
* 创建日期:3/2/21-17:26
* 描 述:
* 修订历史:
* ================================================
*/
const val ATTR_NAME = "android:name"
const val MANIFEST_ATTR_NAME = "package"
class DoKitComponentHandler : DefaultHandler() {
var appPackageName: String = ""
val applications = mutableSetOf()
val activities = mutableSetOf()
val services = mutableSetOf()
val providers = mutableSetOf()
val receivers = mutableSetOf()
override fun startElement(
uri: String,
localName: String,
qName: String,
attributes: Attributes
) {
val name: String = attributes.getValue(ATTR_NAME) ?: ""
val packageName: String = attributes.getValue(MANIFEST_ATTR_NAME) ?: ""
when (qName) {
"manifest" -> {
appPackageName = packageName
}
"application" -> {
applications.add(name)
}
"activity" -> {
activities.add(name)
}
"service" -> {
services.add(name)
}
"provider" -> {
providers.add(name)
}
"receiver" -> {
receivers.add(name)
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy