Cleanup: use ActivityType instead of passing it's id around as String.

Part of #1608.
This commit is contained in:
Dennis Guse
2023-06-24 19:30:00 +02:00
parent 779681088c
commit 425ea0f216
34 changed files with 162 additions and 171 deletions
@@ -33,7 +33,7 @@ public class AggregatedStatistics {
@VisibleForTesting
public void aggregate(@NonNull Track track) {
String activityType = track.getActivityType();
String activityType = track.getActivityTypeLocalized();
if (dataMap.containsKey(activityType)) {
dataMap.get(activityType).add(track.getTrackStatistics());
} else {
@@ -184,8 +184,8 @@ public class AggregatedStatisticsAdapter extends BaseAdapter {
private int getIcon(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) {
String localizedActivityType = aggregatedStatistic.getActivityType();
String iconValue = ActivityType.findByLocalizedString(context, localizedActivityType)
.getId();
return ActivityType.findByActivityTypeId(iconValue)
.getIconId();
return ActivityType.findBy(iconValue)
.getIconDrawableId();
}
}
@@ -151,7 +151,7 @@ public class IntervalsFragment extends Fragment {
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(getContext());
Track track = contentProviderUtils.getTrack(trackId);
if (track != null) {
isReportSpeed = PreferencesUtils.isReportSpeed(track.getActivityType());
isReportSpeed = PreferencesUtils.isReportSpeed(track.getActivityTypeLocalized());
}
viewModel = new ViewModelProvider(getActivity()).get(IntervalStatisticsModel.class);