Code cleanup using AndroidStudio.

This commit is contained in:
Dennis Guse
2020-12-13 17:30:51 +01:00
parent 96371336f4
commit 55fa6d2d79
6 changed files with 7 additions and 31 deletions
@@ -66,7 +66,7 @@ public class TestDataUtil {
trackPoint.setAccuracy((float) i / 100.0f);
trackPoint.setAltitude(i * ALTITUDE_INTERVAL);
trackPoint.setTime(i + 1);
trackPoint.setSpeed(5f + (i / 10));
trackPoint.setSpeed(5f + (i / 10f));
trackPoint.setHeartRate_bpm(100f + i);
trackPoint.setCyclingCadence_rpm(300f + i);
@@ -198,7 +198,7 @@ public class CustomContentProviderUtilsTest {
when(cursorMock.isNull(columnIndex)).thenReturn(false);
when(cursorMock.getString(columnIndex)).thenReturn(name);
Track track = contentProviderUtils.createTrack(cursorMock);
Track track = ContentProviderUtils.createTrack(cursorMock);
assertEquals(trackId, track.getId());
assertEquals(name, track.getName());
}
@@ -380,16 +380,6 @@ public class CustomContentProviderUtilsTest {
assertEquals(trackId, allTracks.get(allTracks.size() - 1).getId());
}
/**
* Tests the method {@link ContentProviderUtils#getLastTrack()}
*/
@Test
public void testGetLastTrack() {
Track.Id trackId = new Track.Id(System.currentTimeMillis());
contentProviderUtils.insertTrack(TestDataUtil.createTrack(trackId));
assertEquals(trackId, contentProviderUtils.getLastTrack().getId());
}
/**
* Tests the method {@link ContentProviderUtils#getTrack(Track.Id)}
*/
@@ -203,7 +203,6 @@ public class ContentProviderUtils {
contentResolver.delete(MarkerColumns.CONTENT_URI, MarkerColumns.TRACKID + "=?", selectionArgs);
}
@VisibleForTesting
public List<Track> getTracks() {
ArrayList<Track> tracks = new ArrayList<>();
try (Cursor cursor = getTrackCursor(null, null, TracksColumns._ID)) {
@@ -217,19 +216,6 @@ public class ContentProviderUtils {
return tracks;
}
@Deprecated
//TODO Do not use; rather get the proper TrackId (e.g., resume a track might give you some weird effects).
@VisibleForTesting
public Track getLastTrack() {
try (Cursor cursor = getTrackCursor(null, null, TracksColumns.STARTTIME + " DESC")) {
// Using the same order as shown in the track list
if (cursor != null && cursor.moveToNext()) {
return createTrack(cursor);
}
}
return null;
}
/**
* @param trackId the track id.
*/
@@ -58,7 +58,7 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment implements
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
viewBinding = ChooseActivityTypeBinding.inflate(inflater, container, false);
List<Integer> imageIds = new ArrayList<>();
@@ -54,14 +54,14 @@ public class ErrorListDialog extends DialogFragment {
outState.putStringArrayList(EXTRA_ERROR_LIST, errorList);
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final String[] tracks = errorList.stream().toArray(String[]::new);
final String[] tracks = errorList.toArray(new String[0]);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity())
.setTitle(title)
.setItems(tracks, null)
.setPositiveButton(R.string.generic_ok, (dialog, which) -> dismiss());
AlertDialog dialog = alertDialogBuilder.create();
return dialog;
return alertDialogBuilder.create();
}
}
+1 -1
View File
@@ -29,5 +29,5 @@
android:name="fade_out_circle"
android:fillAlpha="0.0"
android:fillColor="#a31a1f"
android:pathData="M62.5,62.5m-0,-62a50,50 0,1 1,-0 123a50,50 0,1 1,-0 -123"></path>
android:pathData="M62.5,62.5m-0,-62a50,50 0,1 1,-0 123a50,50 0,1 1,-0 -123" />
</vector>