fix legend text for night mode;

fix duration time for route statistic
This commit is contained in:
Skalii 2021-02-26 01:38:45 +02:00
parent 428327c2cd
commit bb6099d41a
2 changed files with 5 additions and 10 deletions

View file

@ -158,6 +158,7 @@ public class CustomGraphAdapter extends BaseGraphAdapter<HorizontalBarChart, Bar
Spannable text = getSpanLegend(name, segment, selected);
TextView legend = (TextView) view.findViewById(R.id.legend_text);
legend.setText(text);
AndroidUtils.setTextPrimaryColor(app, legend, isNightMode());
legendContainer.addView(view);
}

View file

@ -79,24 +79,18 @@ public class RouteStatisticCard extends BaseCard {
((ImageView) view.findViewById(R.id.time_icon)).setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_time_span));
int dist = routingHelper.getLeftDistance();
int time = routingHelper.getLeftTime();
int hours = time / (60 * 60);
int minutes = (time / 60) % 60;
TextView distanceTv = (TextView) view.findViewById(R.id.distance);
String text = OsmAndFormatter.getFormattedDistance(dist, app);
SpannableStringBuilder distanceStr = new SpannableStringBuilder(text);
int spaceIndex = text.indexOf(" ");
if (spaceIndex != -1) {
distanceStr.setSpan(new ForegroundColorSpan(getMainFontColor()), 0, spaceIndex, 0);
}
TextView distanceTv = (TextView) view.findViewById(R.id.distance);
distanceTv.setText(distanceStr);
int time = routingHelper.getLeftTime();
SpannableStringBuilder timeStr = new SpannableStringBuilder();
if (hours > 0) {
timeStr.append(String.valueOf(hours)).append(" ").append(app.getString(R.string.osmand_parking_hour)).append(" ");
}
if (minutes > 0) {
timeStr.append(String.valueOf(minutes)).append(" ").append(app.getString(R.string.osmand_parking_minute));
}
timeStr.append(OsmAndFormatter.getFormattedDuration(time, app));
spaceIndex = timeStr.toString().lastIndexOf(" ");
if (spaceIndex != -1) {
timeStr.setSpan(new ForegroundColorSpan(getMainFontColor()), 0, spaceIndex, 0);