项目:apps-android-wikipedia
文件:ContinueReadingCardView.java
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);
}
项目:SkinFramework
文件:ComposedResources.java
@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);
}
项目:SkinFramework
文件:ComposedResources.java
@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,formatArgs);
}
项目:SkinFramework
文件:ComposedResources.java
@NonNull
@Override
public String getQuantityString(@PluralsRes int id,int quantity) throws NotFoundException {
int realId = getCorrespondResId(id);
if (realId > 0) {
return mSkinResources.getQuantityString(realId,quantity);
}
return super.getQuantityString(id,quantity);
}
项目:fitnotifications
文件:SettingsActivity.java
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);
}
项目:android-common
文件:BaseFragmentImpl.java
@Override
public void showToast(@PluralsRes final int id,final int quantity,final String... formatArgs) {
if (isAvailable()) {
Toast.makeText(
getContext(),getQuantityString(id,(Object[]) formatArgs),Toast.LENGTH_LONG)
.show();
}
}
项目:lex
文件:LexString.java
@NonNull
public ParsedLexString withPlural(@NonNull LexKey key,@PluralsRes int resourceId) {
return with(key,Lex.resources.getQuantityString(resourceId,quantity));
}
项目:disclosure-android-app
文件:StringProvider.java
public String getPlural(@PluralsRes int resId,Object... formatArgs) {
return context.getResources().getQuantityString(resId,formatArgs);
}
项目:tribbble
文件:TribbbleApp.java
public static String plural(@PluralsRes int resId,int quantity) {
return sContext.getResources().getQuantityString(resId,quantity);
}
项目:TimeSinceTextView
文件:TimeSinceTextViewAndroidTest.java
private String getQuantityString(@PluralsRes int resId,int n) {
return getContext().getResources().getQuantityString(resId,n,n);
}
项目:android_external_MicroGUiTools
文件:Condition.java
public Builder titlePlurals(@PluralsRes int val) {
titlePluralsRes = val;
return this;
}
项目:android_external_MicroGUiTools
文件:Condition.java
public Builder summaryPlurals(@PluralsRes int val) {
summaryPluralsRes = val;
return this;
}
项目:android_external_MicroGUiTools
文件:Condition.java
public Builder firstActionPlurals(@PluralsRes int val,View.OnClickListener listener) {
firstActionPluralsRes = val;
firstActionListener = listener;
return this;
}
项目:android_external_MicroGUiTools
文件:Condition.java
public Builder secondActionPlurals(@PluralsRes int val,View.OnClickListener listener) {
secondActionPluralsRes = val;
secondActionListener = listener;
return this;
}
项目:bridddle-for-dribbble
文件:StringUtils.java
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);
}
项目:Android-App-Template
文件:ResourcesUtil.java
public static String getQuantityString(@PluralsRes int pluralsRes,int quantity) throws Resources.NotFoundException {
return ContextUtil.getResources().getQuantityString(pluralsRes,quantity);
}
项目:android-common
文件:BaseFragmentImpl.java
public String getQuantityString(@PluralsRes int id,Object... formatArgs) {
return getResources().getQuantityString(id,formatArgs);
}
项目:resourceholder
文件:PluralStringResource.java
public PluralStringResource(@PluralsRes final int pluralResourceId) {
mPluralResourceId = pluralResourceId;
}
项目:FxcnBeta
文件:TimeStringHelper.java
private static String getResString(@PluralsRes int pluralsId,int value) {
return sResources.getQuantityString(pluralsId,value);
}
项目:BabyFace
文件:FaceSettingsActivity.java
private String prettyPrintDuration(int amount,@PluralsRes int pluralsRes) {
return amount + " " + getResources().getQuantityString(pluralsRes,amount);
}
项目:edx-app-android
文件:ResourceUtil.java
public static CharSequence getFormattedStringForQuantity(@NonNull Resources resources,@PluralsRes int resourceId,int quantity) {
return getFormattedStringForQuantity(resources,resourceId,QuantityHolder,quantity);
}
项目:edx-app-android
文件:ResourceUtil.java
public static CharSequence getFormattedStringForQuantity(@NonNull Resources resources,@NonNull String key,int quantity) {
String template = resources.getQuantityString(resourceId,quantity);
return Phrase.from(template).put(key,quantity + "").format();
}
项目:Qiitanium
文件:ResUtils.java
public static String getQuantityString(Context ctx,@PluralsRes int pluralResId,int quantity) {
return ctx.getResources().getQuantityString(pluralResId,quantity);
}
项目:apps-android-wikipedia
文件:ReadingListFragment.java
@NonNull private String getQuantityString(@PluralsRes int id,Object... formatArgs) {
return getResources().getQuantityString(id,formatArgs);
}
项目:FormattEditText
文件:DecimalEditText.java
/**
* Set whole format of edit text field for displaying decimal value.
*
* @param decimalRounding
* Amount of fraction digits.
* @param pluralResource
* Resource ID of plural strings (don't use plurals with numbers!).
*/
public void setFormat(int decimalRounding,@PluralsRes int pluralResource) {
this.decimalRounding = decimalRounding;
if (this.decimalRounding < 0)
this.decimalRounding = 0;
this.pluralLabel = pluralResource;
updateText();
}
项目:AndProx
文件:Utils.java
/**
* Given a plural resource (R.plurals),localize the string according to the language preferences
* on the device.
*
* @param pluralResource R.plurals to localize.
* @param quantity Quantity to use for pluaralisation rules
* @param formatArgs Formatting arguments to pass
* @return Localized string
*/
public static String localizePlural(@PluralsRes int pluralResource,Object... formatArgs) {
Resources res = AndProxApplication.getInstance().getResources();
return res.getQuantityString(pluralResource,formatArgs);
}
项目:Minerva
文件:Minerva.java
/**
* Get a formatted quantity string resource using the application context.
* @param resId String resource ID.
* @param count Quantity.
* @param formatArgs Format arguments.
* @return Formatted quantity string.
*/
public String getQString(@PluralsRes int resId,int count,Object... formatArgs) {
return getResources().getQuantityString(resId,formatArgs);
}
项目:FormattEditText
文件:DecimalEditText.java
/**
* Gets resource ID of plural for formatting view of input field.
*
* @return ID of current plural in resources.
*/
@PluralsRes
public int getPluralResource() {
return pluralLabel;
}
项目:FormattEditText
文件:DecimalEditText.java
/**
* Sets plural for formatting of current value with label and updates view.
*
* @param pluralResource
* Resource ID of plural strings (don't use plurals with numbers!).
*/
public void setPluralResource(@PluralsRes final int pluralResource) {
pluralLabel = pluralResource;
updateText();
}
项目:phrase
文件:Phrase.java
/**
* Entry point into this API.
*
* @throws IllegalArgumentException if pattern contains any syntax errors.
*/
public static Phrase fromPlural(View v,@PluralsRes int patternResourceId,int quantity) {
return fromPlural(v.getResources(),patternResourceId,quantity);
}
项目:phrase
文件:Phrase.java
/**
* Entry point into this API.
*
* @throws IllegalArgumentException if pattern contains any syntax errors.
*/
public static Phrase fromPlural(Context c,int quantity) {
return fromPlural(c.getResources(),quantity);
}
项目:phrase
文件:Phrase.java
/**
* Entry point into this API.
*
* @throws IllegalArgumentException if pattern contains any syntax errors.
*/
public static Phrase fromPlural(Resources r,int quantity) {
return from(r.getQuantityText(patternResourceId,quantity));
}
项目:android-tao-core
文件:AppResources.java
/**
* Returns the character sequence necessary for grammatically correct pluralization
* of the given resource ID for the given quantity.
* Note that the character sequence is selected based solely on grammatical necessity,* and that such rules differ between languages. Do not assume you know which string
* will be returned for a given quantity. See
* <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String Resources</a>
* for more detail.
*
* @param id The desired resource identifier,as generated by the aapt
* tool. This integer encodes the package,type,and resource
* entry. The value 0 is an invalid identifier.
* @param quantity The number used to get the correct string for the current language's
* plural rules.
* @return CharSequence The string data associated with the resource,plus
* possibly styled text information.
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*/
public static CharSequence getQuantityText(@PluralsRes int id,int quantity) throws NotFoundException {
return resources.getQuantityText(id,quantity);
}
项目:android-tao-core
文件:AppResources.java
/**
* Formats the string necessary for grammatically correct pluralization
* of the given resource ID for the given quantity,using the given arguments.
* Note that the string is selected based solely on grammatical necessity,* and that such rules differ between languages. Do not assume you know which string
* will be returned for a given quantity. See
* <a href="{@docRoot}guide/topics/resources/string-resource.html#Plurals">String Resources</a>
* for more detail.
* <p/>
* <p>Substitution of format arguments works as if using
* {@link java.util.Formatter} and {@link java.lang.String#format}.
* The resulting string will be stripped of any styled text information.
*
* @param id The desired resource identifier,as generated by the aapt
* tool. This integer encodes the package,and resource
* entry. The value 0 is an invalid identifier.
* @param quantity The number used to get the correct string for the current language's
* plural rules.
* @param formatArgs The format arguments that will be used for substitution.
* @return String The string data associated with the resource,* stripped of styled text information.
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*/
public static String getQuantityString(@PluralsRes int id,Object... formatArgs) throws NotFoundException {
return resources.getQuantityString(id,formatArgs);
}
项目:android-tao-core
文件:AppResources.java
/**
* Returns the string necessary for grammatically correct pluralization
* of the given resource ID for the given quantity.
* Note that the string is selected based solely on grammatical necessity,and resource
* entry. The value 0 is an invalid identifier.
* @param quantity The number used to get the correct string for the current language's
* plural rules.
* @return String The string data associated with the resource,int quantity) throws NotFoundException {
return resources.getQuantityString(id,quantity);
}
项目:android-common
文件:BaseFragment.java
void showToast(@PluralsRes int id,String... formatArgs);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。