added visited locations in route
This commit is contained in:
@@ -112,4 +112,13 @@ public class Route implements Parcelable {
|
|||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLocationVisited(Location location) {
|
||||||
|
for (Location l : this.locations) {
|
||||||
|
if (l.getName().equals(location.getName())) {
|
||||||
|
l.setVisited(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ public enum RouteHandler {
|
|||||||
Data.INSTANCE.addTimeWalked(System.currentTimeMillis() - startedTime);
|
Data.INSTANCE.addTimeWalked(System.currentTimeMillis() - startedTime);
|
||||||
}
|
}
|
||||||
this.currentRoute = route;
|
this.currentRoute = route;
|
||||||
|
|
||||||
|
// sync the visited locations with the route
|
||||||
|
for (Location l : this.currentRoute.getLocations()) {
|
||||||
|
if (Data.INSTANCE.isVisited(l)) {
|
||||||
|
this.currentRoute.setLocationVisited(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setFollowingRoute(true);
|
setFollowingRoute(true);
|
||||||
startedTime = System.currentTimeMillis();
|
startedTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ public class HomeFragment extends Fragment implements LocationListener {
|
|||||||
for (com.a1.nextlocation.data.Location location : locations) {
|
for (com.a1.nextlocation.data.Location location : locations) {
|
||||||
OverlayItem item = new OverlayItem(location.getName(), location.getDescription(), location.convertToGeoPoint());
|
OverlayItem item = new OverlayItem(location.getName(), location.getDescription(), location.convertToGeoPoint());
|
||||||
Drawable marker = null;
|
Drawable marker = null;
|
||||||
if (location.isVisited() && Data.INSTANCE.isVisited(location)) {
|
if (location.isVisited()) {
|
||||||
Log.d(TAG, "addLocations: location " + location.getName() + " is visited");
|
Log.d(TAG, "addLocations: location " + location.getName() + " is visited");
|
||||||
marker = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24);
|
marker = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24);
|
||||||
marker.setAlpha(255);
|
marker.setAlpha(255);
|
||||||
|
|||||||
Reference in New Issue
Block a user