Added intervals in StatisticsRecordedFragment with distance, speed and pace for all activity types.

Users can select the length of the interval (in a spinner with several options).
The intervals will be in km or mi depending on settings.
This commit is contained in:
Román
2020-08-10 19:16:23 +02:00
committed by Román Martínez
parent 19e35a7609
commit 7a923a947e
10 changed files with 482 additions and 1 deletions
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/StatsSmallLabel"
android:text="@string/stats_intervals" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stats_split_interval"
style="@style/TextMedium" />
<Spinner
android:id="@+id/spinner_intervals"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/SpinnerCustom"/>
<TextView
android:id="@+id/spinner_intervals_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/unit_kilometer"
style="@style/TextMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp">
<TextView
android:id="@+id/interval_distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextMedium"
android:layout_margin="1dp"
android:textAlignment="center"
android:layout_gravity="center"
android:text="@string/stats_distance" />
<TextView
android:id="@+id/interval_speed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextMedium"
android:layout_margin="1dp"
android:textAlignment="center"
android:layout_gravity="center"
android:text="@string/stats_speed" />
<TextView
android:id="@+id/interval_pace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextMedium"
android:layout_margin="1dp"
android:textAlignment="center"
android:layout_gravity="center"
android:text="@string/stats_pace" />
</LinearLayout>
<LinearLayout
android:id="@+id/interval_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</LinearLayout>
@@ -0,0 +1,39 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp">
<TextView
android:id="@+id/interval_item_distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextMedium"
tools:text="1 km" />
<TextView
android:id="@+id/interval_item_speed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextMedium"
tools:text="15 km/h" />
<TextView
android:id="@+id/interval_item_pace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextMedium"
tools:text="4:00" />
</LinearLayout>
</LinearLayout>
@@ -219,5 +219,15 @@
app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/stats_max_speed_value" />
<LinearLayout
android:id="@+id/linear_layout_extra"
android:orientation="vertical"
android:layout_marginBottom="16dp"
app:layout_constraintLeft_toRightOf="@+id/guideline"
app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/stats_speed_horizontal_end_line"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
+2
View File
@@ -417,6 +417,8 @@ limitations under the License.
<string name="stats_speed">Speed</string>
<string name="stats_distance">Distance</string>
<string name="stats_total_time">Total time</string>
<string name="stats_intervals">Intervals</string>
<string name="stats_split_interval">Split interval</string>
<!-- Track -->
<string name="track_name_format">Track %1$d</string>
<string name="track_record_notification">Recording your track&#8230;</string>