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,10 +123,16 @@ 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);
if (Algorithms.isEmpty(items)) {
AndroidUiHelper.updateVisibility(rvOverview, false);
} else {
final StatBlockAdapter sbAdapter = new StatBlockAdapter(items); final StatBlockAdapter sbAdapter = new StatBlockAdapter(items);
rvOverview.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false)); rvOverview.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false));
rvOverview.setAdapter(sbAdapter); rvOverview.setAdapter(sbAdapter);
} }
} else {
AndroidUiHelper.updateVisibility(rvOverview, false);
}
} }
@DrawableRes @DrawableRes
@ -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: {
if (analysis.totalDistance != 0f) {
listItems.add(statBlock); listItems.add(statBlock);
}
break; break;
} }
case ITEM_ALTITUDE: { case ITEM_ALTITUDE: {