Java源码示例:com.android.ide.common.xml.ManifestData.Activity

示例1
/**
 * Processes the activity node.
 * @param attributes the attributes for the activity node.
 */
private void processActivityNode(Attributes attributes) {
    // lets get the activity name, and add it to the list
    String activityName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_NAME,
            true /* hasNamespace */);
    if (activityName != null) {
        activityName = AndroidManifest.combinePackageAndClassName(mManifestData.mPackage,
                activityName);

        // get the exported flag.
        String exportedStr = getAttributeValue(attributes,
                AndroidManifest.ATTRIBUTE_EXPORTED, true);
        boolean exported = exportedStr == null ||
                exportedStr.toLowerCase(Locale.US).equals("true"); //$NON-NLS-1$
        mCurrentActivity = new Activity(activityName, exported);
        mManifestData.mActivities.add(mCurrentActivity);

        if (mErrorHandler != null) {
            mErrorHandler.checkClass(mLocator, activityName, SdkConstants.CLASS_ACTIVITY,
                    true /* testVisibility */);
        }
    } else {
        // no activity found! Aapt will output an error,
        // so we don't have to do anything
        mCurrentActivity = null;
    }

    String processName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_PROCESS,
            true /* hasNamespace */);
    if (processName != null) {
        mManifestData.addProcessName(processName);
    }
}
 
示例2
/**
 * Processes the activity node.
 * @param attributes the attributes for the activity node.
 */
private void processActivityNode(Attributes attributes) {
    // lets get the activity name, and add it to the list
    String activityName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_NAME,
            true /* hasNamespace */);
    if (activityName != null) {
        activityName = AndroidManifest.combinePackageAndClassName(mManifestData.mPackage,
                activityName);

        // get the exported flag.
        String exportedStr = getAttributeValue(attributes,
                AndroidManifest.ATTRIBUTE_EXPORTED, true);
        boolean exported = exportedStr == null ||
                exportedStr.toLowerCase(Locale.US).equals("true"); //$NON-NLS-1$
        mCurrentActivity = new Activity(activityName, exported);
        mManifestData.mActivities.add(mCurrentActivity);

        if (mErrorHandler != null) {
            mErrorHandler.checkClass(mLocator, activityName, SdkConstants.CLASS_ACTIVITY,
                    true /* testVisibility */);
        }
    } else {
        // no activity found! Aapt will output an error,
        // so we don't have to do anything
        mCurrentActivity = null;
    }

    String processName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_PROCESS,
            true /* hasNamespace */);
    if (processName != null) {
        mManifestData.addProcessName(processName);
    }
}