Java Code Examples for com.android.utils.StringHelper#capitalize()

The following examples show how to use com.android.utils.StringHelper#capitalize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProductFlavorData.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
ProductFlavorData(
        @NonNull T productFlavor,
        @NonNull DefaultAndroidSourceSet sourceSet,
        @NonNull Project project) {
    super(sourceSet, project);

    this.productFlavor = productFlavor;

    if (!BuilderConstants.MAIN.equals(sourceSet.getName())) {
        String sourceSetName = StringHelper.capitalize(sourceSet.getName());
        assembleTask = project.getTasks().create("assemble" + sourceSetName);
        assembleTask.setDescription("Assembles all " + sourceSetName + " builds.");
        assembleTask.setGroup(BasePlugin.BUILD_GROUP);
    } else {
        assembleTask = null;
    }
}
 
Example 2
Source File: AndroidComponentModelPlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private static String getBinaryName(BuildType buildType, ProductFlavorCombo flavorCombo) {
    if (flavorCombo.getFlavorList().isEmpty()) {
        return buildType.getName();
    } else {
        return flavorCombo.getName() + StringHelper.capitalize(buildType.getName());
    }

}
 
Example 3
Source File: TaskManager.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void createLintVitalTask(@NonNull ApkVariantData variantData) {
    checkState(getExtension().getLintOptions().isCheckReleaseBuilds());
    // TODO: re-enable with Jack when possible
    if (!variantData.getVariantConfiguration().getBuildType().isDebuggable()) {
        String variantName = variantData.getVariantConfiguration().getFullName();
        String capitalizedVariantName = StringHelper.capitalize(variantName);
        String taskName = "lintVital" + capitalizedVariantName;
        final Lint lintReleaseCheck = project.getTasks().create(taskName, Lint.class);
        // TODO: Make this task depend on lintCompile too (resolve initialization order first)
        optionalDependsOn(lintReleaseCheck, variantData.javacTask);
        lintReleaseCheck.setLintOptions(getExtension().getLintOptions());
        lintReleaseCheck.setSdkHome(sdkHandler.getSdkFolder());
        lintReleaseCheck.setVariantName(variantName);
        lintReleaseCheck.setToolingRegistry(toolingRegistry);
        lintReleaseCheck.setFatalOnly(true);
        lintReleaseCheck.setDescription(
                "Runs lint on just the fatal issues in the " + capitalizedVariantName
                        + " build.");
        //variantData.assembleVariantTask.dependsOn lintReleaseCheck

        // If lint is being run, we do not need to run lint vital.
        // TODO: Find a better way to do this.
        project.getGradle().getTaskGraph().whenReady(new Closure<Void>(this, this) {
            public void doCall(TaskExecutionGraph taskGraph) {
                if (taskGraph.hasTask(LINT)) {
                    lintReleaseCheck.setEnabled(false);
                }
            }
        });
    }
}
 
Example 4
Source File: VariantManager.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Turns a string into a valid source set name for the given {@link VariantType}, e.g.
 * "fooBarUnitTest" becomes "testFooBar".
 */
@NonNull
private static String computeSourceSetName(
        @NonNull String name,
        @NonNull VariantType variantType) {
    if (name.endsWith(variantType.getSuffix())) {
        name = name.substring(0, name.length() - variantType.getSuffix().length());
    }

    if (!variantType.getPrefix().isEmpty()) {
        name = variantType.getPrefix() + StringHelper.capitalize(name);
    }

    return name;
}
 
Example 5
Source File: BuildTypeData.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
BuildTypeData(
        @NonNull CoreBuildType buildType,
        @NonNull Project project,
        @NonNull DefaultAndroidSourceSet sourceSet) {
    super(sourceSet, project);

    this.buildType = buildType;

    String sourceSetName = StringHelper.capitalize(buildType.getName());

    assembleTask = project.getTasks().create("assemble" + sourceSetName);
    assembleTask.setDescription("Assembles all " + sourceSetName + " builds.");
    assembleTask.setGroup(BasePlugin.BUILD_GROUP);
}
 
Example 6
Source File: BaseVariantData.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
protected String getCapitalizedBuildTypeName() {
    return StringHelper.capitalize(variantConfiguration.getBuildType().getName());
}
 
Example 7
Source File: BaseVariantData.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
protected String getCapitalizedFlavorName() {
    return StringHelper.capitalize(variantConfiguration.getFlavorName());
}
 
Example 8
Source File: VariantOutputScope.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
public String getTaskName(@NonNull String prefix, @NonNull String suffix) {
    return prefix + StringHelper.capitalize(getVariantOutputData().getFullName()) + suffix;
}
 
Example 9
Source File: VariantScope.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
public String getTaskName(@NonNull String prefix, @NonNull String suffix) {
    return prefix + StringHelper.capitalize(getVariantConfiguration().getFullName()) + suffix;
}