Search in sources :

Example 1 with ActivityAlias

use of org.jetbrains.android.dom.manifest.ActivityAlias in project android by JetBrains.

the class AndroidActivityAliasCompletionContributor method doCollectActivityAliases.

private static void doCollectActivityAliases(@NotNull AndroidFacet facet, @NotNull Set<String> result) {
    final Manifest manifest = facet.getManifest();
    if (manifest == null) {
        return;
    }
    final String aPackage = manifest.getPackage().getStringValue();
    final Application application = manifest.getApplication();
    if (application == null) {
        return;
    }
    for (ActivityAlias activityAlias : application.getActivityAliases()) {
        String alias = activityAlias.getName().getStringValue();
        if (alias != null && alias.length() > 0) {
            if (!alias.startsWith(".")) {
                if (alias.indexOf('.') > 0) {
                    result.add(alias);
                }
                alias = "." + alias;
            }
            if (aPackage != null && aPackage.length() > 0 && StringUtil.commonPrefixLength(aPackage, alias) == 0) {
                result.add(aPackage + alias);
            }
        }
    }
}
Also used : ActivityAlias(org.jetbrains.android.dom.manifest.ActivityAlias) Manifest(org.jetbrains.android.dom.manifest.Manifest) Application(org.jetbrains.android.dom.manifest.Application)

Aggregations

ActivityAlias (org.jetbrains.android.dom.manifest.ActivityAlias)1 Application (org.jetbrains.android.dom.manifest.Application)1 Manifest (org.jetbrains.android.dom.manifest.Manifest)1