forked from upstream-mirrors/OpenTracks
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
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp" >
|
||||
android:orientation="vertical">
|
||||
<include layout="@layout/stats_content" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -15,67 +15,62 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<!-- Row 1: distance and calorie -->
|
||||
<!-- Distance and calorie -->
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" >
|
||||
<include
|
||||
android:id="@+id/stats_distance"
|
||||
layout="@layout/stats_large_item" />
|
||||
<View style="@style/StatsVerticalSpacer" />
|
||||
<include
|
||||
android:id="@+id/stats_calorie"
|
||||
layout="@layout/stats_large_item" />
|
||||
</LinearLayout>
|
||||
<!-- Row 2: total time and moving time -->
|
||||
<!-- Total time and moving time -->
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" >
|
||||
<include
|
||||
android:id="@+id/stats_total_time"
|
||||
layout="@layout/stats_large_item" />
|
||||
<View style="@style/StatsVerticalSpacer" />
|
||||
<include
|
||||
android:id="@+id/stats_moving_time"
|
||||
layout="@layout/stats_large_item" />
|
||||
</LinearLayout>
|
||||
<!-- Row 3: horizontal line -->
|
||||
<!-- Horizontal line -->
|
||||
<View style="@style/StatsHorizontalLine" />
|
||||
<!-- Row 3: speed and average speed -->
|
||||
<!-- 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" />
|
||||
<View style="@style/StatsVerticalSpacer" />
|
||||
<include
|
||||
android:id="@+id/stats_average_speed"
|
||||
layout="@layout/stats_small_item" />
|
||||
</LinearLayout>
|
||||
<!-- Row 4: max speed and average moving speed -->
|
||||
<!-- 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" />
|
||||
<View style="@style/StatsVerticalSpacer" />
|
||||
<include
|
||||
android:id="@+id/stats_average_moving_speed"
|
||||
layout="@layout/stats_small_item" />
|
||||
</LinearLayout>
|
||||
<!-- Row 5: horizontal line -->
|
||||
<!-- Horizontal line -->
|
||||
<View
|
||||
android:id="@+id/stats_grade_elevation_horizontal_line"
|
||||
android:id="@+id/stats_grade_elevation_separator"
|
||||
style="@style/StatsHorizontalLine" />
|
||||
<!-- Row 5: grade and elevation -->
|
||||
<LinearLayout
|
||||
android:id="@+id/stats_grade_elevation_container"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" >
|
||||
<!-- Grade -->
|
||||
<LinearLayout style="@style/StatsSmallItemContainer" >
|
||||
<LinearLayout style="@style/StatsSmallGroupContainer" >
|
||||
<!-- Grade label -->
|
||||
<TextView
|
||||
android:text="@string/stats_grade"
|
||||
@@ -87,16 +82,15 @@ limitations under the License.
|
||||
<!-- Grade min -->
|
||||
<include
|
||||
android:id="@+id/stats_grade_min"
|
||||
layout="@layout/stats_small_item_1line" />
|
||||
layout="@layout/stats_small_group_item" />
|
||||
<!-- Grade max -->
|
||||
<include
|
||||
android:id="@+id/stats_grade_max"
|
||||
layout="@layout/stats_small_item_1line" />
|
||||
layout="@layout/stats_small_group_item" />
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
<View style="@style/StatsVerticalSpacer" />
|
||||
<!-- Elevation -->
|
||||
<LinearLayout style="@style/StatsSmallItemContainer" >
|
||||
<LinearLayout style="@style/StatsSmallGroupContainer" >
|
||||
<!-- Elevation label -->
|
||||
<TextView
|
||||
android:text="@string/stats_elevation"
|
||||
@@ -108,27 +102,27 @@ limitations under the License.
|
||||
<!-- Elevation -->
|
||||
<include
|
||||
android:id="@+id/stats_elevation"
|
||||
layout="@layout/stats_small_item_1line" />
|
||||
layout="@layout/stats_small_group_item" />
|
||||
<!-- Elevation gain -->
|
||||
<include
|
||||
android:id="@+id/stats_elevation_gain"
|
||||
layout="@layout/stats_small_item_1line" />
|
||||
layout="@layout/stats_small_group_item" />
|
||||
<!-- Elevation min -->
|
||||
<include
|
||||
android:id="@+id/stats_elevation_min"
|
||||
layout="@layout/stats_small_item_1line" />
|
||||
layout="@layout/stats_small_group_item" />
|
||||
<!-- Elevation max -->
|
||||
<include
|
||||
android:id="@+id/stats_elevation_max"
|
||||
layout="@layout/stats_small_item_1line" />
|
||||
layout="@layout/stats_small_group_item" />
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- Row 6: horizontal line -->
|
||||
<!-- Horizontal line -->
|
||||
<View
|
||||
android:id="@+id/stats_coordinate_horizontal_line"
|
||||
android:id="@+id/stats_coordinate_separator"
|
||||
style="@style/StatsHorizontalLine" />
|
||||
<!-- Row 6: latitude and longitude -->
|
||||
<!-- Latitude and longitude -->
|
||||
<LinearLayout
|
||||
android:id="@+id/stats_coordinate_container"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -136,7 +130,6 @@ limitations under the License.
|
||||
<include
|
||||
android:id="@+id/stats_latitude"
|
||||
layout="@layout/stats_small_item" />
|
||||
<View style="@style/StatsVerticalSpacer" />
|
||||
<include
|
||||
android:id="@+id/stats_longitude"
|
||||
layout="@layout/stats_small_item" />
|
||||
|
||||
@@ -18,20 +18,22 @@ limitations under the License.
|
||||
<!-- The style for choose activity text -->
|
||||
<style name="StatsSmallLabel" parent="@style/TextSmall">
|
||||
<!-- 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:singleLine">false</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
</style>
|
||||
<style name="StatsLargeLabel" parent="@style/TextSmall">
|
||||
<!-- 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:singleLine">false</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textColor">@color/stats_large_label</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
<style name="TextChooseActivity">
|
||||
</style>
|
||||
<style name="TextChooseActivity">
|
||||
<!-- Same as TextChooseActivity in values/styles.xml except removing textSize and using textAppearance -->
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceListItemSmall</item>
|
||||
</style>
|
||||
|
||||
@@ -132,22 +132,23 @@ limitations under the License.
|
||||
<style name="StatsHorizontalLine">
|
||||
<item name="android:background">@color/stats_separator</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>
|
||||
</style>
|
||||
<!-- stats large item container -->
|
||||
<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_weight">10</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:orientation">vertical</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>
|
||||
</style>
|
||||
<!-- stats large label -->
|
||||
<style name="StatsLargeLabel" parent="@style/TextSmall">
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:singleLine">false</item>
|
||||
<item name="android:textColor">@color/stats_large_label</item>
|
||||
@@ -173,12 +174,18 @@ limitations under the License.
|
||||
<style name="StatsScrollView" parent="@style/ScrollView">
|
||||
<item name="android:scrollbarStyle">outsideOverlay</item>
|
||||
</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">
|
||||
<item name="android:paddingTop">12dp</item>
|
||||
</style>
|
||||
<!-- stats small label -->
|
||||
<style name="StatsSmallLabel" parent="@style/TextSmall">
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:singleLine">false</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
@@ -199,12 +206,6 @@ limitations under the License.
|
||||
<item name="android:paddingTop">4dp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
</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">
|
||||
<item name="android:layout_height">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) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
handler = new Handler();
|
||||
updateUi(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
resumeTrackDataHub();
|
||||
updateUi(getActivity());
|
||||
if (isSelectedTrackRecording()) {
|
||||
handler.post(updateTotalTime);
|
||||
}
|
||||
|
||||
@@ -63,49 +63,47 @@ public class StatsUtils {
|
||||
|
||||
// Set speed/pace
|
||||
View speed = getView(activity, view, R.id.stats_speed);
|
||||
speed.setVisibility(isRecording ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
if (isRecording) {
|
||||
double value = isRecording && location != null && location.hasSpeed() ? location.getSpeed()
|
||||
: Double.NaN;
|
||||
speed.setVisibility(View.VISIBLE);
|
||||
setSpeed(context, speed, R.string.stats_speed, R.string.stats_pace, value, metricUnits,
|
||||
reportSpeed);
|
||||
} else {
|
||||
speed.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
// Set elevation
|
||||
boolean showGradeElevation = PreferencesUtils.getBoolean(context,
|
||||
R.string.stats_show_grade_elevation_key,
|
||||
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT);
|
||||
boolean showGradeElevation = PreferencesUtils.getBoolean(
|
||||
context, R.string.stats_show_grade_elevation_key,
|
||||
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT) && isRecording;
|
||||
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.NaN;
|
||||
elevation.setVisibility(View.VISIBLE);
|
||||
setElevationValue(context, elevation, -1, altitude, metricUnits);
|
||||
} else {
|
||||
elevation.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Set coordinate
|
||||
boolean showCoordinate = PreferencesUtils.getBoolean(context,
|
||||
R.string.stats_show_coordinate_key, PreferencesUtils.STATS_SHOW_COORDINATE_DEFAULT);
|
||||
View coordinateHorizontalLine = getView(activity, view, R.id.stats_coordinate_horizontal_line);
|
||||
boolean showCoordinate = PreferencesUtils.getBoolean(
|
||||
context, R.string.stats_show_coordinate_key, PreferencesUtils.STATS_SHOW_COORDINATE_DEFAULT)
|
||||
&& isRecording;
|
||||
View coordinateSeparator = getView(activity, view, R.id.stats_coordinate_separator);
|
||||
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 longitude = location != null ? location.getLongitude() : Double.NaN;
|
||||
coordinateHorizontalLine.setVisibility(View.VISIBLE);
|
||||
coordinateContainer.setVisibility(View.VISIBLE);
|
||||
setCoordinateValue(
|
||||
context, getView(activity, view, R.id.stats_latitude), R.string.stats_latitude, latitude);
|
||||
setCoordinateValue(context, getView(activity, view, R.id.stats_longitude),
|
||||
R.string.stats_longitude, longitude);
|
||||
} else {
|
||||
coordinateHorizontalLine.setVisibility(View.GONE);
|
||||
coordinateContainer.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,15 +141,15 @@ public class StatsUtils {
|
||||
// Set calorie
|
||||
double calorie = tripStatistics == null ? Double.NaN : tripStatistics.getCalorie();
|
||||
setCalorie(context, getView(activity, view, R.id.stats_calorie), calorie);
|
||||
|
||||
|
||||
// Set total time
|
||||
setTimeValue(context, getView(activity, view, R.id.stats_total_time), R.string.stats_total_time,
|
||||
tripStatistics != null ? tripStatistics.getTotalTime() : -1L);
|
||||
|
||||
|
||||
// Set moving time
|
||||
setTimeValue(context, getView(activity, view, R.id.stats_moving_time),
|
||||
R.string.stats_moving_time, tripStatistics != null ? tripStatistics.getMovingTime() : -1L);
|
||||
|
||||
|
||||
// Set average speed/pace
|
||||
double averageSpeed = tripStatistics != null ? tripStatistics.getAverageSpeed() : Double.NaN;
|
||||
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();
|
||||
setSpeed(context, getView(activity, view, R.id.stats_max_speed), R.string.stats_max_speed,
|
||||
R.string.stats_fastest_pace, maxSpeed, metricUnits, reportSpeed);
|
||||
|
||||
|
||||
// Set average moving speed/pace
|
||||
double averageMovingSpeed = tripStatistics != null ? tripStatistics.getAverageMovingSpeed()
|
||||
: Double.NaN;
|
||||
@@ -174,13 +172,13 @@ public class StatsUtils {
|
||||
boolean showGradeElevation = PreferencesUtils.getBoolean(context,
|
||||
R.string.stats_show_grade_elevation_key,
|
||||
PreferencesUtils.STATS_SHOW_GRADE_ELEVATION_DEFAULT);
|
||||
View gradeElevationHorizontalLine = getView(
|
||||
activity, view, R.id.stats_grade_elevation_horizontal_line);
|
||||
View gradeElevationSeparator = getView(activity, view, R.id.stats_grade_elevation_separator);
|
||||
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) {
|
||||
gradeElevationHorizontalLine.setVisibility(View.VISIBLE);
|
||||
gradeElevationContainer.setVisibility(View.VISIBLE);
|
||||
// Set grade
|
||||
double minGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMinGrade();
|
||||
double maxGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMaxGrade();
|
||||
@@ -200,9 +198,6 @@ public class StatsUtils {
|
||||
R.string.stats_min, minElevation, metricUnits);
|
||||
setElevationValue(context, getView(activity, view, R.id.stats_elevation_max),
|
||||
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(
|
||||
Context context, View view, int labelId, double coordinate) {
|
||||
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);
|
||||
unit.setSpan(new SuperscriptSpan(), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
setItem(context, view, labelId, value, unit);
|
||||
|
||||
Reference in New Issue
Block a user