diff --git a/build.gradle b/build.gradle
index bcda3d8af..5bae6876b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -100,7 +100,7 @@ android {
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.preference:preference:1.1.0'
+ implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.documentfile:documentfile:1.0.1'
androidTestImplementation 'androidx.test:core:1.2.0'
@@ -114,4 +114,5 @@ dependencies {
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'org.mockito:mockito-core:3.0.0'
implementation 'com.google.android.material:material:1.1.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
diff --git a/doc/activities.txt b/doc/activities.txt
index 99034955e..ed5441481 100644
--- a/doc/activities.txt
+++ b/doc/activities.txt
@@ -16,7 +16,7 @@ TrackListActivity --> TrackRecordedActivity : Show track
TrackListActivity --> TrackDeleteActivity
SearchListActivity --> MarkerDetailActivity : Search result
-SearchListActivity --> TrackDetailActivity : Search result
+SearchListActivity --> TrackRecordedActivity : Search result
TrackRecordedActivity --> TrackDeleteActivity
TrackRecordedActivity --> TrackEditActivity
diff --git a/src/main/java/de/dennisguse/opentracks/fragments/StatisticsRecordingFragment.java b/src/main/java/de/dennisguse/opentracks/fragments/StatisticsRecordingFragment.java
index 8f523ee8f..2a1170d39 100644
--- a/src/main/java/de/dennisguse/opentracks/fragments/StatisticsRecordingFragment.java
+++ b/src/main/java/de/dennisguse/opentracks/fragments/StatisticsRecordingFragment.java
@@ -15,6 +15,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;
@@ -99,10 +100,11 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
}
/* Views */
- private View heartRateContainer;
+ private View sensorHorizontalLine;
+ private Group heartRateGroup;
private TextView heartRateValueView;
private TextView heartRateSensorView;
- private View cadenceContainer;
+ private Group cadenceGroup;
private TextView cadenceValueView;
private TextView cadenceSensorView;
@@ -133,16 +135,13 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
private TextView speedMovingLabel;
private TextView speedMovingValue;
private TextView speedMovingUnit;
- private View elevationSeparator;
- private View elevationContainer;
- private View speedContainer;
+ private Group elevationGroup;
private TextView speedLabel;
private TextView speedValue;
private TextView speedUnit;
private TextView elevationValue;
private TextView elevationUnit;
- private View coordinateSeparator;
- private View coordinateContainer;
+ private Group coordinateGroup;
private TextView latitudeValue;
private TextView longitudeValue;
@@ -150,11 +149,13 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- heartRateContainer = view.findViewById(R.id.stats_sensor_heart_rate_container);
+ sensorHorizontalLine = view.findViewById(R.id.stats_sensor_horizontal_line);
+
+ heartRateGroup = view.findViewById(R.id.stats_sensor_heart_rate_group);
heartRateValueView = view.findViewById(R.id.stats_sensor_heart_rate_value);
heartRateSensorView = view.findViewById(R.id.stats_sensor_heart_rate_sensor_value);
- cadenceContainer = view.findViewById(R.id.stats_sensor_cadence_container);
+ cadenceGroup = view.findViewById(R.id.stats_sensor_cadence_group);
cadenceValueView = view.findViewById(R.id.stats_sensor_cadence_value);
cadenceSensorView = view.findViewById(R.id.stats_sensor_cadence_sensor_value);
@@ -180,10 +181,8 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
speedMovingValue = view.findViewById(R.id.stats_moving_speed_value);
speedMovingUnit = view.findViewById(R.id.stats_moving_speed_unit);
- elevationSeparator = view.findViewById(R.id.stats_elevation_separator);
- elevationContainer = view.findViewById(R.id.stats_elevation_container);
+ elevationGroup = view.findViewById(R.id.stats_elevation_current_group);
- speedContainer = view.findViewById(R.id.stats_speed);
speedLabel = view.findViewById(R.id.stats_speed_label);
speedValue = view.findViewById(R.id.stats_speed_value);
speedUnit = view.findViewById(R.id.stats_speed_unit);
@@ -191,8 +190,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
elevationValue = view.findViewById(R.id.stats_elevation_current_value);
elevationUnit = view.findViewById(R.id.stats_elevation_current_unit);
- coordinateSeparator = view.findViewById(R.id.stats_coordinate_separator);
- coordinateContainer = view.findViewById(R.id.stats_coordinate_container);
+ coordinateGroup = view.findViewById(R.id.stats_coordinate_group);
latitudeValue = view.findViewById(R.id.stats_latitude_value);
longitudeValue = view.findViewById(R.id.stats_longitude_value);
@@ -261,10 +259,12 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
@Override
public void onDestroyView() {
super.onDestroyView();
- heartRateContainer = null;
+ sensorHorizontalLine = null;
+
+ heartRateGroup = null;
heartRateValueView = null;
heartRateSensorView = null;
- cadenceContainer = null;
+ cadenceGroup = null;
cadenceValueView = null;
cadenceSensorView = null;
@@ -290,10 +290,8 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
speedMovingValue = null;
speedMovingUnit = null;
- elevationSeparator = null;
- elevationContainer = null;
+ elevationGroup = null;
- speedContainer = null;
speedLabel = null;
speedValue = null;
speedUnit = null;
@@ -301,8 +299,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
elevationValue = null;
elevationUnit = null;
- coordinateSeparator = null;
- coordinateContainer = null;
+ coordinateGroup = null;
latitudeValue = null;
longitudeValue = null;
@@ -433,57 +430,65 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
sensorDataSet = trackRecordingService.getSensorData();
}
- setHeartRateSensorData(sensorDataSet, isSelectedTrackRecording());
- setCadenceSensorData(sensorDataSet, isSelectedTrackRecording());
+ setHeartRateSensorData(sensorDataSet);
+ setCadenceSensorData(sensorDataSet);
setSpeedSensorData(sensorDataSet, isSelectedTrackRecording());
}
- private void setHeartRateSensorData(SensorDataSet sensorDataSet, boolean isRecording) {
+ private void setHeartRateSensorData(SensorDataSet sensorDataSet) {
int isVisible = View.VISIBLE;
- if (!isRecording || PreferencesUtils.isBluetoothHeartRateSensorAddressNone(getContext())) {
- isVisible = View.INVISIBLE;
+ if (PreferencesUtils.isBluetoothHeartRateSensorAddressNone(getContext())) {
+ isVisible = View.GONE;
}
- heartRateContainer.setVisibility(isVisible);
+ heartRateGroup.setVisibility(isVisible);
+ setVisibilitySensorHorizontalLine();
- if (isRecording) {
- String sensorValue = getContext().getString(R.string.value_unknown);
- String sensorName = getContext().getString(R.string.value_unknown);
- if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) {
- SensorDataHeartRate data = sensorDataSet.getHeartRate();
+ String sensorValue = getContext().getString(R.string.value_unknown);
+ String sensorName = getContext().getString(R.string.value_unknown);
+ if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) {
+ SensorDataHeartRate data = sensorDataSet.getHeartRate();
- sensorName = data.getSensorName();
- if (data.hasHeartRate_bpm() && data.isRecent()) {
- sensorValue = StringUtils.formatDecimal(data.getHeartRate_bpm(), 0);
- }
+ sensorName = data.getSensorName();
+ if (data.hasHeartRate_bpm() && data.isRecent()) {
+ sensorValue = StringUtils.formatDecimal(data.getHeartRate_bpm(), 0);
}
-
- heartRateSensorView.setText(sensorName);
- heartRateValueView.setText(sensorValue);
}
+
+ heartRateSensorView.setText(sensorName);
+ heartRateValueView.setText(sensorValue);
}
- private void setCadenceSensorData(SensorDataSet sensorDataSet, boolean isRecording) {
+ private void setCadenceSensorData(SensorDataSet sensorDataSet) {
int isVisible = View.VISIBLE;
- if (!isRecording || PreferencesUtils.isBluetoothCyclingCadenceSensorAddressNone(getContext())) {
- isVisible = View.INVISIBLE;
+ if (PreferencesUtils.isBluetoothCyclingCadenceSensorAddressNone(getContext())) {
+ isVisible = View.GONE;
}
- cadenceContainer.setVisibility(isVisible);
+ cadenceGroup.setVisibility(isVisible);
+ setVisibilitySensorHorizontalLine();
- if (isRecording) {
- String sensorValue = getContext().getString(R.string.value_unknown);
- String sensorName = getContext().getString(R.string.value_unknown);
- if (sensorDataSet != null && sensorDataSet.getCyclingCadence() != null) {
- SensorDataCycling.Cadence data = sensorDataSet.getCyclingCadence();
- sensorName = data.getSensorName();
+ String sensorValue = getContext().getString(R.string.value_unknown);
+ String sensorName = getContext().getString(R.string.value_unknown);
+ if (sensorDataSet != null && sensorDataSet.getCyclingCadence() != null) {
+ SensorDataCycling.Cadence data = sensorDataSet.getCyclingCadence();
+ sensorName = data.getSensorName();
- if (data.hasCadence_rpm() && data.isRecent()) {
- sensorValue = StringUtils.formatDecimal(data.getCadence_rpm(), 0);
- }
+ if (data.hasCadence_rpm() && data.isRecent()) {
+ sensorValue = StringUtils.formatDecimal(data.getCadence_rpm(), 0);
}
-
- cadenceSensorView.setText(sensorName);
- cadenceValueView.setText(sensorValue);
}
+
+ cadenceSensorView.setText(sensorName);
+ cadenceValueView.setText(sensorValue);
+ }
+
+ /**
+ * If cadence and hear rate groups are invisible then sensor horizontal line hast to be invisible too.
+ */
+ private void setVisibilitySensorHorizontalLine() {
+ if (cadenceGroup.getVisibility() != View.VISIBLE && heartRateGroup.getVisibility() != View.VISIBLE) {
+ sensorHorizontalLine.setVisibility(View.GONE);
+ }
+
}
private void setSpeedSensorData(SensorDataSet sensorDataSet, boolean isRecording) {
@@ -566,7 +571,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
// Make elevation visible?
{
boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
- elevationSeparator.setVisibility(showElevation ? View.VISIBLE : View.GONE);
+ elevationGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
}
}
@@ -595,18 +600,14 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
private void setLocationValues() {
boolean metricUnits = PreferencesUtils.isMetricUnits(getContext());
- boolean isRecording = isSelectedTrackRecording();
// Set speed/pace
- speedContainer.setVisibility(isRecording ? View.VISIBLE : View.INVISIBLE);
- if (isRecording) {
- double speed = lastTrackPoint != null && lastTrackPoint.hasSpeed() ? lastTrackPoint.getSpeed() : Double.NaN;
- setSpeed(speed);
- }
+ double speed = lastTrackPoint != null && lastTrackPoint.hasSpeed() ? lastTrackPoint.getSpeed() : Double.NaN;
+ setSpeed(speed);
// Set elevation
- boolean showElevation = isRecording && PreferencesUtils.isShowStatsElevation(getContext());
- elevationContainer.setVisibility(showElevation ? View.VISIBLE : View.GONE);
+ boolean showElevation = PreferencesUtils.isShowStatsElevation(getContext());
+ elevationGroup.setVisibility(showElevation ? View.VISIBLE : View.GONE);
if (showElevation) {
double altitude = lastTrackPoint != null && lastTrackPoint.hasAltitude() ? lastTrackPoint.getAltitude() : Double.NaN;
@@ -617,10 +618,9 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
}
// Set coordinate
- boolean showCoordinate = isRecording && PreferencesUtils.isStatsShowCoordinate(getContext());
+ boolean showCoordinate = PreferencesUtils.isStatsShowCoordinate(getContext());
- coordinateSeparator.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
- coordinateContainer.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
+ coordinateGroup.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
if (showCoordinate) {
double latitude = lastTrackPoint != null ? lastTrackPoint.getLatitude() : Double.NaN;
String latitudeText = Double.isNaN(latitude) || Double.isInfinite(latitude) ? getContext().getString(R.string.value_unknown) : StringUtils.formatCoordinate(latitude);
diff --git a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java
index 1ef508f6b..1c1d3d0bd 100644
--- a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java
+++ b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java
@@ -42,7 +42,7 @@ import java.util.concurrent.Executors;
import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.TrackListActivity;
-import de.dennisguse.opentracks.TrackRecordedActivity;
+import de.dennisguse.opentracks.TrackRecordingActivity;
import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.data.TrackPoint;
import de.dennisguse.opentracks.content.data.Waypoint;
@@ -743,10 +743,10 @@ public class TrackRecordingService extends Service {
private void showNotification(boolean isGpsStarted) {
if (isRecording()) {
- Intent intent = IntentUtils.newIntent(this, TrackRecordedActivity.class)
- .putExtra(TrackRecordedActivity.EXTRA_TRACK_ID, recordingTrackId);
+ Intent intent = IntentUtils.newIntent(this, TrackRecordingActivity.class)
+ .putExtra(TrackRecordingActivity.EXTRA_TRACK_ID, recordingTrackId);
PendingIntent pendingIntent = TaskStackBuilder.create(this)
- .addParentStack(TrackRecordedActivity.class)
+ .addParentStack(TrackRecordingActivity.class)
.addNextIntent(intent)
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
diff --git a/src/main/res/layout/statistics_recorded.xml b/src/main/res/layout/statistics_recorded.xml
index e0762af3b..0be5a6019 100644
--- a/src/main/res/layout/statistics_recorded.xml
+++ b/src/main/res/layout/statistics_recorded.xml
@@ -1,177 +1,213 @@
-
+
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:id="@+id/stats_speed_horizontal_line"
+ style="@style/StatsHorizontalLine"
+ android:layout_marginBottom="8dp"
+ app:layout_constraintLeft_toRightOf="@+id/guideline"
+ app:layout_constraintRight_toLeftOf="@+id/guideline3"
+ app:layout_constraintTop_toBottomOf="@+id/stats_moving_time_value" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/statistics_recording.xml b/src/main/res/layout/statistics_recording.xml
index 2c764fdb0..aabd699cd 100644
--- a/src/main/res/layout/statistics_recording.xml
+++ b/src/main/res/layout/statistics_recording.xml
@@ -1,318 +1,430 @@
-
+ android:layout_height="wrap_content">
-
-
-
-
+
+
-
+
-
+
-
+
+
-
-
-
+
-
-
-
+
-
-
+
+
-
-
+
-
+
+
-
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ android:id="@+id/stats_speed_horizontal_line"
+ style="@style/StatsHorizontalLine"
+ android:layout_marginBottom="8dp"
+ app:layout_constraintLeft_toRightOf="@+id/guideline"
+ app:layout_constraintRight_toLeftOf="@+id/guideline3"
+ app:layout_constraintTop_toBottomOf="@+id/stats_moving_time_value" />
-
-
+
+
-
+
-
+
-
+
+
-
+
-
+
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+ android:id="@+id/stats_elevation_horizontal_line"
+ style="@style/StatsHorizontalLine"
+ android:layout_marginBottom="8dp"
+ app:layout_constraintLeft_toRightOf="@+id/guideline"
+ app:layout_constraintRight_toLeftOf="@+id/guideline3"
+ app:layout_constraintTop_toBottomOf="@+id/stats_moving_speed_value" />
-
-
+
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
-
+
-
+
+
-
+
-
+
+
-
+
+
-
+
-
+
-
+
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml
index 326cbb156..a1a9bc2ce 100644
--- a/src/main/res/values/styles.xml
+++ b/src/main/res/values/styles.xml
@@ -117,8 +117,7 @@ limitations under the License.
@@ -140,6 +139,9 @@ limitations under the License.
- true
- @color/stats_large_label
- bold
+ - 4dp
+ - 4dp
+ - 16dp