mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-09-30 16:52:21 +02:00
Cleanup: removed SensorConnector interface.
Preparation for refactoring.
This commit is contained in:
@@ -34,7 +34,7 @@ import de.dennisguse.opentracks.settings.PreferencesUtils;
|
||||
* TODO: listen for Bluetooth enabled/disabled events.
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class BluetoothRemoteSensorManager implements SensorConnector, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public class BluetoothRemoteSensorManager implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private static final String TAG = BluetoothRemoteSensorManager.class.getSimpleName();
|
||||
|
||||
@@ -62,16 +62,14 @@ public class BluetoothRemoteSensorManager implements SensorConnector, SharedPref
|
||||
this.runningSpeedAndCadence = new BluetoothConnectionManager(bluetoothAdapter, observer, new BluetoothHandlerRunningSpeedAndCadence());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Context context, Handler handler) {
|
||||
public void start() {
|
||||
started = true;
|
||||
|
||||
// Triggers connection startup
|
||||
onSharedPreferenceChanged(null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void stop(Context context) {
|
||||
public synchronized void stop() {
|
||||
heartRate.disconnect();
|
||||
temperature.disconnect();
|
||||
cyclingCadence.disconnect();
|
||||
|
||||
@@ -13,7 +13,7 @@ import de.dennisguse.opentracks.settings.PreferencesUtils;
|
||||
/**
|
||||
* Estimates the altitude gain and altitude loss using the device's pressure sensor (i.e., barometer).
|
||||
*/
|
||||
public class GainManager implements SensorConnector {
|
||||
public class GainManager {
|
||||
|
||||
private static final String TAG = GainManager.class.getSimpleName();
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GainManager implements SensorConnector {
|
||||
PreferencesUtils.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||
}
|
||||
|
||||
public void stop(Context context) {
|
||||
public void stop() {
|
||||
Log.d(TAG, "Stop");
|
||||
this.context = null;
|
||||
this.handler = null;
|
||||
|
||||
@@ -26,7 +26,7 @@ import de.dennisguse.opentracks.settings.PreferencesUtils;
|
||||
import de.dennisguse.opentracks.util.PermissionRequester;
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
|
||||
public class GpsManager implements SensorConnector, LocationListenerCompat, GpsStatusManager.GpsStatusListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public class GpsManager implements LocationListenerCompat, GpsStatusManager.GpsStatusListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private final String TAG = GpsManager.class.getSimpleName();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GpsManager implements SensorConnector, LocationListenerCompat, GpsS
|
||||
}
|
||||
|
||||
@SuppressWarnings({"MissingPermission"})
|
||||
public void stop(Context context) {
|
||||
public void stop() {
|
||||
if (isStarted()) {
|
||||
LocationManagerCompat.removeUpdates(locationManager, this);
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package de.dennisguse.opentracks.sensors;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
|
||||
public interface SensorConnector {
|
||||
|
||||
void start(Context context, Handler handler);
|
||||
|
||||
void stop(Context context);
|
||||
}
|
||||
@@ -85,19 +85,19 @@ public class SensorManager implements SharedPreferences.OnSharedPreferenceChange
|
||||
|
||||
gpsManager.start(context, handler);
|
||||
altitudeSumManager.start(context, handler);
|
||||
bluetoothSensorManager.start(context, handler);
|
||||
bluetoothSensorManager.start();
|
||||
}
|
||||
|
||||
public void stop(Context context) {
|
||||
wakeLock = SystemUtils.releaseWakeLock(wakeLock);
|
||||
|
||||
bluetoothSensorManager.stop(context);
|
||||
bluetoothSensorManager.stop();
|
||||
bluetoothSensorManager = null;
|
||||
|
||||
altitudeSumManager.stop(context);
|
||||
altitudeSumManager.stop();
|
||||
altitudeSumManager = null;
|
||||
|
||||
gpsManager.stop(context);
|
||||
gpsManager.stop();
|
||||
gpsManager = null;
|
||||
|
||||
sensorDataAggregator.clear();
|
||||
|
||||
Reference in New Issue
Block a user