@Test public void getFormattedValueRangeIgnoresMaxForLightCategory() throws Exception { assertEquals("0%", expansionCategoryFormatter.getFormattedValueRange(Category.LIGHT, new ExpansionValueRange(0, 32), getContext())); assertEquals("0%", expansionCategoryFormatter.getFormattedValueRange(Category.LIGHT, new ExpansionValueRange(0, 100), getContext())); }
public String getFormattedValueRange(@NonNull final Category category, @NonNull final ExpansionValueRange valueRange, @NonNull final Context context) { final CharSequence suffix = getSuffix(category); final UnitConverter unitConverter = getUnitConverter(category); switch (category) { case TEMPERATURE: if (!valueRange.hasSameValues()) { return context.getString(R.string.smart_alarm_expansion_range_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix, unitConverter.convert(valueRange.max) .intValue(), suffix); } case LIGHT: default: return context.getString(R.string.smart_alarm_expansion_same_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix); } }
ExpansionCategoryFormatter { public String getFormattedValueRange(@NonNull final Category category, @NonNull final ExpansionValueRange valueRange, @NonNull final Context context) { final CharSequence suffix = getSuffix(category); final UnitConverter unitConverter = getUnitConverter(category); switch (category) { case TEMPERATURE: if (!valueRange.hasSameValues()) { return context.getString(R.string.smart_alarm_expansion_range_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix, unitConverter.convert(valueRange.max) .intValue(), suffix); } case LIGHT: default: return context.getString(R.string.smart_alarm_expansion_same_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix); } } }
ExpansionCategoryFormatter { public String getFormattedValueRange(@NonNull final Category category, @NonNull final ExpansionValueRange valueRange, @NonNull final Context context) { final CharSequence suffix = getSuffix(category); final UnitConverter unitConverter = getUnitConverter(category); switch (category) { case TEMPERATURE: if (!valueRange.hasSameValues()) { return context.getString(R.string.smart_alarm_expansion_range_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix, unitConverter.convert(valueRange.max) .intValue(), suffix); } case LIGHT: default: return context.getString(R.string.smart_alarm_expansion_same_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix); } } @Inject  ExpansionCategoryFormatter(@NonNull final UnitFormatter unitFormatter); }
ExpansionCategoryFormatter { public String getFormattedValueRange(@NonNull final Category category, @NonNull final ExpansionValueRange valueRange, @NonNull final Context context) { final CharSequence suffix = getSuffix(category); final UnitConverter unitConverter = getUnitConverter(category); switch (category) { case TEMPERATURE: if (!valueRange.hasSameValues()) { return context.getString(R.string.smart_alarm_expansion_range_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix, unitConverter.convert(valueRange.max) .intValue(), suffix); } case LIGHT: default: return context.getString(R.string.smart_alarm_expansion_same_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix); } } @Inject  ExpansionCategoryFormatter(@NonNull final UnitFormatter unitFormatter); String getFormattedValueRange(@NonNull final Category category,
                                         @NonNull final ExpansionValueRange valueRange,
                                         @NonNull final Context context); Pair<Integer,Integer> getInitialValuePair(@NonNull final Category category,
                                     @NonNull final List<Capability> capabilities,
                                     @NonNull final ExpansionValueRange valueRange); ExpansionValueRange getIdealValueRange(@NonNull final Category category,
                                                  @NonNull final ExpansionValueRange valueRange); UnitConverter getUnitConverter(@NonNull final Category category); UnitConverter getReverseUnitConverter(@NonNull final Category category); String getFormattedAttributionValueRange(@NonNull final Category category,
                                                    @NonNull final ExpansionValueRange expansionRange,
                                                    @NonNull final Context context); String getSuffix(@NonNull final Category category); @DrawableRes int getDisplayIconRes(@NonNull final Category category); @StringRes int getDisplayValueResFromState(@NonNull final State expansionState); @XmlRes int getExpansionInfoDialogXmlRes(@NonNull final Category category); @XmlRes int getExpansionAlarmInfoDialogXmlRes(@NonNull final Category category); }
ExpansionCategoryFormatter { public String getFormattedValueRange(@NonNull final Category category, @NonNull final ExpansionValueRange valueRange, @NonNull final Context context) { final CharSequence suffix = getSuffix(category); final UnitConverter unitConverter = getUnitConverter(category); switch (category) { case TEMPERATURE: if (!valueRange.hasSameValues()) { return context.getString(R.string.smart_alarm_expansion_range_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix, unitConverter.convert(valueRange.max) .intValue(), suffix); } case LIGHT: default: return context.getString(R.string.smart_alarm_expansion_same_value_format, unitConverter.convert(valueRange.min) .intValue(), suffix); } } @Inject  ExpansionCategoryFormatter(@NonNull final UnitFormatter unitFormatter); String getFormattedValueRange(@NonNull final Category category,
                                         @NonNull final ExpansionValueRange valueRange,
                                         @NonNull final Context context); Pair<Integer,Integer> getInitialValuePair(@NonNull final Category category,
                                     @NonNull final List<Capability> capabilities,
                                     @NonNull final ExpansionValueRange valueRange); ExpansionValueRange getIdealValueRange(@NonNull final Category category,
                                                  @NonNull final ExpansionValueRange valueRange); UnitConverter getUnitConverter(@NonNull final Category category); UnitConverter getReverseUnitConverter(@NonNull final Category category); String getFormattedAttributionValueRange(@NonNull final Category category,
                                                    @NonNull final ExpansionValueRange expansionRange,
                                                    @NonNull final Context context); String getSuffix(@NonNull final Category category); @DrawableRes int getDisplayIconRes(@NonNull final Category category); @StringRes int getDisplayValueResFromState(@NonNull final State expansionState); @XmlRes int getExpansionInfoDialogXmlRes(@NonNull final Category category); @XmlRes int getExpansionAlarmInfoDialogXmlRes(@NonNull final Category category);  }