Search in sources :

Example 1 with PluralRules

use of android.icu.text.PluralRules in project android_frameworks_base by AOSPA.

the class ResourcesImpl method getQuantityText.

@NonNull
CharSequence getQuantityText(@PluralsRes int id, int quantity) throws NotFoundException {
    PluralRules rule = getPluralRule();
    CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity)));
    if (res != null) {
        return res;
    }
    res = mAssets.getResourceBagText(id, ID_OTHER);
    if (res != null) {
        return res;
    }
    throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity));
}
Also used : PluralRules(android.icu.text.PluralRules) NotFoundException(android.content.res.Resources.NotFoundException) NonNull(android.annotation.NonNull)

Example 2 with PluralRules

use of android.icu.text.PluralRules in project platform_frameworks_base by android.

the class ResourcesImpl method getQuantityText.

@NonNull
CharSequence getQuantityText(@PluralsRes int id, int quantity) throws NotFoundException {
    PluralRules rule = getPluralRule();
    CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity)));
    if (res != null) {
        return res;
    }
    res = mAssets.getResourceBagText(id, ID_OTHER);
    if (res != null) {
        return res;
    }
    throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity));
}
Also used : PluralRules(android.icu.text.PluralRules) NotFoundException(android.content.res.Resources.NotFoundException) NonNull(android.annotation.NonNull)

Example 3 with PluralRules

use of android.icu.text.PluralRules in project android_frameworks_base by DirtyUnicorns.

the class ResourcesImpl method getQuantityText.

@NonNull
CharSequence getQuantityText(@PluralsRes int id, int quantity) throws NotFoundException {
    PluralRules rule = getPluralRule();
    CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity)));
    if (res != null) {
        return res;
    }
    res = mAssets.getResourceBagText(id, ID_OTHER);
    if (res != null) {
        return res;
    }
    throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity));
}
Also used : PluralRules(android.icu.text.PluralRules) NotFoundException(android.content.res.Resources.NotFoundException) NonNull(android.annotation.NonNull)

Example 4 with PluralRules

use of android.icu.text.PluralRules in project android_frameworks_base by ResurrectionRemix.

the class ResourcesImpl method getQuantityText.

@NonNull
CharSequence getQuantityText(@PluralsRes int id, int quantity) throws NotFoundException {
    PluralRules rule = getPluralRule();
    CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity)));
    if (res != null) {
        return res;
    }
    res = mAssets.getResourceBagText(id, ID_OTHER);
    if (res != null) {
        return res;
    }
    throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity));
}
Also used : PluralRules(android.icu.text.PluralRules) NotFoundException(android.content.res.Resources.NotFoundException) NonNull(android.annotation.NonNull)

Example 5 with PluralRules

use of android.icu.text.PluralRules in project android_frameworks_base by crdroidandroid.

the class ResourcesImpl method getQuantityText.

@NonNull
CharSequence getQuantityText(@PluralsRes int id, int quantity) throws NotFoundException {
    PluralRules rule = getPluralRule();
    CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity)));
    if (res != null) {
        return res;
    }
    res = mAssets.getResourceBagText(id, ID_OTHER);
    if (res != null) {
        return res;
    }
    throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity));
}
Also used : PluralRules(android.icu.text.PluralRules) NotFoundException(android.content.res.Resources.NotFoundException) NonNull(android.annotation.NonNull)

Aggregations

NonNull (android.annotation.NonNull)5 NotFoundException (android.content.res.Resources.NotFoundException)5 PluralRules (android.icu.text.PluralRules)5