All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.didichuxing.doraemonkit.plugin.processor.DoKitComponentHandler.kt Maven / Gradle / Ivy

Go to download

DoKit is an efficiency platform for the entire life cycle of general front-end product research and development.

There is a newer version: 3.7.11
Show newest version
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