stuffff
This commit is contained in:
@@ -209,6 +209,7 @@ public class HomeFragment extends Fragment implements LocationListener {
|
||||
private void displayRoute() {
|
||||
|
||||
if (RouteHandler.INSTANCE.isFollowingRoute()) {
|
||||
Log.d(TAG, "displayRoute: WE ARE FOLLOWING A ROUTE");
|
||||
if (roadOverlay == null) {
|
||||
if (RouteHandler.INSTANCE.getCurrentRouteLine() != null) {
|
||||
roadOverlay = RouteHandler.INSTANCE.getCurrentRouteLine();
|
||||
@@ -318,10 +319,12 @@ public class HomeFragment extends Fragment implements LocationListener {
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
// calculate the distance walked
|
||||
|
||||
double distance = currentLocation.distanceTo(location); // in meters
|
||||
// can't walk 100 meters in a few seconds
|
||||
if (distance < 100)
|
||||
StaticData.INSTANCE.addDistance(distance);
|
||||
if (currentLocation != null) {
|
||||
double distance = currentLocation.distanceTo(location); // in meters
|
||||
// can't walk 100 meters in a few seconds
|
||||
if (distance < 100)
|
||||
StaticData.INSTANCE.addDistance(distance);
|
||||
}
|
||||
currentLocation = location;
|
||||
|
||||
|
||||
|
||||
@@ -40,9 +40,11 @@ public class StatisticFragment extends Fragment {
|
||||
|
||||
TextView distance = view.findViewById(R.id.statistics_km);
|
||||
TextView locs = view.findViewById(R.id.statistics_locations_visited);
|
||||
TextView timeText = view.findViewById(R.id.statistics_time_value);
|
||||
double dist = StaticData.INSTANCE.getDistanceTraveled()/1000;
|
||||
distance.setText("" + String.format("%.1f",dist) + " km");
|
||||
locs.setText("" + StaticData.INSTANCE.getLocationsVisited());
|
||||
timeText.setText("" + StaticData.INSTANCE.getTimeWalkedRoute());
|
||||
|
||||
|
||||
this.couponList = CouponListManager.INSTANCE.getCouponList();
|
||||
|
||||
Reference in New Issue
Block a user