forked from upstream-mirrors/OpenTracks
Remove elevation min/max from UI as GPS-derived data often lead to invalid data (especially initial fix phase).
Fixes #148.
This commit is contained in:
@@ -139,15 +139,10 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
private TextView speedMovingUnit;
|
private TextView speedMovingUnit;
|
||||||
private View gradeElevationSeparator;
|
private View gradeElevationSeparator;
|
||||||
private View gradeElevationContainer;
|
private View gradeElevationContainer;
|
||||||
private TextView elevationMinValue;
|
|
||||||
private TextView elevationMinUnit;
|
|
||||||
private TextView elevationMaxValue;
|
|
||||||
private TextView elevationMaxUnit;
|
|
||||||
private View speedContainer;
|
private View speedContainer;
|
||||||
private TextView speedLabel;
|
private TextView speedLabel;
|
||||||
private TextView speedValue;
|
private TextView speedValue;
|
||||||
private TextView speedUnit;
|
private TextView speedUnit;
|
||||||
private View elevationContainer;
|
|
||||||
private TextView elevationValue;
|
private TextView elevationValue;
|
||||||
private TextView elevationUnit;
|
private TextView elevationUnit;
|
||||||
private View coordinateSeparator;
|
private View coordinateSeparator;
|
||||||
@@ -188,18 +183,11 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
gradeElevationSeparator = view.findViewById(R.id.stats_elevation_separator);
|
gradeElevationSeparator = view.findViewById(R.id.stats_elevation_separator);
|
||||||
gradeElevationContainer = view.findViewById(R.id.stats_elevation_container);
|
gradeElevationContainer = view.findViewById(R.id.stats_elevation_container);
|
||||||
|
|
||||||
elevationMinValue = view.findViewById(R.id.stats_elevation_min_value);
|
|
||||||
elevationMinUnit = view.findViewById(R.id.stats_elevation_min_unit);
|
|
||||||
|
|
||||||
elevationMaxValue = view.findViewById(R.id.stats_elevation_max_value);
|
|
||||||
elevationMaxUnit = view.findViewById(R.id.stats_elevation_max_unit);
|
|
||||||
|
|
||||||
speedContainer = view.findViewById(R.id.stats_speed);
|
speedContainer = view.findViewById(R.id.stats_speed);
|
||||||
speedLabel = view.findViewById(R.id.stats_speed_label);
|
speedLabel = view.findViewById(R.id.stats_speed_label);
|
||||||
speedValue = view.findViewById(R.id.stats_speed_value);
|
speedValue = view.findViewById(R.id.stats_speed_value);
|
||||||
speedUnit = view.findViewById(R.id.stats_speed_unit);
|
speedUnit = view.findViewById(R.id.stats_speed_unit);
|
||||||
|
|
||||||
elevationContainer = view.findViewById(R.id.stats_elevation);
|
|
||||||
elevationValue = view.findViewById(R.id.stats_elevation_current_value);
|
elevationValue = view.findViewById(R.id.stats_elevation_current_value);
|
||||||
elevationUnit = view.findViewById(R.id.stats_elevation_current_unit);
|
elevationUnit = view.findViewById(R.id.stats_elevation_current_unit);
|
||||||
|
|
||||||
@@ -302,18 +290,11 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
gradeElevationSeparator = null;
|
gradeElevationSeparator = null;
|
||||||
gradeElevationContainer = null;
|
gradeElevationContainer = null;
|
||||||
|
|
||||||
elevationMinValue = null;
|
|
||||||
elevationMinUnit = null;
|
|
||||||
|
|
||||||
elevationMaxValue = null;
|
|
||||||
elevationMaxUnit = null;
|
|
||||||
|
|
||||||
speedContainer = null;
|
speedContainer = null;
|
||||||
speedLabel = null;
|
speedLabel = null;
|
||||||
speedValue = null;
|
speedValue = null;
|
||||||
speedUnit = null;
|
speedUnit = null;
|
||||||
|
|
||||||
elevationContainer = null;
|
|
||||||
elevationValue = null;
|
elevationValue = null;
|
||||||
elevationUnit = null;
|
elevationUnit = null;
|
||||||
|
|
||||||
@@ -542,31 +523,10 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
speedMovingUnit.setText(parts.second);
|
speedMovingUnit.setText(parts.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make elevation visible?
|
||||||
// Set elevation
|
|
||||||
{
|
{
|
||||||
boolean showElevation = PreferencesUtils.isShowStatsGradeElevation(getContext());
|
boolean showElevation = PreferencesUtils.isShowStatsGradeElevation(getContext());
|
||||||
gradeElevationSeparator.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
gradeElevationSeparator.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
gradeElevationContainer.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
if (showElevation) {
|
|
||||||
{
|
|
||||||
double elevation = lastTripStatistics == null ? Double.NaN : lastTripStatistics.getMinElevation();
|
|
||||||
Pair<String, String> parts = StringUtils.formatElevation(getContext(), elevation, metricUnits);
|
|
||||||
|
|
||||||
elevationMinValue.setText(parts.first);
|
|
||||||
elevationMinUnit.setText(parts.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
double elevation = lastTripStatistics == null ? Double.NaN : lastTripStatistics.getMaxElevation();
|
|
||||||
Pair<String, String> parts = StringUtils.formatElevation(getContext(), elevation, metricUnits);
|
|
||||||
|
|
||||||
elevationMaxValue.setText(parts.first);
|
|
||||||
elevationMaxUnit.setText(parts.second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,7 +558,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
|
|
||||||
// Set elevation
|
// Set elevation
|
||||||
boolean showGradeElevation = isRecording && PreferencesUtils.isShowStatsGradeElevation(getContext());
|
boolean showGradeElevation = isRecording && PreferencesUtils.isShowStatsGradeElevation(getContext());
|
||||||
elevationContainer.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE);
|
gradeElevationContainer.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
if (showGradeElevation) {
|
if (showGradeElevation) {
|
||||||
double altitude = lastLocation != null && lastLocation.hasAltitude() ? lastLocation.getAltitude() : Double.NaN;
|
double altitude = lastLocation != null && lastLocation.hasAltitude() ? lastLocation.getAltitude() : Double.NaN;
|
||||||
|
|||||||
@@ -209,98 +209,19 @@ limitations under the License.
|
|||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
<!-- Current elevation -->
|
<!-- Current elevation -->
|
||||||
<TableRow
|
<LinearLayout
|
||||||
android:id="@+id/stats_elevation"
|
style="@style/StatsSmallValueContainer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_gravity="start|bottom">
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
style="@style/StatsSmallValueContainer"
|
android:id="@+id/stats_elevation_current_value"
|
||||||
android:layout_gravity="start|bottom">
|
style="@style/StatsSmallValue"
|
||||||
|
android:value="@string/value_unknown" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_elevation_current_value"
|
android:id="@+id/stats_elevation_current_unit"
|
||||||
style="@style/StatsSmallValue"
|
style="@style/StatsUnit" />
|
||||||
android:value="@string/value_unknown" />
|
</LinearLayout>
|
||||||
|
|
||||||
<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="start|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="start|bottom">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/StatsSmallValue"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/StatsSmallLabel"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingEnd="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="start|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="start|bottom">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/StatsSmallValue"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/StatsSmallLabel"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
android:text="@string/stats_max" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</TableRow>
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user