mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-20 01:13:06 +02:00
add landscape view for stats page
This commit is contained in:
@@ -0,0 +1,144 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2013 Google Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<!-- Distance, calorie, total time, and moving time -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_distance"
|
||||||
|
layout="@layout/stats_large_item" />
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_calorie"
|
||||||
|
layout="@layout/stats_large_item" />
|
||||||
|
<View
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_total_time"
|
||||||
|
layout="@layout/stats_large_item" />
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_moving_time"
|
||||||
|
layout="@layout/stats_large_item" />
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Horizontal line -->
|
||||||
|
<View style="@style/StatsHorizontalLine" />
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
|
<TableLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="0dp" >
|
||||||
|
<!-- Speed and average speed -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_speed"
|
||||||
|
layout="@layout/stats_small_item" />
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_average_speed"
|
||||||
|
layout="@layout/stats_small_item" />
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Max speed and average moving speed -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_max_speed"
|
||||||
|
layout="@layout/stats_small_item" />
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_average_moving_speed"
|
||||||
|
layout="@layout/stats_small_item" />
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Latitude and longitude -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/stats_coordinate_container"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_latitude"
|
||||||
|
layout="@layout/stats_small_item" />
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_longitude"
|
||||||
|
layout="@layout/stats_small_item" />
|
||||||
|
</LinearLayout>
|
||||||
|
</TableLayout>
|
||||||
|
<!-- Vertical line -->
|
||||||
|
<View
|
||||||
|
android:background="@color/stats_separator"
|
||||||
|
android:id="@+id/stats_grade_elevation_separator"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="1dp" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/stats_grade_elevation_container"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="0dp" >
|
||||||
|
<!-- Grade -->
|
||||||
|
<LinearLayout style="@style/StatsSmallGroupContainer" >
|
||||||
|
<!-- Grade label -->
|
||||||
|
<TextView
|
||||||
|
android:text="@string/stats_grade"
|
||||||
|
style="@style/StatsSmallLabel" />
|
||||||
|
<TableLayout
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content" >
|
||||||
|
<!-- Grade min -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_grade_min"
|
||||||
|
layout="@layout/stats_small_group_item" />
|
||||||
|
<!-- Grade max -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_grade_max"
|
||||||
|
layout="@layout/stats_small_group_item" />
|
||||||
|
</TableLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Elevation -->
|
||||||
|
<LinearLayout style="@style/StatsSmallGroupContainer" >
|
||||||
|
<!-- Elevation label -->
|
||||||
|
<TextView
|
||||||
|
android:text="@string/stats_elevation"
|
||||||
|
style="@style/StatsSmallLabel" />
|
||||||
|
<TableLayout
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content" >
|
||||||
|
<!-- Elevation -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_elevation"
|
||||||
|
layout="@layout/stats_small_group_item" />
|
||||||
|
<!-- Elevation gain -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_elevation_gain"
|
||||||
|
layout="@layout/stats_small_group_item" />
|
||||||
|
<!-- Elevation min -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_elevation_min"
|
||||||
|
layout="@layout/stats_small_group_item" />
|
||||||
|
<!-- Elevation max -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/stats_elevation_max"
|
||||||
|
layout="@layout/stats_small_group_item" />
|
||||||
|
</TableLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</merge>
|
||||||
@@ -19,9 +19,7 @@ limitations under the License.
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingRight="8dp" >
|
|
||||||
<include layout="@layout/stats_content" />
|
<include layout="@layout/stats_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -15,67 +15,62 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<!-- Row 1: distance and calorie -->
|
<!-- Distance and calorie -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent" >
|
android:layout_width="match_parent" >
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_distance"
|
android:id="@+id/stats_distance"
|
||||||
layout="@layout/stats_large_item" />
|
layout="@layout/stats_large_item" />
|
||||||
<View style="@style/StatsVerticalSpacer" />
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_calorie"
|
android:id="@+id/stats_calorie"
|
||||||
layout="@layout/stats_large_item" />
|
layout="@layout/stats_large_item" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- Row 2: total time and moving time -->
|
<!-- Total time and moving time -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent" >
|
android:layout_width="match_parent" >
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_total_time"
|
android:id="@+id/stats_total_time"
|
||||||
layout="@layout/stats_large_item" />
|
layout="@layout/stats_large_item" />
|
||||||
<View style="@style/StatsVerticalSpacer" />
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_moving_time"
|
android:id="@+id/stats_moving_time"
|
||||||
layout="@layout/stats_large_item" />
|
layout="@layout/stats_large_item" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- Row 3: horizontal line -->
|
<!-- Horizontal line -->
|
||||||
<View style="@style/StatsHorizontalLine" />
|
<View style="@style/StatsHorizontalLine" />
|
||||||
<!-- Row 3: speed and average speed -->
|
<!-- Speed and average speed -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent" >
|
android:layout_width="match_parent" >
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_speed"
|
android:id="@+id/stats_speed"
|
||||||
layout="@layout/stats_small_item" />
|
layout="@layout/stats_small_item" />
|
||||||
<View style="@style/StatsVerticalSpacer" />
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_average_speed"
|
android:id="@+id/stats_average_speed"
|
||||||
layout="@layout/stats_small_item" />
|
layout="@layout/stats_small_item" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- Row 4: max speed and average moving speed -->
|
<!-- Max speed and average moving speed -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent" >
|
android:layout_width="match_parent" >
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_max_speed"
|
android:id="@+id/stats_max_speed"
|
||||||
layout="@layout/stats_small_item" />
|
layout="@layout/stats_small_item" />
|
||||||
<View style="@style/StatsVerticalSpacer" />
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_average_moving_speed"
|
android:id="@+id/stats_average_moving_speed"
|
||||||
layout="@layout/stats_small_item" />
|
layout="@layout/stats_small_item" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- Row 5: horizontal line -->
|
<!-- Horizontal line -->
|
||||||
<View
|
<View
|
||||||
android:id="@+id/stats_grade_elevation_horizontal_line"
|
android:id="@+id/stats_grade_elevation_separator"
|
||||||
style="@style/StatsHorizontalLine" />
|
style="@style/StatsHorizontalLine" />
|
||||||
<!-- Row 5: grade and elevation -->
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/stats_grade_elevation_container"
|
android:id="@+id/stats_grade_elevation_container"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent" >
|
android:layout_width="match_parent" >
|
||||||
<!-- Grade -->
|
<!-- Grade -->
|
||||||
<LinearLayout style="@style/StatsSmallItemContainer" >
|
<LinearLayout style="@style/StatsSmallGroupContainer" >
|
||||||
<!-- Grade label -->
|
<!-- Grade label -->
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_grade"
|
android:text="@string/stats_grade"
|
||||||
@@ -87,16 +82,15 @@ limitations under the License.
|
|||||||
<!-- Grade min -->
|
<!-- Grade min -->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_grade_min"
|
android:id="@+id/stats_grade_min"
|
||||||
layout="@layout/stats_small_item_1line" />
|
layout="@layout/stats_small_group_item" />
|
||||||
<!-- Grade max -->
|
<!-- Grade max -->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_grade_max"
|
android:id="@+id/stats_grade_max"
|
||||||
layout="@layout/stats_small_item_1line" />
|
layout="@layout/stats_small_group_item" />
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<View style="@style/StatsVerticalSpacer" />
|
|
||||||
<!-- Elevation -->
|
<!-- Elevation -->
|
||||||
<LinearLayout style="@style/StatsSmallItemContainer" >
|
<LinearLayout style="@style/StatsSmallGroupContainer" >
|
||||||
<!-- Elevation label -->
|
<!-- Elevation label -->
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_elevation"
|
android:text="@string/stats_elevation"
|
||||||
@@ -108,27 +102,27 @@ limitations under the License.
|
|||||||
<!-- Elevation -->
|
<!-- Elevation -->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_elevation"
|
android:id="@+id/stats_elevation"
|
||||||
layout="@layout/stats_small_item_1line" />
|
layout="@layout/stats_small_group_item" />
|
||||||
<!-- Elevation gain -->
|
<!-- Elevation gain -->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_elevation_gain"
|
android:id="@+id/stats_elevation_gain"
|
||||||
layout="@layout/stats_small_item_1line" />
|
layout="@layout/stats_small_group_item" />
|
||||||
<!-- Elevation min -->
|
<!-- Elevation min -->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_elevation_min"
|
android:id="@+id/stats_elevation_min"
|
||||||
layout="@layout/stats_small_item_1line" />
|
layout="@layout/stats_small_group_item" />
|
||||||
<!-- Elevation max -->
|
<!-- Elevation max -->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_elevation_max"
|
android:id="@+id/stats_elevation_max"
|
||||||
layout="@layout/stats_small_item_1line" />
|
layout="@layout/stats_small_group_item" />
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- Row 6: horizontal line -->
|
<!-- Horizontal line -->
|
||||||
<View
|
<View
|
||||||
android:id="@+id/stats_coordinate_horizontal_line"
|
android:id="@+id/stats_coordinate_separator"
|
||||||
style="@style/StatsHorizontalLine" />
|
style="@style/StatsHorizontalLine" />
|
||||||
<!-- Row 6: latitude and longitude -->
|
<!-- Latitude and longitude -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/stats_coordinate_container"
|
android:id="@+id/stats_coordinate_container"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -136,7 +130,6 @@ limitations under the License.
|
|||||||
<include
|
<include
|
||||||
android:id="@+id/stats_latitude"
|
android:id="@+id/stats_latitude"
|
||||||
layout="@layout/stats_small_item" />
|
layout="@layout/stats_small_item" />
|
||||||
<View style="@style/StatsVerticalSpacer" />
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/stats_longitude"
|
android:id="@+id/stats_longitude"
|
||||||
layout="@layout/stats_small_item" />
|
layout="@layout/stats_small_item" />
|
||||||
|
|||||||
@@ -18,20 +18,22 @@ limitations under the License.
|
|||||||
<!-- The style for choose activity text -->
|
<!-- The style for choose activity text -->
|
||||||
<style name="StatsSmallLabel" parent="@style/TextSmall">
|
<style name="StatsSmallLabel" parent="@style/TextSmall">
|
||||||
<!-- same as StatsSmallLabel in values/styles.xml except adding textAllCaps -->
|
<!-- same as StatsSmallLabel in values/styles.xml except adding textAllCaps -->
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:singleLine">false</item>
|
<item name="android:singleLine">false</item>
|
||||||
<item name="android:textAllCaps">true</item>
|
<item name="android:textAllCaps">true</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="StatsLargeLabel" parent="@style/TextSmall">
|
<style name="StatsLargeLabel" parent="@style/TextSmall">
|
||||||
<!-- same as StatsLargeLabel in values/styles.xml except adding textAllCaps -->
|
<!-- same as StatsLargeLabel in values/styles.xml except adding textAllCaps -->
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:singleLine">false</item>
|
<item name="android:singleLine">false</item>
|
||||||
<item name="android:textAllCaps">true</item>
|
<item name="android:textAllCaps">true</item>
|
||||||
<item name="android:textColor">@color/stats_large_label</item>
|
<item name="android:textColor">@color/stats_large_label</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="TextChooseActivity">
|
<style name="TextChooseActivity">
|
||||||
<!-- Same as TextChooseActivity in values/styles.xml except removing textSize and using textAppearance -->
|
<!-- Same as TextChooseActivity in values/styles.xml except removing textSize and using textAppearance -->
|
||||||
<item name="android:textAppearance">?android:attr/textAppearanceListItemSmall</item>
|
<item name="android:textAppearance">?android:attr/textAppearanceListItemSmall</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -132,22 +132,23 @@ limitations under the License.
|
|||||||
<style name="StatsHorizontalLine">
|
<style name="StatsHorizontalLine">
|
||||||
<item name="android:background">@color/stats_separator</item>
|
<item name="android:background">@color/stats_separator</item>
|
||||||
<item name="android:layout_height">1dp</item>
|
<item name="android:layout_height">1dp</item>
|
||||||
|
<item name="android:layout_marginLeft">8dp</item>
|
||||||
|
<item name="android:layout_marginRight">8dp</item>
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- stats large item container -->
|
<!-- stats large item container -->
|
||||||
<style name="StatsLargeItemContainer">
|
<style name="StatsLargeItemContainer">
|
||||||
<item name="android:layout_gravity">top</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_weight">10</item>
|
<item name="android:layout_weight">1</item>
|
||||||
<item name="android:layout_width">0dp</item>
|
<item name="android:layout_width">0dp</item>
|
||||||
<item name="android:orientation">vertical</item>
|
<item name="android:orientation">vertical</item>
|
||||||
<item name="android:paddingBottom">6dp</item>
|
<item name="android:paddingBottom">6dp</item>
|
||||||
<item name="android:paddingLeft">8dp</item>
|
|
||||||
<item name="android:paddingRight">8dp</item>
|
|
||||||
<item name="android:paddingTop">6dp</item>
|
<item name="android:paddingTop">6dp</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- stats large label -->
|
<!-- stats large label -->
|
||||||
<style name="StatsLargeLabel" parent="@style/TextSmall">
|
<style name="StatsLargeLabel" parent="@style/TextSmall">
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:singleLine">false</item>
|
<item name="android:singleLine">false</item>
|
||||||
<item name="android:textColor">@color/stats_large_label</item>
|
<item name="android:textColor">@color/stats_large_label</item>
|
||||||
@@ -173,12 +174,18 @@ limitations under the License.
|
|||||||
<style name="StatsScrollView" parent="@style/ScrollView">
|
<style name="StatsScrollView" parent="@style/ScrollView">
|
||||||
<item name="android:scrollbarStyle">outsideOverlay</item>
|
<item name="android:scrollbarStyle">outsideOverlay</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- stats small item container -->
|
<!-- stats small group container -->
|
||||||
|
<style name="StatsSmallGroupContainer" parent="@style/StatsLargeItemContainer">
|
||||||
|
<item name="android:layout_gravity">top|center</item>
|
||||||
|
<item name="android:paddingTop">12dp</item>
|
||||||
|
</style>
|
||||||
|
<!-- stats small item container, for placing inside StatsSmallGroupContainer -->
|
||||||
<style name="StatsSmallItemContainer" parent="@style/StatsLargeItemContainer">
|
<style name="StatsSmallItemContainer" parent="@style/StatsLargeItemContainer">
|
||||||
<item name="android:paddingTop">12dp</item>
|
<item name="android:paddingTop">12dp</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- stats small label -->
|
<!-- stats small label -->
|
||||||
<style name="StatsSmallLabel" parent="@style/TextSmall">
|
<style name="StatsSmallLabel" parent="@style/TextSmall">
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:singleLine">false</item>
|
<item name="android:singleLine">false</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
@@ -199,12 +206,6 @@ limitations under the License.
|
|||||||
<item name="android:paddingTop">4dp</item>
|
<item name="android:paddingTop">4dp</item>
|
||||||
<item name="android:singleLine">true</item>
|
<item name="android:singleLine">true</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- stats vertical spacer -->
|
|
||||||
<style name="StatsVerticalSpacer">
|
|
||||||
<item name="android:layout_height">match_parent</item>
|
|
||||||
<item name="android:layout_weight">1</item>
|
|
||||||
<item name="android:layout_width">0dp</item>
|
|
||||||
</style>
|
|
||||||
<style name="Text">
|
<style name="Text">
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_width">wrap_content</item>
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
|||||||
@@ -81,13 +81,13 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
updateUi(getActivity());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
resumeTrackDataHub();
|
resumeTrackDataHub();
|
||||||
|
updateUi(getActivity());
|
||||||
if (isSelectedTrackRecording()) {
|
if (isSelectedTrackRecording()) {
|
||||||
handler.post(updateTotalTime);
|
handler.post(updateTotalTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,49 +63,47 @@ public class StatsUtils {
|
|||||||
|
|
||||||
// Set speed/pace
|
// Set speed/pace
|
||||||
View speed = getView(activity, view, R.id.stats_speed);
|
View speed = getView(activity, view, R.id.stats_speed);
|
||||||
|
speed.setVisibility(isRecording ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
if (isRecording) {
|
if (isRecording) {
|
||||||
double value = isRecording && location != null && location.hasSpeed() ? location.getSpeed()
|
double value = isRecording && location != null && location.hasSpeed() ? location.getSpeed()
|
||||||
: Double.NaN;
|
: Double.NaN;
|
||||||
speed.setVisibility(View.VISIBLE);
|
|
||||||
setSpeed(context, speed, R.string.stats_speed, R.string.stats_pace, value, metricUnits,
|
setSpeed(context, speed, R.string.stats_speed, R.string.stats_pace, value, metricUnits,
|
||||||
reportSpeed);
|
reportSpeed);
|
||||||
} else {
|
|
||||||
speed.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set elevation
|
// Set elevation
|
||||||
boolean showGradeElevation = PreferencesUtils.getBoolean(context,
|
boolean showGradeElevation = PreferencesUtils.getBoolean(
|
||||||
R.string.stats_show_grade_elevation_key,
|
context, R.string.stats_show_grade_elevation_key,
|
||||||
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT);
|
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT) && isRecording;
|
||||||
View elevation = getView(activity, view, R.id.stats_elevation);
|
View elevation = getView(activity, view, R.id.stats_elevation);
|
||||||
|
elevation.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
if (showGradeElevation && isRecording) {
|
if (showGradeElevation) {
|
||||||
double altitude = location != null && location.hasAltitude() ? location.getAltitude()
|
double altitude = location != null && location.hasAltitude() ? location.getAltitude()
|
||||||
: Double.NaN;
|
: Double.NaN;
|
||||||
elevation.setVisibility(View.VISIBLE);
|
|
||||||
setElevationValue(context, elevation, -1, altitude, metricUnits);
|
setElevationValue(context, elevation, -1, altitude, metricUnits);
|
||||||
} else {
|
|
||||||
elevation.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set coordinate
|
// Set coordinate
|
||||||
boolean showCoordinate = PreferencesUtils.getBoolean(context,
|
boolean showCoordinate = PreferencesUtils.getBoolean(
|
||||||
R.string.stats_show_coordinate_key, PreferencesUtils.STATS_SHOW_COORDINATE_DEFAULT);
|
context, R.string.stats_show_coordinate_key, PreferencesUtils.STATS_SHOW_COORDINATE_DEFAULT)
|
||||||
View coordinateHorizontalLine = getView(activity, view, R.id.stats_coordinate_horizontal_line);
|
&& isRecording;
|
||||||
|
View coordinateSeparator = getView(activity, view, R.id.stats_coordinate_separator);
|
||||||
View coordinateContainer = getView(activity, view, R.id.stats_coordinate_container);
|
View coordinateContainer = getView(activity, view, R.id.stats_coordinate_container);
|
||||||
|
|
||||||
if (showCoordinate && isRecording) {
|
if (coordinateSeparator != null) {
|
||||||
|
coordinateSeparator.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
coordinateContainer.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
if (showCoordinate) {
|
||||||
double latitude = location != null ? location.getLatitude() : Double.NaN;
|
double latitude = location != null ? location.getLatitude() : Double.NaN;
|
||||||
double longitude = location != null ? location.getLongitude() : Double.NaN;
|
double longitude = location != null ? location.getLongitude() : Double.NaN;
|
||||||
coordinateHorizontalLine.setVisibility(View.VISIBLE);
|
|
||||||
coordinateContainer.setVisibility(View.VISIBLE);
|
|
||||||
setCoordinateValue(
|
setCoordinateValue(
|
||||||
context, getView(activity, view, R.id.stats_latitude), R.string.stats_latitude, latitude);
|
context, getView(activity, view, R.id.stats_latitude), R.string.stats_latitude, latitude);
|
||||||
setCoordinateValue(context, getView(activity, view, R.id.stats_longitude),
|
setCoordinateValue(context, getView(activity, view, R.id.stats_longitude),
|
||||||
R.string.stats_longitude, longitude);
|
R.string.stats_longitude, longitude);
|
||||||
} else {
|
|
||||||
coordinateHorizontalLine.setVisibility(View.GONE);
|
|
||||||
coordinateContainer.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,15 +141,15 @@ public class StatsUtils {
|
|||||||
// Set calorie
|
// Set calorie
|
||||||
double calorie = tripStatistics == null ? Double.NaN : tripStatistics.getCalorie();
|
double calorie = tripStatistics == null ? Double.NaN : tripStatistics.getCalorie();
|
||||||
setCalorie(context, getView(activity, view, R.id.stats_calorie), calorie);
|
setCalorie(context, getView(activity, view, R.id.stats_calorie), calorie);
|
||||||
|
|
||||||
// Set total time
|
// Set total time
|
||||||
setTimeValue(context, getView(activity, view, R.id.stats_total_time), R.string.stats_total_time,
|
setTimeValue(context, getView(activity, view, R.id.stats_total_time), R.string.stats_total_time,
|
||||||
tripStatistics != null ? tripStatistics.getTotalTime() : -1L);
|
tripStatistics != null ? tripStatistics.getTotalTime() : -1L);
|
||||||
|
|
||||||
// Set moving time
|
// Set moving time
|
||||||
setTimeValue(context, getView(activity, view, R.id.stats_moving_time),
|
setTimeValue(context, getView(activity, view, R.id.stats_moving_time),
|
||||||
R.string.stats_moving_time, tripStatistics != null ? tripStatistics.getMovingTime() : -1L);
|
R.string.stats_moving_time, tripStatistics != null ? tripStatistics.getMovingTime() : -1L);
|
||||||
|
|
||||||
// Set average speed/pace
|
// Set average speed/pace
|
||||||
double averageSpeed = tripStatistics != null ? tripStatistics.getAverageSpeed() : Double.NaN;
|
double averageSpeed = tripStatistics != null ? tripStatistics.getAverageSpeed() : Double.NaN;
|
||||||
setSpeed(context, getView(activity, view, R.id.stats_average_speed),
|
setSpeed(context, getView(activity, view, R.id.stats_average_speed),
|
||||||
@@ -162,7 +160,7 @@ public class StatsUtils {
|
|||||||
double maxSpeed = tripStatistics == null ? Double.NaN : tripStatistics.getMaxSpeed();
|
double maxSpeed = tripStatistics == null ? Double.NaN : tripStatistics.getMaxSpeed();
|
||||||
setSpeed(context, getView(activity, view, R.id.stats_max_speed), R.string.stats_max_speed,
|
setSpeed(context, getView(activity, view, R.id.stats_max_speed), R.string.stats_max_speed,
|
||||||
R.string.stats_fastest_pace, maxSpeed, metricUnits, reportSpeed);
|
R.string.stats_fastest_pace, maxSpeed, metricUnits, reportSpeed);
|
||||||
|
|
||||||
// Set average moving speed/pace
|
// Set average moving speed/pace
|
||||||
double averageMovingSpeed = tripStatistics != null ? tripStatistics.getAverageMovingSpeed()
|
double averageMovingSpeed = tripStatistics != null ? tripStatistics.getAverageMovingSpeed()
|
||||||
: Double.NaN;
|
: Double.NaN;
|
||||||
@@ -174,13 +172,13 @@ public class StatsUtils {
|
|||||||
boolean showGradeElevation = PreferencesUtils.getBoolean(context,
|
boolean showGradeElevation = PreferencesUtils.getBoolean(context,
|
||||||
R.string.stats_show_grade_elevation_key,
|
R.string.stats_show_grade_elevation_key,
|
||||||
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT);
|
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT);
|
||||||
View gradeElevationHorizontalLine = getView(
|
View gradeElevationSeparator = getView(activity, view, R.id.stats_grade_elevation_separator);
|
||||||
activity, view, R.id.stats_grade_elevation_horizontal_line);
|
|
||||||
View gradeElevationContainer = getView(activity, view, R.id.stats_grade_elevation_container);
|
View gradeElevationContainer = getView(activity, view, R.id.stats_grade_elevation_container);
|
||||||
|
|
||||||
|
gradeElevationSeparator.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE);
|
||||||
|
gradeElevationContainer.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
if (showGradeElevation) {
|
if (showGradeElevation) {
|
||||||
gradeElevationHorizontalLine.setVisibility(View.VISIBLE);
|
|
||||||
gradeElevationContainer.setVisibility(View.VISIBLE);
|
|
||||||
// Set grade
|
// Set grade
|
||||||
double minGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMinGrade();
|
double minGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMinGrade();
|
||||||
double maxGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMaxGrade();
|
double maxGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMaxGrade();
|
||||||
@@ -200,9 +198,6 @@ public class StatsUtils {
|
|||||||
R.string.stats_min, minElevation, metricUnits);
|
R.string.stats_min, minElevation, metricUnits);
|
||||||
setElevationValue(context, getView(activity, view, R.id.stats_elevation_max),
|
setElevationValue(context, getView(activity, view, R.id.stats_elevation_max),
|
||||||
R.string.stats_max, maxElevation, metricUnits);
|
R.string.stats_max, maxElevation, metricUnits);
|
||||||
} else {
|
|
||||||
gradeElevationHorizontalLine.setVisibility(View.GONE);
|
|
||||||
gradeElevationContainer.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +312,7 @@ public class StatsUtils {
|
|||||||
private static void setCoordinateValue(
|
private static void setCoordinateValue(
|
||||||
Context context, View view, int labelId, double coordinate) {
|
Context context, View view, int labelId, double coordinate) {
|
||||||
String value = Double.isNaN(coordinate) || Double.isInfinite(coordinate) ? null
|
String value = Double.isNaN(coordinate) || Double.isInfinite(coordinate) ? null
|
||||||
: Location.convert(coordinate, Location.FORMAT_DEGREES);
|
: Location.convert(coordinate, Location.FORMAT_DEGREES);
|
||||||
SpannableStringBuilder unit = new SpannableStringBuilder(COORDINATE_DEGREE);
|
SpannableStringBuilder unit = new SpannableStringBuilder(COORDINATE_DEGREE);
|
||||||
unit.setSpan(new SuperscriptSpan(), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
unit.setSpan(new SuperscriptSpan(), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
setItem(context, view, labelId, value, unit);
|
setItem(context, view, labelId, value, unit);
|
||||||
|
|||||||
Reference in New Issue
Block a user