当前位置: 首页>>代码示例>>Java>>正文


Java PluralsRes类代码示例

本文整理汇总了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);
}
 
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:22,代码来源:ContinueReadingCardView.java

示例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);
}
 
开发者ID:Zeal27,项目名称:SkinFramework,代码行数:10,代码来源:ComposedResources.java

示例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);
}
 
开发者ID:Zeal27,项目名称:SkinFramework,代码行数:10,代码来源:ComposedResources.java

示例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);
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:15,代码来源:SettingsActivity.java

示例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();
  }
}
 
开发者ID:jszczygiel,项目名称:android-common,代码行数:11,代码来源:BaseFragmentImpl.java

示例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));
}
 
开发者ID:halfhp,项目名称:lex,代码行数:5,代码来源:LexString.java

示例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);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:4,代码来源:StringProvider.java

示例8: plural

import android.support.annotation.PluralsRes; //导入依赖的package包/类
public static String plural(@PluralsRes int resId, int quantity) {
  return sContext.getResources().getQuantityString(resId, quantity, quantity);
}
 
开发者ID:ItsSelina,项目名称:tribbble,代码行数:4,代码来源:TribbbleApp.java

示例9: getQuantityString

import android.support.annotation.PluralsRes; //导入依赖的package包/类
private String getQuantityString(@PluralsRes int resId, int n) {
    return getContext().getResources().getQuantityString(resId, n, n);
}
 
开发者ID:damien5314,项目名称:TimeSinceTextView,代码行数:4,代码来源:TimeSinceTextViewAndroidTest.java

示例10: titlePlurals

import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder titlePlurals(@PluralsRes int val) {
    titlePluralsRes = val;
    return this;
}
 
开发者ID:microg,项目名称:android_external_MicroGUiTools,代码行数:5,代码来源:Condition.java

示例11: summaryPlurals

import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder summaryPlurals(@PluralsRes int val) {
    summaryPluralsRes = val;
    return this;
}
 
开发者ID:microg,项目名称:android_external_MicroGUiTools,代码行数:5,代码来源:Condition.java

示例12: firstActionPlurals

import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder firstActionPlurals(@PluralsRes int val, View.OnClickListener listener) {
    firstActionPluralsRes = val;
    firstActionListener = listener;
    return this;
}
 
开发者ID:microg,项目名称:android_external_MicroGUiTools,代码行数:6,代码来源:Condition.java

示例13: secondActionPlurals

import android.support.annotation.PluralsRes; //导入依赖的package包/类
public Builder secondActionPlurals(@PluralsRes int val, View.OnClickListener listener) {
    secondActionPluralsRes = val;
    secondActionListener = listener;
    return this;
}
 
开发者ID:microg,项目名称:android_external_MicroGUiTools,代码行数:6,代码来源:Condition.java

示例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);
}
 
开发者ID:b1acKr0se,项目名称:bridddle-for-dribbble,代码行数:7,代码来源:StringUtils.java

示例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);
}
 
开发者ID:simplesoft-duongdt3,项目名称:Android-App-Template,代码行数:4,代码来源:ResourcesUtil.java


注:本文中的android.support.annotation.PluralsRes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。