diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/RunAndChairStatActivity.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/RunAndChairStatActivity.java index c433f3a75..8791c18ff 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/RunAndChairStatActivity.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/RunAndChairStatActivity.java @@ -14,18 +14,25 @@ import de.dennisguse.opentracks.R; import de.dennisguse.opentracks.databinding.ActivityRunAndChairStatBinding; +import de.dennisguse.opentracks.databinding.FragmentRunsStatBinding; public class RunAndChairStatActivity extends AppCompatActivity { ActivityRunAndChairStatBinding binding; + FragmentRunsStatBinding fragmentRunsStatBinding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActivityRunAndChairStatBinding.inflate(getLayoutInflater()); + fragmentRunsStatBinding = FragmentRunsStatBinding.inflate(getLayoutInflater()); EdgeToEdge.enable(this); setContentView(binding.getRoot()); + + replaceFragment(new RunsStatFragment()); + + binding.bottomNavigationViewSeasons.setOnItemSelectedListener(item -> { if (item.getItemId() == R.id.runs_frag) { replaceFragment(new RunsStatFragment()); @@ -47,17 +54,17 @@ private void replaceFragment(Fragment fragment){ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if (fragment instanceof RunsStatFragment) { Intent intent = this.getIntent(); - String seasonName = "123"; - String days = "123"; - String runs = "123"; - String resort = "123"; - String vertical_m = "123"; - String distance = "123"; - String active= "123"; - String max_Speed="123"; - String max_alt="123"; - String tallestRun="123"; - String longestRun="123"; + String seasonName = "Summer 2024"; + String days = "12"; + String runs = "12"; + String resort = "2"; + String vertical_m = "10024"; + String distance = "231"; + String active= "12"; + String max_Speed="6.3"; + String max_alt="10.45"; + String tallestRun="9.31"; + String longestRun="25"; if (intent != null){ seasonName = intent.getStringExtra("seasonName"); diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/SeasonStatActivity.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/SeasonStatActivity.java index 7f011347f..d5103ed54 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/SeasonStatActivity.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/SeasonStats/SeasonStatActivity.java @@ -14,6 +14,7 @@ import androidx.core.view.WindowInsetsCompat; import java.util.ArrayList; +import java.util.Random; import de.dennisguse.opentracks.R; import de.dennisguse.opentracks.databinding.ActivitySeasonStatBinding; @@ -33,10 +34,38 @@ protected void onCreate(Bundle savedInstanceState) { v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); return insets; }); - String[] seasonNames = {"Season 2020 - 2021", "Season 2021 - 2022", "Season 2022 - 2023", "Season 2023 - 2024"}; + String[] seasonNames = {"2020 - 2021 Season Stats", "2021 - 2022 Season Stats", "2022 - 2023 Season Stats", "2023 - 2024 Season Stats"}; + Random random = new Random(); + + String[] Days = new String[4]; + int[] VerticalM = new int[4]; + int[] Runs = new int[4]; + double[] DistanceKM = new double[4]; + int[] Resort = new int[4]; + String[] Active = new String[4]; + double[] MaxSpeed = new double[4]; + int[] MaxAltitude = new int[4]; + int[] TallestRun = new int[4]; + double[] LongestRun = new double[4]; + ArrayList seasonArrayList = new ArrayList<>(); - for (int i = 0; i < seasonNames.length ; i++){ - seasonArrayList.add(new DummySeason(seasonNames[i],i,i,i,i,i,"10:10:10", i,i,i,i)); + for (int i = 0; i < 4; i++) { + Days[i] = Integer.toString(random.nextInt(1001)); + VerticalM[i] = random.nextInt(1000); + Runs[i] = random.nextInt(20); + DistanceKM[i] = random.nextDouble() * 20; + Resort[i] = random.nextInt(10) + 1; + int hours = random.nextInt(24); + int minutes = random.nextInt(60); + int seconds = random.nextInt(60); + String activeTime = String.format("%02d:%02d:%02d", hours, minutes, seconds); + Active[i] = activeTime; + MaxSpeed[i] = random.nextDouble() * 100; + TallestRun[i] = (int) (random.nextDouble() * 100); + MaxAltitude[i] = (int) (random.nextDouble() * 5000); + LongestRun[i] = random.nextDouble() * 10; + + seasonArrayList.add(new DummySeason(seasonNames[i], Integer.parseInt(Days[i]), Runs[i], Resort[i], VerticalM[i], DistanceKM[i], Active[i], MaxSpeed[i], MaxAltitude[i], TallestRun[i], LongestRun[i])); } SeasonListAdapter listAdapter = new SeasonListAdapter(SeasonStatActivity.this, seasonArrayList); diff --git a/src/main/res/layout/fragment_runs_stat.xml b/src/main/res/layout/fragment_runs_stat.xml index 5b301ea86..e1a98982e 100644 --- a/src/main/res/layout/fragment_runs_stat.xml +++ b/src/main/res/layout/fragment_runs_stat.xml @@ -16,8 +16,11 @@ android:layout_height="wrap_content" android:gravity="center" android:text="Season Name" - android:textSize="30dp" + android:textSize="24dp" android:textStyle="bold" + android:background="#0047AB" + android:textColor="#FFFFFF" + android:padding="6dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -29,6 +32,7 @@ android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Season Totals" + android:layout_marginStart="20dp" android:textSize="18dp" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" @@ -83,7 +87,7 @@ android:id="@+id/textView12" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Vertical M" + android:text="Vertical m" android:layout_marginTop="-10dp" android:textSize="15dp" android:textStyle="bold" @@ -148,7 +152,7 @@ android:id="@+id/textView22" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Distance Km" + android:text="Distance KM" android:layout_marginTop="-10dp" android:textSize="15dp" android:textStyle="bold" @@ -237,6 +241,7 @@ android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Season Bests" + android:layout_marginStart="20dp" android:textSize="18dp" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" @@ -264,7 +269,7 @@ android:id="@+id/textView111" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Max Km/h" + android:text="Max KM/H" android:layout_marginTop="-10dp" android:textSize="15dp" android:textStyle="bold" @@ -291,7 +296,7 @@ android:id="@+id/textView112" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Tallest Run M" + android:text="Tallest Run m" android:layout_marginTop="-10dp" android:textSize="15dp" android:textStyle="bold" @@ -329,7 +334,7 @@ android:id="@+id/textView121" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Max Altitude M" + android:text="Max Altitude m" android:layout_marginTop="-10dp" android:textSize="15dp" android:textStyle="bold" @@ -356,7 +361,7 @@ android:id="@+id/textView122" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Distance Km" + android:text="Longest run KM" android:layout_marginTop="-10dp" android:textSize="15dp" android:textStyle="bold" @@ -374,6 +379,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +