Orange color for POIs that are closed in 30 minutes from now

This commit is contained in:
Valerii Pekarskyi 2015-05-13 12:52:47 +03:00
parent 08ea1c2bdc
commit 6004729832
2 changed files with 9 additions and 3 deletions

View file

@ -109,6 +109,8 @@
<color name="color_unknown">#C8C8C8</color> <color name="color_unknown">#C8C8C8</color>
<!-- good state, localindex loaded, poi_open, osm_create, index_ok --> <!-- good state, localindex loaded, poi_open, osm_create, index_ok -->
<color name="color_ok">#32CD32</color> <color name="color_ok">#32CD32</color>
<!-- intermediate state - poi is going to be closed -->
<color name="color_intermediate">#FFDD00</color>
<!-- update good state, osm_modify, index_update --> <!-- update good state, osm_modify, index_update -->
<color name="color_update">#0080FF</color> <color name="color_update">#0080FF</color>

View file

@ -744,11 +744,15 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
if (rs != null) { if (rs != null) {
Calendar inst = Calendar.getInstance(); Calendar inst = Calendar.getInstance();
inst.setTimeInMillis(System.currentTimeMillis()); inst.setTimeInMillis(System.currentTimeMillis());
boolean work = rs.isOpenedForTime(inst); boolean worksNow = rs.isOpenedForTime(inst);
inst.setTimeInMillis(System.currentTimeMillis() + 30 * 60 * 1000); // 30 minutes later
boolean worksLater = rs.isOpenedForTime(inst);
int colorId = worksNow ? worksLater ? color.color_ok : color.color_intermediate : color.color_warning;
timeIcon.setVisibility(View.VISIBLE); timeIcon.setVisibility(View.VISIBLE);
timeText.setVisibility(View.VISIBLE); timeText.setVisibility(View.VISIBLE);
timeIcon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_small_time, work ? R.color.color_ok : R.color.color_warning)); timeIcon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_small_time, colorId));
timeText.setTextColor(app.getResources().getColor(work ? R.color.color_ok : R.color.color_warning)); timeText.setTextColor(app.getResources().getColor(colorId));
String rt = rs.getCurrentRuleTime(inst); String rt = rs.getCurrentRuleTime(inst);
timeText.setText(rt == null ? "" : rt); timeText.setText(rt == null ? "" : rt);
} else { } else {