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 Project: fitnotifications   Author: abhijitvalluri   File: SettingsActivity.java    License: 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 Project: Android-utils   Author: Shouheng88   File: StringUtils.java    License: 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 #3
Source Project: Android-utils   Author: Shouheng88   File: StringUtils.java    License: 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 #4
Source Project: Android-utils   Author: Shouheng88   File: StringUtils.java    License: 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 #5
Source Project: Android-utils   Author: Shouheng88   File: ResUtils.java    License: 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 #6
Source Project: Android-utils   Author: Shouheng88   File: ResUtils.java    License: 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 #7
Source Project: Android-utils   Author: Shouheng88   File: ResUtils.java    License: 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 #8
Source Project: PowerFileExplorer   Author: PowerExplorer   File: ResourcesUtil.java    License: 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 #9
Source Project: Capstone-Project   Author: crazyhitty   File: CommentsRecyclerAdapter.java    License: 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 #10
Source Project: px-android   Author: mercadopago   File: TextUtil.java    License: 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 #11
Source Project: tribbble   Author: ItsSelina   File: TribbbleApp.java    License: 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 #12
Source Project: TimeSinceTextView   Author: damien5314   File: TimeSinceTextViewAndroidTest.java    License: 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 #13
Source Project: android_external_MicroGUiTools   Author: microg   File: Condition.java    License: Apache License 2.0 4 votes vote down vote up
public Builder titlePlurals(@PluralsRes int val) {
    titlePluralsRes = val;
    return this;
}
 
Example #14
Source Project: android_external_MicroGUiTools   Author: microg   File: Condition.java    License: Apache License 2.0 4 votes vote down vote up
public Builder summaryPlurals(@PluralsRes int val) {
    summaryPluralsRes = val;
    return this;
}
 
Example #15
Source Project: android_external_MicroGUiTools   Author: microg   File: Condition.java    License: 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 #16
Source Project: android_external_MicroGUiTools   Author: microg   File: Condition.java    License: 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 #17
Source Project: Qiitanium   Author: ogaclejapan   File: ResUtils.java    License: 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 #18
Source Project: Conversations   Author: iNPUTmice   File: TimeFrameUtils.java    License: 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;
}