本文整理汇总了Java中android.support.annotation.PluralsRes类的典型用法代码示例。如果您正苦于以下问题:Java PluralsRes类的具体用法?Java PluralsRes怎么用?Java PluralsRes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PluralsRes类属于android.support.annotation包,在下文中一共展示了PluralsRes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: header
import android.support.annotation.PluralsRes; //导入依赖的package包/类
private void header(@NonNull ContinueReadingCard card) {
int age = (int) card.daysOld();
@PluralsRes int subtitlePlural;
String subtitle;
if (age == 0) {
subtitle = getResources().getString(R.string.view_continue_reading_card_subtitle_today);
} else {
subtitlePlural = R.plurals.view_continue_reading_card_subtitle;
subtitle = getResources().getQuantityString(subtitlePlural, age, age);
}
headerView().setTitle(R.string.view_continue_reading_card_title)
.setImage(R.drawable.ic_arrow_forward_black_24dp)
.setImageCircleColor(R.color.base30)
.setCard(card)
.setCallback(getCallback());
largeHeaderView().setTitle(card.title())
.setImage(card.image())
.setSubtitle(subtitle)
.onClickListener(new CardClickListener())
.setVisibility(VISIBLE);
}
示例2: getQuantityText
import android.support.annotation.PluralsRes; //导入依赖的package包/类
@NonNull
@Override
public CharSequence getQuantityText(@PluralsRes int id, int quantity) throws NotFoundException {
int realId = getCorrespondResId(id);
if (realId > 0) {
return mSkinResources.getQuantityText(realId, quantity);
}
return super.getQuantityText(id, quantity);
}
示例3: getQuantityString
import android.support.annotation.PluralsRes; //导入依赖的package包/类
@NonNull
@Override
public String getQuantityString(@PluralsRes int id, int quantity, Object... formatArgs) throws NotFoundException {
int realId = getCorrespondResId(id);
if (realId > 0) {
return mSkinResources.getQuantityString(realId, quantity, formatArgs);
}
return super.getQuantityString(id, quantity, formatArgs);
}
示例4: updateSummaryWithPlurals
import android.support.annotation.PluralsRes; //导入依赖的package包/类
private void updateSummaryWithPlurals(String summaryKey,
int value,
@PluralsRes int pluralsId,
@StringRes int stringId,
boolean enabled) {
if (enabled) {
findPreference(summaryKey).setSummary(getResources()
.getQuantityString(pluralsId, value, value));
} else {
findPreference(summaryKey).setSummary(getString(stringId));
}
findPreference(summaryKey).setEnabled(enabled);
}
示例5: showToast
import android.support.annotation.PluralsRes; //导入依赖的package包/类
@Override
public void showToast(@PluralsRes final int id, final int quantity, final String... formatArgs) {
if (isAvailable()) {
Toast.makeText(
getContext(),
getQuantityString(id, quantity, (Object[]) formatArgs),
Toast.LENGTH_LONG)
.show();
}
}
示例6: withPlural
import android.support.annotation.PluralsRes; //导入依赖的package包/类
@NonNull
public ParsedLexString withPlural(@NonNull LexKey key, int quantity, @PluralsRes int resourceId) {
return with(key, Lex.resources.getQuantityString(resourceId, quantity));
}
示例7: getPlural
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public String getPlural(@PluralsRes int resId, int quantity, Object... formatArgs) {
return context.getResources().getQuantityString(resId, quantity, formatArgs);
}
示例8: plural
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public static String plural(@PluralsRes int resId, int quantity) {
return sContext.getResources().getQuantityString(resId, quantity, quantity);
}
示例9: getQuantityString
import android.support.annotation.PluralsRes; //导入依赖的package包/类
private String getQuantityString(@PluralsRes int resId, int n) {
return getContext().getResources().getQuantityString(resId, n, n);
}
示例10: titlePlurals
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder titlePlurals(@PluralsRes int val) {
titlePluralsRes = val;
return this;
}
示例11: summaryPlurals
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder summaryPlurals(@PluralsRes int val) {
summaryPluralsRes = val;
return this;
}
示例12: firstActionPlurals
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder firstActionPlurals(@PluralsRes int val, View.OnClickListener listener) {
firstActionPluralsRes = val;
firstActionListener = listener;
return this;
}
示例13: secondActionPlurals
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder secondActionPlurals(@PluralsRes int val, View.OnClickListener listener) {
secondActionPluralsRes = val;
secondActionListener = listener;
return this;
}
示例14: formatWithText
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public String formatWithText(@PluralsRes int pluralResource, @StringRes int zeroCountString, Integer count) {
if (count == null || count == 0)
return resources.getString(zeroCountString);
String formattedNumber = NumberFormat.getIntegerInstance().format(count);
return resources.getQuantityString(pluralResource, count, formattedNumber);
}
示例15: getQuantityString
import android.support.annotation.PluralsRes; //导入依赖的package包/类
public static String getQuantityString(@PluralsRes int pluralsRes, int quantity) throws Resources.NotFoundException {
return ContextUtil.getResources().getQuantityString(pluralsRes, quantity);
}