fix hide zero total distance

This commit is contained in:
Skalii 2021-01-27 14:49:11 +02:00
parent 10ae234c30
commit db99e06088

View file

@ -123,9 +123,15 @@ public class OverviewCard extends BaseCard {
Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()), Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()),
R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null, ITEM_TIME); R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null, ITEM_TIME);
final StatBlockAdapter sbAdapter = new StatBlockAdapter(items); if (Algorithms.isEmpty(items)) {
rvOverview.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false)); AndroidUiHelper.updateVisibility(rvOverview, false);
rvOverview.setAdapter(sbAdapter); } else {
final StatBlockAdapter sbAdapter = new StatBlockAdapter(items);
rvOverview.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false));
rvOverview.setAdapter(sbAdapter);
}
} else {
AndroidUiHelper.updateVisibility(rvOverview, false);
} }
} }
@ -252,9 +258,7 @@ public class OverviewCard extends BaseCard {
}); });
setImageDrawable(holder.imageView, item.imageResId, item.imageColorId); setImageDrawable(holder.imageView, item.imageResId, item.imageColorId);
AndroidUtils.setBackgroundColor(view.getContext(), holder.divider, nightMode, R.color.divider_color_light, R.color.divider_color_dark); AndroidUtils.setBackgroundColor(view.getContext(), holder.divider, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
if (position == statBlocks.size() - 1) { AndroidUiHelper.updateVisibility(holder.divider, position != statBlocks.size() - 1);
AndroidUiHelper.setVisibility(View.GONE, holder.divider);
}
} }
} }
@ -301,7 +305,9 @@ public class OverviewCard extends BaseCard {
StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType); StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType);
switch (statBlock.itemType) { switch (statBlock.itemType) {
case ITEM_DISTANCE: { case ITEM_DISTANCE: {
listItems.add(statBlock); if (analysis.totalDistance != 0f) {
listItems.add(statBlock);
}
break; break;
} }
case ITEM_ALTITUDE: { case ITEM_ALTITUDE: {