Java Code Examples for com.android.resources.ScreenSize#getIndex()

The following examples show how to use com.android.resources.ScreenSize#getIndex() . 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: ScreenSizeQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isMatchFor(ResourceQualifier qualifier) {
    // This is a match only if the screen size is smaller than the qualifier's screen size.
    if (qualifier instanceof ScreenSizeQualifier) {
        int qualifierIndex = ScreenSize.getIndex(((ScreenSizeQualifier) qualifier).mValue);
        int index = ScreenSize.getIndex(mValue);
        if (index <= qualifierIndex) {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: ScreenSizeQualifier.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) {
    if (compareTo == null) {
        return true;
    }

    ScreenSizeQualifier compareQ = (ScreenSizeQualifier) compareTo;
    int thisIndex = ScreenSize.getIndex(mValue);
    int compareIndex = ScreenSize.getIndex(compareQ.mValue);

    // Return true if this size is larger than reference size. Since isMatchFor() is called
    // before, it is guaranteed that the size will not be larger than the reference.
    return thisIndex > compareIndex;
}
 
Example 3
Source File: ScreenSizeQualifier.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isMatchFor(ResourceQualifier qualifier) {
    // This is a match only if the screen size is smaller than the qualifier's screen size.
    if (qualifier instanceof ScreenSizeQualifier) {
        int qualifierIndex = ScreenSize.getIndex(((ScreenSizeQualifier) qualifier).mValue);
        int index = ScreenSize.getIndex(mValue);
        if (index <= qualifierIndex) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: ScreenSizeQualifier.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) {
    if (compareTo == null) {
        return true;
    }

    ScreenSizeQualifier compareQ = (ScreenSizeQualifier) compareTo;
    int thisIndex = ScreenSize.getIndex(mValue);
    int compareIndex = ScreenSize.getIndex(compareQ.mValue);

    // Return true if this size is larger than reference size. Since isMatchFor() is called
    // before, it is guaranteed that the size will not be larger than the reference.
    return thisIndex > compareIndex;
}