Merge pull request #11013 from osmandapp/fix_night_mode_in_road_info
Fix text color in night mode for road info
This commit is contained in:
commit
07c371f472
2 changed files with 7 additions and 13 deletions
|
@ -22,10 +22,10 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.helpers.CustomBarChartRenderer;
|
||||
import net.osmand.router.RouteStatisticsHelper;
|
||||
import net.osmand.router.RouteStatisticsHelper.RouteStatistics;
|
||||
import net.osmand.router.RouteStatisticsHelper.RouteSegmentAttribute;
|
||||
import net.osmand.router.RouteStatisticsHelper.RouteStatistics;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -140,7 +140,7 @@ public class CustomGraphAdapter extends BaseGraphAdapter<HorizontalBarChart, Bar
|
|||
private void attachLegend(List<RouteSegmentAttribute> list,
|
||||
String propertyNameToFullSpan) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
LayoutInflater inflater = LayoutInflater.from(app);
|
||||
LayoutInflater inflater = UiUtilities.getInflater(app, isNightMode());
|
||||
for (RouteSegmentAttribute segment : list) {
|
||||
View view = inflater.inflate(R.layout.route_details_legend, legendContainer, false);
|
||||
int segmentColor = segment.getColor();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue