mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
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.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import de.dennisguse.opentracks.R;
|
||||
@@ -87,7 +88,7 @@ public class StatisticsRecordedFragment extends Fragment {
|
||||
private TextView speedMovingValue;
|
||||
private TextView speedMovingUnit;
|
||||
|
||||
private TextView elevationCurrentGroup;
|
||||
private Group elevationGroup;
|
||||
private TextView elevationTotalGainValue;
|
||||
private TextView elevationTotalGainUnit;
|
||||
|
||||
@@ -135,6 +136,7 @@ public class StatisticsRecordedFragment extends Fragment {
|
||||
speedMovingValue = view.findViewById(R.id.stats_moving_speed_value);
|
||||
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);
|
||||
elevationTotalGainUnit = view.findViewById(R.id.stats_elevation_gain_unit);
|
||||
}
|
||||
@@ -195,6 +197,7 @@ public class StatisticsRecordedFragment extends Fragment {
|
||||
speedMovingValue = null;
|
||||
speedMovingUnit = null;
|
||||
|
||||
elevationGroup = null;
|
||||
elevationTotalGainValue = null;
|
||||
elevationTotalGainUnit = null;
|
||||
}
|
||||
@@ -277,6 +280,10 @@ public class StatisticsRecordedFragment extends Fragment {
|
||||
|
||||
// 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;
|
||||
|
||||
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 speedValue;
|
||||
private TextView speedUnit;
|
||||
private Group elevationCurrentGroup;
|
||||
private Group elevationGroup;
|
||||
private TextView elevationCurrentValue;
|
||||
private TextView elevationCurrentUnit;
|
||||
private TextView elevationTotalGainValue;
|
||||
@@ -184,7 +184,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
||||
speedValue = view.findViewById(R.id.stats_speed_value);
|
||||
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);
|
||||
elevationCurrentUnit = view.findViewById(R.id.stats_elevation_current_unit);
|
||||
|
||||
@@ -284,7 +284,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
||||
speedValue = null;
|
||||
speedUnit = null;
|
||||
|
||||
elevationCurrentGroup = null;
|
||||
elevationGroup = null;
|
||||
elevationCurrentValue = null;
|
||||
elevationCurrentUnit = null;
|
||||
|
||||
@@ -586,7 +586,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
||||
{
|
||||
// Make elevation visible?
|
||||
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
|
||||
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
|
||||
elevationCurrentGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||
elevationGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (showElevation) {
|
||||
// Current elevation
|
||||
|
||||
@@ -219,10 +219,10 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/stats_elevation_gain_group"
|
||||
android:id="@+id/stats_elevation_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" />
|
||||
app:constraint_referenced_ids="stats_elevation_horizontal_line,stats_elevation_gain_label,stats_elevation_gain_value,stats_elevation_gain_unit" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stats_elevation_gain_label"
|
||||
|
||||
@@ -246,13 +246,14 @@
|
||||
app:layout_constraintRight_toLeftOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
|
||||
|
||||
<!-- Current elevation -->
|
||||
<!-- Elevation -->
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/stats_elevation_current_group"
|
||||
android:id="@+id/stats_elevation_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" />
|
||||
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
|
||||
android:id="@+id/stats_elevation_current_label"
|
||||
style="@style/StatsSmallLabel"
|
||||
@@ -281,11 +282,6 @@
|
||||
tools:text="m" />
|
||||
|
||||
<!-- 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
|
||||
android:id="@+id/stats_elevation_gain_label"
|
||||
|
||||
Reference in New Issue
Block a user