Java Code Examples for com.android.utils.SdkUtils#endsWith()

The following examples show how to use com.android.utils.SdkUtils#endsWith() . 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: SingleResourceFile.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Validates the associated resource file to make sure the attribute references are valid
 *
 * @return true if parsing succeeds and false if it fails
 */
private boolean validateAttributes(ScanningContext context) {
    // We only need to check if it's a non-framework file (and an XML file; skip .png's)
    if (!isFramework() && SdkUtils.endsWith(getFile().getName(), DOT_XML)) {
        ValidatingResourceParser parser = new ValidatingResourceParser(context, false);
        try {
            IAbstractFile file = getFile();
            return parser.parse(file.getOsLocation(), file.getContents());
        } catch (Exception e) {
            context.needsFullAapt();
        }

        return false;
    }

    return true;
}
 
Example 2
Source File: SingleResourceFile.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Validates the associated resource file to make sure the attribute references are valid
 *
 * @return true if parsing succeeds and false if it fails
 */
private boolean validateAttributes(ScanningContext context) {
    // We only need to check if it's a non-framework file (and an XML file; skip .png's)
    if (!isFramework() && SdkUtils.endsWith(getFile().getName(), DOT_XML)) {
        ValidatingResourceParser parser = new ValidatingResourceParser(context, false);
        try {
            IAbstractFile file = getFile();
            return parser.parse(file.getOsLocation(), file.getContents());
        } catch (Exception e) {
            context.needsFullAapt();
        }

        return false;
    }

    return true;
}
 
Example 3
Source File: SingleResourceFile.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
/**
 * Validates the associated resource file to make sure the attribute references are valid
 *
 * @return true if parsing succeeds and false if it fails
 */
private boolean validateAttributes(ScanningContext context) {
    // We only need to check if it's a non-framework file (and an XML file; skip .png's)
    if (!isFramework() && SdkUtils.endsWith(getFile().getName(), DOT_XML)) {
        ValidatingResourceParser parser = new ValidatingResourceParser(context, false);
        try {
            IAbstractFile file = getFile();
            return parser.parse(file.getOsLocation(), file.getContents());
        } catch (Exception e) {
            context.needsFullAapt();
        }

        return false;
    }

    return true;
}
 
Example 4
Source File: XmlPrettyPrinter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private boolean hasBlankLineAbove() {
    if (mOut.length() < 2 * mLineSeparator.length()) {
        return false;
    }

    return SdkUtils.endsWith(mOut, mLineSeparator) &&
            SdkUtils.endsWith(mOut, mOut.length() - mLineSeparator.length(), mLineSeparator);
}
 
Example 5
Source File: XmlPrettyPrinter.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private boolean hasBlankLineAbove() {
    if (mOut.length() < 2 * mLineSeparator.length()) {
        return false;
    }

    return SdkUtils.endsWith(mOut, mLineSeparator) &&
            SdkUtils.endsWith(mOut, mOut.length() - mLineSeparator.length(), mLineSeparator);
}