forked from upstream-mirrors/OpenTracks
Cleanup using IntelliJ's analyze code.
This commit is contained in:
@@ -94,11 +94,10 @@ public class TestDataUtil {
|
|||||||
* @return the Waypoint created.
|
* @return the Waypoint created.
|
||||||
*/
|
*/
|
||||||
public static Waypoint createWaypointWithPhoto(Context context, long trackId, Location location) throws IOException {
|
public static Waypoint createWaypointWithPhoto(Context context, long trackId, Location location) throws IOException {
|
||||||
String photoUrl = "";
|
|
||||||
File dstFile = new File(FileUtils.getImageUrl(context, trackId));
|
File dstFile = new File(FileUtils.getImageUrl(context, trackId));
|
||||||
dstFile.createNewFile();
|
dstFile.createNewFile();
|
||||||
Uri photoUri = FileUtils.getUriForFile(context, dstFile);
|
Uri photoUri = FileUtils.getUriForFile(context, dstFile);
|
||||||
photoUrl = photoUri.toString();
|
String photoUrl = photoUri.toString();
|
||||||
|
|
||||||
return new Waypoint("Waypoint name", "Waypoint description", "Waypoint category", "", trackId, 0.0, 0, location, photoUrl);
|
return new Waypoint("Waypoint name", "Waypoint description", "Waypoint category", "", trackId, 0.0, 0, location, photoUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package de.dennisguse.opentracks;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -30,7 +29,7 @@ public class AboutActivity extends AbstractActivity {
|
|||||||
TextView textURL = findViewById(R.id.about_app_url);
|
TextView textURL = findViewById(R.id.about_app_url);
|
||||||
textURL.setText(getString(R.string.about_url, getString(R.string.app_web_url)));
|
textURL.setText(getString(R.string.about_url, getString(R.string.app_web_url)));
|
||||||
|
|
||||||
ViewUtils.makeClickableLinks((ViewGroup) findViewById(android.R.id.content));
|
ViewUtils.makeClickableLinks(findViewById(android.R.id.content));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getLayoutResId() {
|
protected int getLayoutResId() {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package de.dennisguse.opentracks;
|
package de.dennisguse.opentracks;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ public class HelpActivity extends AbstractActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
ViewUtils.makeClickableLinks((ViewGroup) findViewById(android.R.id.content));
|
ViewUtils.makeClickableLinks(findViewById(android.R.id.content));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@@ -27,10 +26,8 @@ import de.dennisguse.opentracks.content.provider.ContentProviderUtils;
|
|||||||
import de.dennisguse.opentracks.fragments.ChartFragment;
|
import de.dennisguse.opentracks.fragments.ChartFragment;
|
||||||
import de.dennisguse.opentracks.fragments.ChooseActivityTypeDialogFragment;
|
import de.dennisguse.opentracks.fragments.ChooseActivityTypeDialogFragment;
|
||||||
import de.dennisguse.opentracks.fragments.StatisticsRecordingFragment;
|
import de.dennisguse.opentracks.fragments.StatisticsRecordingFragment;
|
||||||
import de.dennisguse.opentracks.services.TrackRecordingServiceCallback;
|
|
||||||
import de.dennisguse.opentracks.services.TrackRecordingServiceConnection;
|
import de.dennisguse.opentracks.services.TrackRecordingServiceConnection;
|
||||||
import de.dennisguse.opentracks.services.TrackRecordingServiceInterface;
|
import de.dennisguse.opentracks.services.TrackRecordingServiceInterface;
|
||||||
import de.dennisguse.opentracks.services.handlers.GpsStatusValue;
|
|
||||||
import de.dennisguse.opentracks.settings.SettingsActivity;
|
import de.dennisguse.opentracks.settings.SettingsActivity;
|
||||||
import de.dennisguse.opentracks.util.IntentDashboardUtils;
|
import de.dennisguse.opentracks.util.IntentDashboardUtils;
|
||||||
import de.dennisguse.opentracks.util.IntentUtils;
|
import de.dennisguse.opentracks.util.IntentUtils;
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ public class ContentProviderUtils {
|
|||||||
*
|
*
|
||||||
* @param trackId the track id
|
* @param trackId the track id
|
||||||
*/
|
*/
|
||||||
public void clearTrack(Context context, long trackId) {
|
public void clearTrack(long trackId) {
|
||||||
deleteTrackPointsAndWaypoints(context, trackId);
|
deleteTrackPointsAndWaypoints(trackId);
|
||||||
Track track = new Track();
|
Track track = new Track();
|
||||||
track.setId(trackId);
|
track.setId(trackId);
|
||||||
updateTrack(track);
|
updateTrack(track);
|
||||||
@@ -185,7 +185,7 @@ public class ContentProviderUtils {
|
|||||||
* @param trackId the track id
|
* @param trackId the track id
|
||||||
*/
|
*/
|
||||||
public void deleteTrack(Context context, long trackId) {
|
public void deleteTrack(Context context, long trackId) {
|
||||||
deleteTrackPointsAndWaypoints(context, trackId);
|
deleteTrackPointsAndWaypoints(trackId);
|
||||||
|
|
||||||
// Delete track folder resources.
|
// Delete track folder resources.
|
||||||
FileUtils.deleteDirectoryRecurse(FileUtils.getPhotoDir(context, trackId));
|
FileUtils.deleteDirectoryRecurse(FileUtils.getPhotoDir(context, trackId));
|
||||||
@@ -199,12 +199,11 @@ public class ContentProviderUtils {
|
|||||||
*
|
*
|
||||||
* @param trackId the track id
|
* @param trackId the track id
|
||||||
*/
|
*/
|
||||||
private void deleteTrackPointsAndWaypoints(Context context, long trackId) {
|
private void deleteTrackPointsAndWaypoints(long trackId) {
|
||||||
String where = TrackPointsColumns.TRACKID + "=?";
|
|
||||||
String[] selectionArgs = new String[]{Long.toString(trackId)};
|
String[] selectionArgs = new String[]{Long.toString(trackId)};
|
||||||
contentResolver.delete(TrackPointsColumns.CONTENT_URI_BY_ID, where, selectionArgs);
|
|
||||||
|
|
||||||
contentResolver.delete(WaypointsColumns.CONTENT_URI, WaypointsColumns.TRACKID + "=?", new String[]{Long.toString(trackId)});
|
contentResolver.delete(TrackPointsColumns.CONTENT_URI_BY_ID, TrackPointsColumns.TRACKID + "=?", selectionArgs);
|
||||||
|
contentResolver.delete(WaypointsColumns.CONTENT_URI, WaypointsColumns.TRACKID + "=?", selectionArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public class ShareContentProvider extends CustomContentProvider implements ICont
|
|||||||
|
|
||||||
final TrackExporter trackExporter = getTrackFileFormat(uri).newTrackExporter(getContext(), tracks);
|
final TrackExporter trackExporter = getTrackFileFormat(uri).newTrackExporter(getContext(), tracks);
|
||||||
|
|
||||||
PipeDataWriter<String> pipeDataWriter = (PipeDataWriter<String>) (output, uri1, mimeType, opts, args) -> {
|
PipeDataWriter<String> pipeDataWriter = (output, uri1, mimeType, opts, args) -> {
|
||||||
try (FileOutputStream fileOutputStream = new FileOutputStream(output.getFileDescriptor())) {
|
try (FileOutputStream fileOutputStream = new FileOutputStream(output.getFileDescriptor())) {
|
||||||
trackExporter.writeTrack(getContext(), fileOutputStream);
|
trackExporter.writeTrack(getContext(), fileOutputStream);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
+1
-1
@@ -234,7 +234,7 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
|
|||||||
throw new SAXException(createErrorMessage("Cannot import more than one track to an existing track " + importTrackId));
|
throw new SAXException(createErrorMessage("Cannot import more than one track to an existing track " + importTrackId));
|
||||||
}
|
}
|
||||||
trackId = importTrackId;
|
trackId = importTrackId;
|
||||||
contentProviderUtils.clearTrack(context, trackId);
|
contentProviderUtils.clearTrack(trackId);
|
||||||
}
|
}
|
||||||
trackIds.add(trackId);
|
trackIds.add(trackId);
|
||||||
trackData.track.setId(trackId);
|
trackData.track.setId(trackId);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class GpsStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Handler gpsStatusHandler = null;
|
private Handler gpsStatusHandler;
|
||||||
private GpsStatusRunner gpsStatusRunner = null;
|
private GpsStatusRunner gpsStatusRunner = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import android.os.Vibrator;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.AbsListView;
|
import android.widget.AbsListView;
|
||||||
|
|||||||
@@ -66,10 +66,6 @@ public class UnitConversions {
|
|||||||
// multiplication factor to convert meters per second to kilometers per hour
|
// multiplication factor to convert meters per second to kilometers per hour
|
||||||
public static final double MPS_TO_KMH = M_TO_KM / (S_TO_MIN * MIN_TO_HR);
|
public static final double MPS_TO_KMH = M_TO_KM / (S_TO_MIN * MIN_TO_HR);
|
||||||
|
|
||||||
// Others
|
|
||||||
// multiplication factor to convert degrees to radians
|
|
||||||
public static final double DEG_TO_RAD = Math.PI / 180.0;
|
|
||||||
|
|
||||||
private UnitConversions() {
|
private UnitConversions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user