forked from upstream-mirrors/OpenTracks
Several hidden bugfixes around Track.Id
This commit is contained in:
@@ -415,7 +415,7 @@ public class SearchListActivity extends AbstractListActivity implements DeleteMa
|
|||||||
String icon = track.getIcon();
|
String icon = track.getIcon();
|
||||||
String category = icon != null && !icon.equals("") ? null : track.getCategory();
|
String category = icon != null && !icon.equals("") ? null : track.getCategory();
|
||||||
|
|
||||||
resultMap.put(IS_RECORDING_FIELD, track.getId() == recordingTrackId);
|
resultMap.put(IS_RECORDING_FIELD, track.getId().equals(recordingTrackId));
|
||||||
resultMap.put(IS_PAUSED_FIELD, recordingTrackPaused);
|
resultMap.put(IS_PAUSED_FIELD, recordingTrackPaused);
|
||||||
resultMap.put(ICON_ID_FIELD, TrackIconUtils.getIconDrawable(icon));
|
resultMap.put(ICON_ID_FIELD, TrackIconUtils.getIconDrawable(icon));
|
||||||
resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.image_track);
|
resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.image_track);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
|
|||||||
contentProviderUtils = new ContentProviderUtils(this);
|
contentProviderUtils = new ContentProviderUtils(this);
|
||||||
track = contentProviderUtils.getTrack(trackId);
|
track = contentProviderUtils.getTrack(trackId);
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Log.e(TAG, "No track for " + trackId);
|
Log.e(TAG, "No track for " + trackId.getId());
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ public class SearchEngine {
|
|||||||
score *= getTimeBoost(query, meanTimestamp);
|
score *= getTimeBoost(query, meanTimestamp);
|
||||||
|
|
||||||
// Score the currently-selected track lower (user is already there, wouldn't be searching for it).
|
// Score the currently-selected track lower (user is already there, wouldn't be searching for it).
|
||||||
if (track.getId() == query.currentTrackId) {
|
if (track.getId().equals(query.currentTrackId)) {
|
||||||
score *= CURRENT_TRACK_DEMOTION;
|
score *= CURRENT_TRACK_DEMOTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -231,7 +231,7 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
|
|||||||
trackId = new Track.Id(Long.parseLong(uri.getLastPathSegment()));
|
trackId = new Track.Id(Long.parseLong(uri.getLastPathSegment()));
|
||||||
} else {
|
} else {
|
||||||
if (trackIds.size() > 0) {
|
if (trackIds.size() > 0) {
|
||||||
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.getId()));
|
||||||
}
|
}
|
||||||
trackId = importTrackId;
|
trackId = importTrackId;
|
||||||
contentProviderUtils.clearTrack(trackId);
|
contentProviderUtils.clearTrack(trackId);
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ public class TrackRecordingService extends Service implements HandlerServer.Hand
|
|||||||
void resumeTrack(Track.Id trackId) {
|
void resumeTrack(Track.Id trackId) {
|
||||||
Track track = contentProviderUtils.getTrack(trackId);
|
Track track = contentProviderUtils.getTrack(trackId);
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Log.e(TAG, "Ignore resumeTrack. Track " + trackId + " does not exists.");
|
Log.e(TAG, "Ignore resumeTrack. Track " + trackId.getId() + " does not exists.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ public class TrackRecordingService extends Service implements HandlerServer.Hand
|
|||||||
Track track = contentProviderUtils.getTrack(recordingTrackId);
|
Track track = contentProviderUtils.getTrack(recordingTrackId);
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
if (isRecording()) {
|
if (isRecording()) {
|
||||||
Log.w(TAG, "track is null, but recordingTrackId not -1L. " + recordingTrackId);
|
Log.w(TAG, "track is null, but recordingTrackId not -1L. " + recordingTrackId.getId());
|
||||||
updateRecordingState(null, true);
|
updateRecordingState(null, true);
|
||||||
}
|
}
|
||||||
showNotification(false);
|
showNotification(false);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class IntentUtils {
|
|||||||
for (Track.Id trackId : trackIds) {
|
for (Track.Id trackId : trackIds) {
|
||||||
Track track = contentProviderUtils.getTrack(trackId);
|
Track track = contentProviderUtils.getTrack(trackId);
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Log.e(TAG, "TrackId " + trackId + " could not be resolved.");
|
Log.e(TAG, "TrackId " + trackId.getId() + " could not be resolved.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user