Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Removed the use of "defaultUnitSystem";as it is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
pbanavali committed Oct 10, 2023
1 parent 83d55dc commit f8dd637
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,15 @@ public static void setShowIntroduction(boolean introduction) {

public static UnitSystem getUnitSystem() {
final String STATS_UNIT_DEFAULT = resources.getString(R.string.stats_units_default);

final String VALUE = getString(R.string.stats_units_key, STATS_UNIT_DEFAULT);

// Define the default UnitSystem only once
UnitSystem defaultUnitSystem = UnitSystem.METRIC;

return Arrays.stream(UnitSystem.values())
.filter(d -> VALUE.equals(resources.getString(d.getPreferenceId(), STATS_UNIT_DEFAULT)))
.findFirst()
.orElse(UnitSystem.defaultUnitSystem()); //TODO This AGAIN defines the default
.orElse(defaultUnitSystem);
}

public static void setUnit(UnitSystem unitSystem) {
Expand Down

0 comments on commit f8dd637

Please sign in to comment.