Cleanup: use Java17 switch statements.

AndroidStudio code cleanup.
This commit is contained in:
Dennis Guse
2023-04-13 14:52:20 +02:00
parent 3a8e547e10
commit efddb31391
30 changed files with 355 additions and 640 deletions
@@ -733,16 +733,11 @@ public class ChartView extends View {
private String getXAxisLabel() {
Context context = getContext();
if (chartByDistance) {
switch (unitSystem) {
case METRIC:
return context.getString(R.string.unit_kilometer);
case IMPERIAL:
return context.getString(R.string.unit_mile);
case NAUTICAL_IMPERIAL:
return context.getString(R.string.unit_nautical_mile);
default:
throw new RuntimeException("Not implemented");
}
return switch (unitSystem) {
case METRIC -> context.getString(R.string.unit_kilometer);
case IMPERIAL -> context.getString(R.string.unit_mile);
case NAUTICAL_IMPERIAL -> context.getString(R.string.unit_nautical_mile);
};
} else {
return context.getString(R.string.description_time);
}