forked from upstream-mirrors/OpenTracks
Code cleanup.
This commit is contained in:
@@ -33,14 +33,11 @@ import androidx.test.rule.ServiceTestRule;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.TemporalUnit;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -38,7 +38,7 @@ class ExecutorListViewService<T> {
|
||||
}
|
||||
|
||||
new Thread(() -> {
|
||||
Future future = executorService.submit(runnable);
|
||||
Future<?> future = executorService.submit(runnable);
|
||||
try {
|
||||
future.get();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MarkerResourceCursorAdapter extends ResourceCursorAdapter implement
|
||||
private final Activity activity;
|
||||
|
||||
//TODO Should be Marker.Id
|
||||
private final ExecutorListViewService<Long> executorService = new ExecutorListViewService<Long>(LIST_PREFERRED_ITEM_HEIGHT_DEFAULT);
|
||||
private final ExecutorListViewService<Long> executorService = new ExecutorListViewService<>(LIST_PREFERRED_ITEM_HEIGHT_DEFAULT);
|
||||
|
||||
private boolean scroll = false;
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ public class ChartView extends View {
|
||||
Optional<ChartPoint> lastValid = chartPoints.stream().filter(chartValueSeries::isChartPointValid)
|
||||
.reduce((first, second) -> second);
|
||||
|
||||
if (firstValid.isPresent()) {
|
||||
if (firstValid.isPresent() && lastValid.isPresent()) {
|
||||
Path path = chartValueSeries.getPath();
|
||||
|
||||
int yCorner = topBorder + effectiveHeight;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class KmzTrackImporter implements TrackImporter {
|
||||
for (Track.Id trackId : trackIds) {
|
||||
if (copyKmzImages(trackId)) {
|
||||
trackIdsWithImages.add(trackId);
|
||||
deleteOrphanImages(context, trackId);
|
||||
deleteOrphanImages(trackId);
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -199,10 +199,9 @@ public class KmzTrackImporter implements TrackImporter {
|
||||
/**
|
||||
* Deletes all images that remained in external storage that doesn't have a marker associated.
|
||||
*
|
||||
* @param context the Context object.
|
||||
* @param trackId the id of the Track.
|
||||
*/
|
||||
private void deleteOrphanImages(Context context, Track.Id trackId) {
|
||||
private void deleteOrphanImages(Track.Id trackId) {
|
||||
// 1.- Gets all photo names in the markers of the track identified by id.
|
||||
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
|
||||
List<Marker> markers = contentProviderUtils.getMarkers(trackId);
|
||||
|
||||
+2
-3
@@ -93,9 +93,8 @@ public class BluetoothRemoteSensorManager implements BluetoothConnectionManager.
|
||||
connect(cyclingPower, address);
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(context, R.string.settings_sensor_bluetooth_cycling_power_key, key)) {
|
||||
if (PreferencesUtils.isKey(context, R.string.settings_sensor_bluetooth_cycling_speed_wheel_circumference_key, key)) {
|
||||
preferenceWheelCircumference = PreferencesUtils.getWheelCircumference(sharedPreferences, context);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -185,7 +184,7 @@ public class BluetoothRemoteSensorManager implements BluetoothConnectionManager.
|
||||
Log.d(TAG, "onChanged: speed data repeated.");
|
||||
return;
|
||||
}
|
||||
((SensorDataCycling.DistanceSpeed) sensorData).compute(previous, PreferencesUtils.getWheelCircumference(sharedPreferences, context));
|
||||
((SensorDataCycling.DistanceSpeed) sensorData).compute(previous, preferenceWheelCircumference);
|
||||
}
|
||||
|
||||
sensorDataSet.set(sensorData);
|
||||
|
||||
Reference in New Issue
Block a user