android.support.annotation.PluralsRes Java Examples

The following examples show how to use android.support.annotation.PluralsRes. 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: SettingsActivity.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #2
Source File: TextUtil.java    From px-android with MIT License 4 votes vote down vote up
public static String format(@NonNull final Context context, @PluralsRes final int resId, final int quantity,
    @NonNull final String... args) {
    return resId == 0 ? EMPTY : format(context.getResources().getQuantityString(resId, quantity), args);
}
 
Example #3
Source File: TimeFrameUtils.java    From Conversations with GNU General Public License v3.0 4 votes vote down vote up
private TimeFrame(long duration, @PluralsRes int name) {
    this.duration = duration;
    this.name = name;
}
 
Example #4
Source File: ResUtils.java    From Qiitanium with MIT License 4 votes vote down vote up
public static String getQuantityString(Context ctx, @PluralsRes int pluralResId, int quantity) {
  return ctx.getResources().getQuantityString(pluralResId, quantity, quantity);
}
 
Example #5
Source File: Condition.java    From android_external_MicroGUiTools with Apache License 2.0 4 votes vote down vote up
public Builder secondActionPlurals(@PluralsRes int val, View.OnClickListener listener) {
    secondActionPluralsRes = val;
    secondActionListener = listener;
    return this;
}
 
Example #6
Source File: Condition.java    From android_external_MicroGUiTools with Apache License 2.0 4 votes vote down vote up
public Builder firstActionPlurals(@PluralsRes int val, View.OnClickListener listener) {
    firstActionPluralsRes = val;
    firstActionListener = listener;
    return this;
}
 
Example #7
Source File: Condition.java    From android_external_MicroGUiTools with Apache License 2.0 4 votes vote down vote up
public Builder summaryPlurals(@PluralsRes int val) {
    summaryPluralsRes = val;
    return this;
}
 
Example #8
Source File: Condition.java    From android_external_MicroGUiTools with Apache License 2.0 4 votes vote down vote up
public Builder titlePlurals(@PluralsRes int val) {
    titlePluralsRes = val;
    return this;
}
 
Example #9
Source File: TimeSinceTextViewAndroidTest.java    From TimeSinceTextView with Apache License 2.0 4 votes vote down vote up
private String getQuantityString(@PluralsRes int resId, int n) {
    return getContext().getResources().getQuantityString(resId, n, n);
}
 
Example #10
Source File: TribbbleApp.java    From tribbble with Apache License 2.0 4 votes vote down vote up
public static String plural(@PluralsRes int resId, int quantity) {
  return sContext.getResources().getQuantityString(resId, quantity, quantity);
}
 
Example #11
Source File: StringUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static CharSequence getQuantityText(@PluralsRes int id, int quantity) {
    return UtilsApp.getApp().getResources().getQuantityText(id, quantity);
}
 
Example #12
Source File: CommentsRecyclerAdapter.java    From Capstone-Project with MIT License 4 votes vote down vote up
public String getQuantityString(@PluralsRes int resId, int quantity, Object... args) {
    return itemView.getResources()
            .getQuantityString(R.plurals.item_post_details_comment_votes,
                    quantity,
                    args);
}
 
Example #13
Source File: ResourcesUtil.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
public static String getQuantityString(@PluralsRes int pluralsRes, int quantity) throws Resources.NotFoundException {
    return Base.getResources().getQuantityString(pluralsRes, quantity);
}
 
Example #14
Source File: ResUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static String getQuantityString(@PluralsRes int id, int quantity, Object... formatArgs) {
    return UtilsApp.getApp().getResources().getQuantityString(id, quantity, formatArgs);
}
 
Example #15
Source File: ResUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static String getQuantityString(@PluralsRes int id, int quantity) {
    return UtilsApp.getApp().getResources().getQuantityString(id, quantity);
}
 
Example #16
Source File: ResUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static CharSequence getQuantityText(@PluralsRes int id, int quantity) {
    return UtilsApp.getApp().getResources().getQuantityText(id, quantity);
}
 
Example #17
Source File: StringUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static String getQuantityString(@PluralsRes int id, int quantity, Object... formatArgs) {
    return UtilsApp.getApp().getResources().getQuantityString(id, quantity, formatArgs);
}
 
Example #18
Source File: StringUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static String getQuantityString(@PluralsRes int id, int quantity) {
    return UtilsApp.getApp().getResources().getQuantityString(id, quantity);
}