forked from upstream-mirrors/OpenTracks
Elevation gain adheres to visibility setting.
This commit is contained in:
@@ -29,6 +29,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.constraintlayout.widget.Group;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
import de.dennisguse.opentracks.R;
|
||||||
@@ -87,7 +88,7 @@ public class StatisticsRecordedFragment extends Fragment {
|
|||||||
private TextView speedMovingValue;
|
private TextView speedMovingValue;
|
||||||
private TextView speedMovingUnit;
|
private TextView speedMovingUnit;
|
||||||
|
|
||||||
private TextView elevationCurrentGroup;
|
private Group elevationGroup;
|
||||||
private TextView elevationTotalGainValue;
|
private TextView elevationTotalGainValue;
|
||||||
private TextView elevationTotalGainUnit;
|
private TextView elevationTotalGainUnit;
|
||||||
|
|
||||||
@@ -135,6 +136,7 @@ public class StatisticsRecordedFragment extends Fragment {
|
|||||||
speedMovingValue = view.findViewById(R.id.stats_moving_speed_value);
|
speedMovingValue = view.findViewById(R.id.stats_moving_speed_value);
|
||||||
speedMovingUnit = view.findViewById(R.id.stats_moving_speed_unit);
|
speedMovingUnit = view.findViewById(R.id.stats_moving_speed_unit);
|
||||||
|
|
||||||
|
elevationGroup = view.findViewById(R.id.stats_elevation_group);
|
||||||
elevationTotalGainValue = view.findViewById(R.id.stats_elevation_gain_value);
|
elevationTotalGainValue = view.findViewById(R.id.stats_elevation_gain_value);
|
||||||
elevationTotalGainUnit = view.findViewById(R.id.stats_elevation_gain_unit);
|
elevationTotalGainUnit = view.findViewById(R.id.stats_elevation_gain_unit);
|
||||||
}
|
}
|
||||||
@@ -195,6 +197,7 @@ public class StatisticsRecordedFragment extends Fragment {
|
|||||||
speedMovingValue = null;
|
speedMovingValue = null;
|
||||||
speedMovingUnit = null;
|
speedMovingUnit = null;
|
||||||
|
|
||||||
|
elevationGroup = null;
|
||||||
elevationTotalGainValue = null;
|
elevationTotalGainValue = null;
|
||||||
elevationTotalGainUnit = null;
|
elevationTotalGainUnit = null;
|
||||||
}
|
}
|
||||||
@@ -277,6 +280,10 @@ public class StatisticsRecordedFragment extends Fragment {
|
|||||||
|
|
||||||
// Set elevation gain
|
// Set elevation gain
|
||||||
{
|
{
|
||||||
|
// Make elevation visible?
|
||||||
|
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
|
||||||
|
elevationGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
double elevationGain_m = trackStatistics != null ? trackStatistics.getTotalElevationGain() : 0f;
|
double elevationGain_m = trackStatistics != null ? trackStatistics.getTotalElevationGain() : 0f;
|
||||||
|
|
||||||
Pair<String, String> parts = StringUtils.formatElevation(getContext(), elevationGain_m, metricUnits);
|
Pair<String, String> parts = StringUtils.formatElevation(getContext(), elevationGain_m, metricUnits);
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
private TextView speedLabel;
|
private TextView speedLabel;
|
||||||
private TextView speedValue;
|
private TextView speedValue;
|
||||||
private TextView speedUnit;
|
private TextView speedUnit;
|
||||||
private Group elevationCurrentGroup;
|
private Group elevationGroup;
|
||||||
private TextView elevationCurrentValue;
|
private TextView elevationCurrentValue;
|
||||||
private TextView elevationCurrentUnit;
|
private TextView elevationCurrentUnit;
|
||||||
private TextView elevationTotalGainValue;
|
private TextView elevationTotalGainValue;
|
||||||
@@ -184,7 +184,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
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);
|
||||||
|
|
||||||
elevationCurrentGroup = view.findViewById(R.id.stats_elevation_current_group);
|
elevationGroup = view.findViewById(R.id.stats_elevation_group);
|
||||||
elevationCurrentValue = view.findViewById(R.id.stats_elevation_current_value);
|
elevationCurrentValue = view.findViewById(R.id.stats_elevation_current_value);
|
||||||
elevationCurrentUnit = view.findViewById(R.id.stats_elevation_current_unit);
|
elevationCurrentUnit = view.findViewById(R.id.stats_elevation_current_unit);
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
speedValue = null;
|
speedValue = null;
|
||||||
speedUnit = null;
|
speedUnit = null;
|
||||||
|
|
||||||
elevationCurrentGroup = null;
|
elevationGroup = null;
|
||||||
elevationCurrentValue = null;
|
elevationCurrentValue = null;
|
||||||
elevationCurrentUnit = null;
|
elevationCurrentUnit = null;
|
||||||
|
|
||||||
@@ -586,7 +586,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
{
|
{
|
||||||
// Make elevation visible?
|
// Make elevation visible?
|
||||||
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
|
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
|
||||||
elevationCurrentGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
elevationGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
|
|
||||||
// Set elevation
|
// Set elevation
|
||||||
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
|
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
|
||||||
elevationCurrentGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
elevationGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
if (showElevation) {
|
if (showElevation) {
|
||||||
// Current elevation
|
// Current elevation
|
||||||
|
|||||||
@@ -219,10 +219,10 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
|
app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Group
|
<androidx.constraintlayout.widget.Group
|
||||||
android:id="@+id/stats_elevation_gain_group"
|
android:id="@+id/stats_elevation_group"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:constraint_referenced_ids="stats_elevation_current_label,stats_elevation_current_value,stats_elevation_current_unit,stats_elevation_horizontal_line" />
|
app:constraint_referenced_ids="stats_elevation_horizontal_line,stats_elevation_gain_label,stats_elevation_gain_value,stats_elevation_gain_unit" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_elevation_gain_label"
|
android:id="@+id/stats_elevation_gain_label"
|
||||||
|
|||||||
@@ -246,13 +246,14 @@
|
|||||||
app:layout_constraintRight_toLeftOf="@+id/guideline3"
|
app:layout_constraintRight_toLeftOf="@+id/guideline3"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
|
app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
|
||||||
|
|
||||||
<!-- Current elevation -->
|
<!-- Elevation -->
|
||||||
<androidx.constraintlayout.widget.Group
|
<androidx.constraintlayout.widget.Group
|
||||||
android:id="@+id/stats_elevation_current_group"
|
android:id="@+id/stats_elevation_group"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:constraint_referenced_ids="stats_elevation_current_label,stats_elevation_current_value,stats_elevation_current_unit,stats_elevation_horizontal_line" />
|
app:constraint_referenced_ids="stats_elevation_horizontal_line,stats_elevation_current_label,stats_elevation_current_value,stats_elevation_current_unit,stats_elevation_gain_label,stats_elevation_gain_value,stats_elevation_gain_unit" />
|
||||||
|
|
||||||
|
<!-- Elevation -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_elevation_current_label"
|
android:id="@+id/stats_elevation_current_label"
|
||||||
style="@style/StatsSmallLabel"
|
style="@style/StatsSmallLabel"
|
||||||
@@ -281,11 +282,6 @@
|
|||||||
tools:text="m" />
|
tools:text="m" />
|
||||||
|
|
||||||
<!-- Current elevation -->
|
<!-- Current elevation -->
|
||||||
<androidx.constraintlayout.widget.Group
|
|
||||||
android:id="@+id/stats_elevation_gain_group"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:constraint_referenced_ids="stats_elevation_current_label,stats_elevation_current_value,stats_elevation_current_unit,stats_elevation_horizontal_line" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_elevation_gain_label"
|
android:id="@+id/stats_elevation_gain_label"
|
||||||
|
|||||||
Reference in New Issue
Block a user