Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/java/com/google/android/material/slider/BaseSlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ abstract class BaseSlider<
@NonNull private final Paint inactiveTicksPaint;
@NonNull private final Paint activeTicksPaint;
@NonNull private final Paint stopIndicatorPaint;
@NonNull private final Locale locale;
@NonNull private final AccessibilityHelper accessibilityHelper;
private final AccessibilityManager accessibilityManager;
private AccessibilityEventSender accessibilityEventSender;
Expand Down Expand Up @@ -465,6 +466,8 @@ public BaseSlider(
// Initialize with just this view's visibility.
thisAndAncestorsVisible = isShown();

locale = context.getResources().getConfiguration().locale;

inactiveTrackPaint = new Paint();
activeTrackPaint = new Paint();

Expand Down Expand Up @@ -3553,7 +3556,7 @@ private String formatValue(float value) {
return formatter.getFormattedValue(value);
}

return String.format((int) value == value ? "%.0f" : "%.2f", value);
return String.format(locale, (int) value == value ? "%.0f" : "%.2f", value);
}

private void setValueForLabel(TooltipDrawable label, float value) {
Expand Down Expand Up @@ -4167,7 +4170,7 @@ protected void onPopulateNodeForVirtualView(
info.setStateDescription(stateDescription);
} else {
contentDescription.append(
String.format(Locale.getDefault(), "%s, %s", verbalValueType, verbalValue));
String.format(slider.locale, "%s, %s", verbalValueType, verbalValue));
}
info.setContentDescription(contentDescription.toString());

Expand Down