Java Code Examples for android.widget.GridView#AUTO_FIT

The following examples show how to use android.widget.GridView#AUTO_FIT . 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: PXValueParser.java    From pixate-freestyle-android with Apache License 2.0 5 votes vote down vote up
public int parseColumnCount(List<PXStylesheetLexeme> lexemes) {
    setupWithLexemes(lexemes);
    int result = GridView.AUTO_FIT;

    try {
        result = getColumnCount();
    } catch (Exception e) {
        addError(e.getMessage());
    }

    return result;
}
 
Example 2
Source File: PXValueParser.java    From pixate-freestyle-android with Apache License 2.0 5 votes vote down vote up
private int getColumnCount() {
    int result = GridView.AUTO_FIT;
    PXStylesheetTokenType currentType = currentLexeme.getType();
    Object value = currentLexeme.getValue();

    // If currentType is a number, that's the number of columns. If it's an
    // IDENTIFIER, then the only valid value is "auto". If it's anything
    // else, it's an invalid value and we'll anyway use the default of
    // "auto".
    switch (currentType) {
        case NUMBER:
            if (value instanceof Number) {
                result = ((Number) value).intValue();
            } else {
                result = Integer.parseInt((String) value);
            }
            break;
        case IDENTIFIER:
            // Check is here to just show the warning if applicable. Default
            // of "auto" is only valid value.
            if (!("auto".equals(value))) {
                exceptionWithMessage("'" + value + "' unrecognized as value for column count.");
            }
            break;
        default:
            exceptionWithMessage("'" + value + "' unrecognized as value for column count.");

    }

    advance();
    return result;
}