color change
This commit is contained in:
@@ -113,6 +113,10 @@ public enum Data {
|
|||||||
this.totalTime = prefs.getLong("timeWalked", 0);
|
this.totalTime = prefs.getLong("timeWalked", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVisited(Location location) {
|
||||||
|
return this.visitedNames.contains(location.getName());
|
||||||
|
}
|
||||||
|
|
||||||
public android.location.Location getLocation() {
|
public android.location.Location getLocation() {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,13 +261,17 @@ public class HomeFragment extends Fragment implements LocationListener {
|
|||||||
initializer.removeGeoFences();
|
initializer.removeGeoFences();
|
||||||
final ArrayList<OverlayItem> items = new ArrayList<>(locations.size());
|
final ArrayList<OverlayItem> items = new ArrayList<>(locations.size());
|
||||||
// marker icon
|
// marker icon
|
||||||
Drawable marker = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24);
|
|
||||||
marker.setAlpha(255);
|
|
||||||
marker.setTint(getResources().getColor(R.color.secondaryColour));
|
|
||||||
|
|
||||||
// add all locations to the overlay itemss
|
// add all locations to the overlay itemss
|
||||||
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 = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24);
|
||||||
|
marker.setAlpha(255);
|
||||||
|
if (location.isVisited() && Data.INSTANCE.isVisited(location)) {
|
||||||
|
marker.setTint(getResources().getColor(R.color.red));
|
||||||
|
} else {
|
||||||
|
marker.setTint(getResources().getColor(R.color.secondaryColour));
|
||||||
|
}
|
||||||
item.setMarker(marker);
|
item.setMarker(marker);
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
@@ -313,6 +317,7 @@ public class HomeFragment extends Fragment implements LocationListener {
|
|||||||
mapView.getOverlays().add(allLocationsOverlay);
|
mapView.getOverlays().add(allLocationsOverlay);
|
||||||
Log.d(TAG, "addLocations: successfully added locations");
|
Log.d(TAG, "addLocations: successfully added locations");
|
||||||
|
|
||||||
|
mapView.invalidate();
|
||||||
addGeofences(locations);
|
addGeofences(locations);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -397,7 +402,6 @@ public class HomeFragment extends Fragment implements LocationListener {
|
|||||||
public void onLocationVisited(com.a1.nextlocation.data.Location location) {
|
public void onLocationVisited(com.a1.nextlocation.data.Location location) {
|
||||||
Data.INSTANCE.visitLocation(location);
|
Data.INSTANCE.visitLocation(location);
|
||||||
showNotification(location);
|
showNotification(location);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNotification(com.a1.nextlocation.data.Location location) {
|
private void showNotification(com.a1.nextlocation.data.Location location) {
|
||||||
|
|||||||
Reference in New Issue
Block a user