From 8169e8c680932c6dc6d4004b15dffb873c6da79b Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Thu, 7 Jan 2021 11:35:44 +0100 Subject: [PATCH 1/2] added back diff line --- .../java/com/a1/nextlocation/fragments/StatisticFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java index a7d77b4..7dd5499 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java @@ -36,6 +36,7 @@ public class StatisticFragment extends Fragment { initializeDistanceTextView(view); TextView locs = view.findViewById(R.id.statistics_locations_visited); TextView timeText = view.findViewById(R.id.statistics_time_value); + TextView distance = view.findViewById(R.id.statistics_km); double dist = Data.INSTANCE.getDistanceTraveled() / 1000; distance.setText("" + String.format("%.1f", dist) + " km"); -- 2.47.2 From 38dbbfc534a4b5cb60e73c8bd78d4983933f3e20 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Thu, 7 Jan 2021 11:43:40 +0100 Subject: [PATCH 2/2] fiiiix --- .../a1/nextlocation/fragments/RouteDetailFragment.java | 4 ++-- .../com/a1/nextlocation/fragments/StatisticFragment.java | 8 +++----- app/src/main/res/values/themes.xml | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java index ad56ed0..921329a 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java @@ -66,7 +66,7 @@ public class RouteDetailFragment extends Fragment { TextView totalDistance = view.findViewById(R.id.total_distance); String distance_tekst = getResources().getString(R.string.total_distance_route); boolean imperialChecked = getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).getBoolean("imperialSwitch", false); - totalDistance.setText(distance_tekst + " " + String.format("%.1f", calculateRoute(this.route.getLocations())) + (imperialChecked ? "ft" : "m")); + totalDistance.setText(distance_tekst + " " + String.format("%.1f", calculateRoute(this.route.getLocations())) + (imperialChecked ? "yd" : "m")); //Initialises the back button ImageButton backButton = view.findViewById(R.id.route_detail_back_button); @@ -118,7 +118,7 @@ public class RouteDetailFragment extends Fragment { // if the imperialSwitch is checked, return feet, if not, return meters if (getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).getBoolean("imperialSwitch", false)) - return totalDistance *3.28084; + return totalDistance * 1.0936133; else return totalDistance; } diff --git a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java index 7dd5499..e8ab15f 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java @@ -22,6 +22,7 @@ import com.a1.nextlocation.recyclerview.CouponListManager; import java.util.List; public class StatisticFragment extends Fragment { + private TextView distance; @Override public void onCreate(Bundle savedInstanceState) { @@ -36,10 +37,7 @@ public class StatisticFragment extends Fragment { initializeDistanceTextView(view); TextView locs = view.findViewById(R.id.statistics_locations_visited); TextView timeText = view.findViewById(R.id.statistics_time_value); - TextView distance = view.findViewById(R.id.statistics_km); - - double dist = Data.INSTANCE.getDistanceTraveled() / 1000; - distance.setText("" + String.format("%.1f", dist) + " km"); + locs.setText("" + Data.INSTANCE.getLocationsVisited()); long seconds = Data.INSTANCE.getTotalTime() / 1000; @@ -80,7 +78,7 @@ public class StatisticFragment extends Fragment { } private void initializeDistanceTextView(View view){ - TextView distance = view.findViewById(R.id.statistics_km); + distance = view.findViewById(R.id.statistics_km); double dist = Data.INSTANCE.getDistanceTraveled()/1000; if (getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).getBoolean("imperialSwitch", false)) distance.setText("" + String.format("%.1f",dist * 0.621371) + " mi"); diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index c416de6..1e892a3 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -7,6 +7,7 @@ @color/secondaryColour @color/buttonColour + @color/secondaryColour 16sp @@ -17,6 +18,7 @@ @color/secondaryColour @color/buttonColour + @color/secondaryColour 24sp \ No newline at end of file -- 2.47.2