androidx.annotation.PluralsRes Java Examples
The following examples show how to use
androidx.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: StringAttributeData.java From epoxy with Apache License 2.0 | 5 votes |
public void setValue(@PluralsRes int pluralRes, int quantity, @Nullable Object[] formatArgs) { if (pluralRes != 0) { this.pluralRes = pluralRes; this.quantity = quantity; this.formatArgs = formatArgs; string = null; stringRes = 0; } else { handleInvalidStringRes(); } }
Example #2
Source File: TestFieldPropGenerateStringOverloadsOptionViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TestFieldPropGenerateStringOverloadsOptionView#value */ public TestFieldPropGenerateStringOverloadsOptionViewModel_ valueQuantityRes( @PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); value_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #3
Source File: TestStringOverloadsViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TestStringOverloadsView#setTitle(CharSequence) */ public TestStringOverloadsViewModel_ titleQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); title_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #4
Source File: TestStringOverloadsViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TestStringOverloadsView#setTitleViaValueShortcut(CharSequence) */ public TestStringOverloadsViewModel_ titleViaValueShortcutQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(2); titleViaValueShortcut_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #5
Source File: TestTextPropViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TestTextPropView#setTitle(CharSequence) */ public TestTextPropViewModel_ titleQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); title_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #6
Source File: TestFieldPropTextPropViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TestFieldPropTextPropView#value */ public TestFieldPropTextPropViewModel_ valueQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); value_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #7
Source File: TextPropModelViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TextPropModelView#setTitle(CharSequence) */ public TextPropModelViewModel_ titleQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); title_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #8
Source File: TestFieldPropChildViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TestFieldPropChildView#textValue */ public TestFieldPropChildViewModel_ textValueQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); textValue_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #9
Source File: TextPropDefaultViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
/** * Throws if a value <= 0 is set. * <p> * <i>Required.</i> * * @see TextPropDefaultView#textWithDefault(CharSequence) */ public TextPropDefaultViewModel_ textWithDefaultQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); assignedAttributes_epoxyGeneratedModel.set(0); textWithDefault_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #10
Source File: ResourceUtil.java From edx-app-android with Apache License 2.0 | 4 votes |
public static CharSequence getFormattedStringForQuantity(@NonNull Resources resources, @PluralsRes int resourceId, int quantity) { return getFormattedStringForQuantity(resources, resourceId, QuantityHolder, quantity); }
Example #11
Source File: HashtagArrayAdapter.java From socialview with Apache License 2.0 | 4 votes |
public HashtagArrayAdapter(@NonNull Context context, @PluralsRes int countPluralRes) { super(context, R.layout.socialview_layout_hashtag, R.id.socialview_hashtag); this.countPluralRes = countPluralRes; }
Example #12
Source File: BadgeDrawable.java From material-components-android with Apache License 2.0 | 4 votes |
public void setContentDescriptionQuantityStringsResource(@PluralsRes int stringsResource) { savedState.contentDescriptionQuantityStrings = stringsResource; }
Example #13
Source File: MainApp.java From AndroidAPS with GNU Affero General Public License v3.0 | 4 votes |
public static String gq(@PluralsRes int id, int quantity, Object... args) { return sResources.getQuantityString(id, quantity, args); }
Example #14
Source File: TimeFrameUtils.java From Pix-Art-Messenger with GNU General Public License v3.0 | 4 votes |
private TimeFrame(long duration, @PluralsRes int name) { this.duration = duration; this.name = name; }
Example #15
Source File: CreateKbsPinFragment.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
private String getPinLengthRestrictionText(@PluralsRes int plurals) { return requireContext().getResources().getQuantityString(plurals, KbsConstants.MINIMUM_PIN_LENGTH, KbsConstants.MINIMUM_PIN_LENGTH); }
Example #16
Source File: ResourceUtil.java From edx-app-android with Apache License 2.0 | 4 votes |
public static CharSequence getFormattedStringForQuantity(@NonNull Resources resources, @PluralsRes int resourceId, @NonNull String key, int quantity) { return getFormattedStringForQuantity(resources, resourceId, quantity, Collections.singletonMap(key, quantity + "")); }
Example #17
Source File: ResourceUtil.java From edx-app-android with Apache License 2.0 | 4 votes |
public static CharSequence getFormattedStringForQuantity(@NonNull Resources resources, @PluralsRes int resourceId, int quantity, @NonNull Map<String, String> keyValMap) { String template = resources.getQuantityString(resourceId, quantity); return getFormattedString(template, keyValMap); }
Example #18
Source File: QuantityStringResAttribute.java From epoxy with Apache License 2.0 | 4 votes |
@PluralsRes public int getId() { return id; }
Example #19
Source File: QuantityStringResAttribute.java From epoxy with Apache License 2.0 | 4 votes |
public QuantityStringResAttribute(@PluralsRes int id, int quantity, @Nullable Object[] formatArgs) { this.quantity = quantity; this.id = id; this.formatArgs = formatArgs; }
Example #20
Source File: TestManyTypesViewModelBuilder.java From epoxy with Apache License 2.0 | 4 votes |
TestManyTypesViewModelBuilder titleQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs);
Example #21
Source File: CommonUtils.java From CommonUtils with Apache License 2.0 | 4 votes |
public static void setTextPlural(@NonNull TextView view, @PluralsRes int res, int num, Object... args) { view.setText(view.getContext().getResources().getQuantityString(res, num, args)); }
Example #22
Source File: ConversationListFragment.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
protected @PluralsRes int getArchivedSnackbarTitleRes() { return R.plurals.ConversationListFragment_conversations_archived; }
Example #23
Source File: DecimalEditText.java From FormattEditText with Apache License 2.0 | 3 votes |
/** * 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(); }
Example #24
Source File: TestNullStringOverloadsViewModel_.java From epoxy with Apache License 2.0 | 3 votes |
/** * If a value of 0 is set then this attribute will revert to its default value. * <p> * <i>Optional</i>: Default value is (CharSequence) null * * @see TestNullStringOverloadsView#setTitle(CharSequence) */ public TestNullStringOverloadsViewModel_ titleQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); title_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #25
Source File: TextPropDefaultViewModel_.java From epoxy with Apache License 2.0 | 3 votes |
/** * If a value of 0 is set then this attribute will revert to its default value. * <p> * <i>Optional</i>: Default value is R.string.string_resource_value * * @see TextPropDefaultView#nullableTextWithDefault(CharSequence) */ public TextPropDefaultViewModel_ nullableTextWithDefaultQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); nullableTextWithDefault_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #26
Source File: TestManyTypesViewModel_.java From epoxy with Apache License 2.0 | 3 votes |
/** * If a value of 0 is set then this attribute will revert to its default value. * <p> * <i>Optional</i>: Default value is (CharSequence) null * * @see TestManyTypesView#setTitle(CharSequence) */ public TestManyTypesViewModel_ titleQuantityRes(@PluralsRes int pluralRes, int quantity, Object... formatArgs) { onMutation(); title_StringAttributeData.setValue(pluralRes, quantity, formatArgs); return this; }
Example #27
Source File: DecimalEditText.java From FormattEditText with Apache License 2.0 | 2 votes |
/** * Gets resource ID of plural for formatting view of input field. * * @return ID of current plural in resources. */ @PluralsRes public int getPluralResource() { return pluralLabel; }
Example #28
Source File: DecimalEditText.java From FormattEditText with Apache License 2.0 | 2 votes |
/** * 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(); }
Example #29
Source File: Phrase.java From phrase with Apache License 2.0 | 2 votes |
/** * 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); }
Example #30
Source File: Phrase.java From phrase with Apache License 2.0 | 2 votes |
/** * Entry point into this API. * * @throws IllegalArgumentException if pattern contains any syntax errors. */ public static Phrase fromPlural(Context c, @PluralsRes int patternResourceId, int quantity) { return fromPlural(c.getResources(), patternResourceId, quantity); }