Cleanup: move marker creation to MarkerEditActivity.

This commit is contained in:
Dennis Guse
2024-01-13 00:31:48 +01:00
parent f3e8d033cc
commit 1ae18836cb
2 changed files with 19 additions and 30 deletions
@@ -24,15 +24,11 @@ import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import de.dennisguse.opentracks.BuildConfig;
import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.data.models.Marker;
/**
* Wrapper for the track recording service.
@@ -125,28 +121,6 @@ public class TrackRecordingServiceConnection {
}
}
//TODO Move to some other place; not needed here.
@Nullable
public Marker.Id addMarker(Context context, String name, String category, String description, String photoUrl) {
if (trackRecordingService == null) {
Log.d(TAG, "Unable to add marker, no track recording service");
return null;
}
try {
Marker.Id marker = trackRecordingService.insertMarker(name, category, description, photoUrl);
if (marker == null) {
Toast.makeText(context, R.string.marker_add_error, Toast.LENGTH_LONG).show();
return null;
}
return marker;
} catch (IllegalStateException e) {
Log.e(TAG, "Unable to add marker.", e);
return null;
}
}
public void stopRecording(@NonNull Context context) {
if (trackRecordingService == null) {
Log.e(TAG, "TrackRecordingService not connected.");