Refactored stats_content layout to contain all content (not use include).

This commit is contained in:
Dennis Guse
2019-09-12 17:38:25 +02:00
parent b5cb47a0c7
commit 42b3a5dfc9
11 changed files with 471 additions and 419 deletions
+6 -9
View File
@@ -15,18 +15,15 @@ limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/StatsLargeItemContainer">
<!-- Label -->
<TextView
android:id="@+id/stats_activity_type_label"
style="@style/StatsLargeLabel"
android:text="@string/track_edit_activity_type_hint" />
<!-- Value container -->
<LinearLayout style="@style/StatsLargeValueContainer">
<Spinner
android:id="@+id/stats_activity_type_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp" />
</LinearLayout>
<Spinner
android:id="@+id/stats_activity_type_icon"
style="@style/StatsLargeValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
+292 -56
View File
@@ -18,57 +18,163 @@ limitations under the License.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Distance -->
<LinearLayout style="@style/StatsLargeItemContainer">
<include
android:id="@+id/stats_distance"
layout="@layout/stats_large_item" />
<TextView
style="@style/StatsLargeLabel"
android:text="@string/stats_distance" />
<LinearLayout style="@style/StatsLargeValueContainer">
<TextView
android:id="@+id/stats_distance_value"
style="@style/StatsLargeValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_distance_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
<!-- Activity type -->
<include
android:id="@+id/stats_activity_type"
layout="@layout/stats_activity_type" />
</LinearLayout>
<!-- Total time and moving time -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/stats_total_time"
layout="@layout/stats_large_item" />
<!-- Total time -->
<LinearLayout style="@style/StatsLargeItemContainer">
<include
android:id="@+id/stats_moving_time"
layout="@layout/stats_large_item" />
<TextView
style="@style/StatsLargeLabel"
android:text="@string/stats_total_time" />
<TextView
android:id="@+id/stats_total_time_value"
style="@style/StatsLargeValue" />
</LinearLayout>
<!-- Moving time -->
<LinearLayout style="@style/StatsLargeItemContainer">
<TextView
style="@style/StatsLargeLabel"
android:text="@string/stats_moving_time" />
<TextView
android:id="@+id/stats_moving_time_value"
style="@style/StatsLargeValue"
android:value="@string/value_unknown" />
</LinearLayout>
</LinearLayout>
<!-- Horizontal line -->
<View style="@style/StatsHorizontalLine" />
<!-- Speed and average speed -->
<!-- Speed/pace and average -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
<!-- Speed/pace -->
<LinearLayout
android:id="@+id/stats_speed"
layout="@layout/stats_small_item" />
style="@style/StatsSmallItemContainer">
<include
android:id="@+id/stats_average_speed"
layout="@layout/stats_small_item" />
<TextView
android:id="@+id/stats_speed_label"
style="@style/StatsSmallLabel" />
<LinearLayout style="@style/StatsSmallValueContainer">
<TextView
android:id="@+id/stats_speed_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_speed_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
<!-- Average -->
<LinearLayout style="@style/StatsSmallItemContainer">
<TextView
android:id="@+id/stats_average_speed_label"
style="@style/StatsSmallLabel" />
<LinearLayout style="@style/StatsSmallValueContainer">
<TextView
android:id="@+id/stats_average_speed_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_average_speed_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- Max speed and average moving speed -->
<!-- Speed max and moving -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/stats_max_speed"
layout="@layout/stats_small_item" />
<!-- Speed max -->
<TextView
android:id="@+id/stats_max_speed_label"
style="@style/StatsSmallLabel" />
<LinearLayout style="@style/StatsSmallItemContainer">
<include
android:id="@+id/stats_average_moving_speed"
layout="@layout/stats_small_item" />
<LinearLayout style="@style/StatsSmallValueContainer">
<TextView
android:id="@+id/stats_max_speed_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_max_speed_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
<!-- Speed moving -->
<LinearLayout style="@style/StatsSmallItemContainer">
<TextView
android:id="@+id/stats_moving_speed_label"
style="@style/StatsSmallLabel" />
<LinearLayout style="@style/StatsSmallValueContainer">
<TextView
android:id="@+id/stats_moving_speed_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_moving_speed_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- Horizontal line -->
<View
android:id="@+id/stats_elevation_separator"
style="@style/StatsHorizontalLine" />
@@ -77,12 +183,13 @@ limitations under the License.
android:id="@+id/stats_elevation_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout style="@style/StatsSmallGroupContainer">
<!-- This is a placeholder -->
</LinearLayout>
<!-- Elevation -->
<LinearLayout style="@style/StatsSmallGroupContainer">
<!-- Elevation label -->
<TextView
style="@style/StatsSmallLabel"
android:text="@string/stats_elevation" />
@@ -91,67 +198,196 @@ limitations under the License.
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<!-- Elevation -->
<include
<!-- Current elevation -->
<TableRow
android:id="@+id/stats_elevation"
layout="@layout/stats_small_group_item" />
<!-- Elevation gain -->
<!-- TODO DISABLED AS computation from GPS is not precise enough, go for getAltitude(RemoteSensorManager.PRESSURE_STANDARD_ATMOSPHERE, pressure) -->
<!--<include-->
<!--android:id="@+id/stats_elevation_gain"-->
<!--layout="@layout/stats_small_group_item" />-->
<include
android:id="@+id/stats_elevation_min"
layout="@layout/stats_small_group_item" />
<include
android:id="@+id/stats_elevation_max"
layout="@layout/stats_small_group_item" />
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="left|bottom">
<TextView
style="@style/StatsSmallValue"
android:visibility="invisible" />
<TextView
android:id="@+id/stats_elevation_current_label"
style="@style/StatsSmallLabel"
android:paddingLeft="8dp" />
</LinearLayout>
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="left|bottom">
<TextView
android:id="@+id/stats_elevation_current_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_elevation_current_unit"
style="@style/StatsUnit" />
</LinearLayout>
</TableRow>
<!-- Minimal elevation -->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="right|bottom">
<TextView
android:id="@+id/stats_elevation_min_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
<TextView
android:id="@+id/stats_elevation_min_unit"
style="@style/StatsUnit" />
</LinearLayout>
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="left|bottom">
<TextView
style="@style/StatsSmallValue"
android:visibility="invisible" />
<TextView
style="@style/StatsSmallLabel"
android:layout_gravity="bottom"
android:paddingLeft="8dp"
android:text="@string/stats_min" />
</LinearLayout>
</TableRow>
<!-- Maximal elevation -->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="right|bottom">
<TextView
android:id="@+id/stats_elevation_max_value"
style="@style/StatsSmallValue" />
<TextView
android:id="@+id/stats_elevation_max_unit"
style="@style/StatsUnit" />
</LinearLayout>
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="left|bottom">
<TextView
style="@style/StatsSmallValue"
android:visibility="invisible" />
<TextView
style="@style/StatsSmallLabel"
android:layout_gravity="bottom"
android:paddingLeft="8dp"
android:text="@string/stats_max" />
</LinearLayout>
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
<!-- Horizontal line -->
<View
android:id="@+id/stats_coordinate_separator"
style="@style/StatsHorizontalLine" />
<!-- Latitude and longitude -->
<LinearLayout
android:id="@+id/stats_coordinate_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/stats_latitude"
layout="@layout/stats_small_item" />
<LinearLayout style="@style/StatsSmallItemContainer">
<include
android:id="@+id/stats_longitude"
layout="@layout/stats_small_item" />
<TextView
style="@style/StatsSmallLabel"
android:text="@string/stats_latitude" />
<TextView
android:id="@+id/stats_latitude_value"
style="@style/StatsSmallValue" />
</LinearLayout>
<LinearLayout style="@style/StatsSmallItemContainer">
<TextView
style="@style/StatsSmallLabel"
android:text="@string/stats_longitude" />
<TextView
android:id="@+id/stats_longitude_value"
style="@style/StatsSmallValue"
android:value="@string/value_unknown" />
</LinearLayout>
</LinearLayout>
<!-- Sensor data: heart rate-->
<View
android:id="@+id/stats_sensor_separator"
style="@style/StatsHorizontalLine" />
<!-- Sensor data: heart rate-->
<LinearLayout
android:id="@+id/stats_sensor_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/stats_sensor_heart_rate_value"
layout="@layout/stats_large_item" />
<LinearLayout style="@style/StatsLargeItemContainer">
<TextView
android:id="@+id/stats_sensor_heart_rate_label"
style="@style/StatsLargeLabel"
android:text="@string/sensor_state_heart_rate" />
<LinearLayout style="@style/StatsLargeValueContainer">
<TextView
android:id="@+id/stats_sensor_heart_rate_value"
style="@style/StatsLargeValue"
android:value="@string/value_unknown" />
<TextView
style="@style/StatsUnit"
android:text="@string/sensor_unit_beats_per_minute" />
</LinearLayout>
</LinearLayout>
<LinearLayout style="@style/StatsSmallGroupContainer">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
style="@style/StatsSmallLabel"
android:text="@string/settings_sensor_bluetooth_sensor" />
<TextView
android:id="@+id/stats_sensor_heart_rate_sensor_value"
style="@style/StatsTinyValue"
android:value="@string/value_unknown" />
<include
android:id="@+id/stats_sensor_heart_rate_sensor"
layout="@layout/stats_tiny_item" />
</TableLayout>
</LinearLayout>
</LinearLayout>
</merge>
-33
View File
@@ -1,33 +0,0 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/StatsLargeItemContainer">
<!-- Label -->
<TextView
android:id="@+id/stats_label"
style="@style/StatsLargeLabel" />
<!-- Value container -->
<LinearLayout style="@style/StatsLargeValueContainer">
<!-- Value -->
<TextView
android:id="@+id/stats_value"
style="@style/StatsLargeValue" />
<!-- Unit -->
<TextView
android:id="@+id/stats_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
@@ -1,47 +0,0 @@
<?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.
-->
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Value container -->
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="right|bottom">
<!-- Value -->
<TextView
android:id="@+id/stats_value"
style="@style/StatsSmallValue" />
<!-- Unit -->
<TextView
android:id="@+id/stats_unit"
style="@style/StatsUnit" />
</LinearLayout>
<!-- Label container -->
<LinearLayout
style="@style/StatsSmallValueContainer"
android:layout_gravity="left|bottom">
<TextView
style="@style/StatsSmallValue"
android:visibility="invisible" />
<!-- Label -->
<TextView
android:id="@+id/stats_label"
style="@style/StatsSmallLabel"
android:layout_gravity="bottom"
android:paddingLeft="8dp" />
</LinearLayout>
</TableRow>
-33
View File
@@ -1,33 +0,0 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/StatsSmallItemContainer">
<!-- Label -->
<TextView
android:id="@+id/stats_label"
style="@style/StatsSmallLabel" />
<!-- Value container -->
<LinearLayout style="@style/StatsSmallValueContainer">
<!-- Value -->
<TextView
android:id="@+id/stats_value"
style="@style/StatsSmallValue" />
<!-- Unit -->
<TextView
android:id="@+id/stats_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
-33
View File
@@ -1,33 +0,0 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/StatsSmallItemContainer">
<!-- Label -->
<TextView
android:id="@+id/stats_label"
style="@style/StatsSmallLabel" />
<!-- Value container -->
<LinearLayout style="@style/StatsSmallValueContainer">
<!-- Value -->
<TextView
android:id="@+id/stats_value"
style="@style/StatsTinyValue" />
<!-- Unit -->
<TextView
android:id="@+id/stats_unit"
style="@style/StatsUnit" />
</LinearLayout>
</LinearLayout>
+3 -3
View File
@@ -172,7 +172,7 @@ limitations under the License.
</style>
<style name="StatsLargeValue">
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:singleLine">true</item>
@@ -211,13 +211,13 @@ limitations under the License.
</style>
<!-- stats small value -->
<style name="StatsSmallValue" parent="@style/TextLarge">
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_gravity">center</item>
<item name="android:singleLine">true</item>
<item name="android:textColor">@android:color/white</item>
</style>
<!-- stats small value -->
<style name="StatsTinyValue" parent="@style/TextSmall">
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_gravity">center</item>
<item name="android:singleLine">true</item>
<item name="android:textColor">@android:color/white</item>
</style>