mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-03 09:53:06 +02:00
@@ -15,6 +15,7 @@ public class StartRecording extends AbstractAPIActivity {
|
||||
|
||||
public static final String EXTRA_TRACK_NAME = "TRACK_NAME";
|
||||
public static final String EXTRA_TRACK_CATEGORY = "TRACK_CATEGORY";
|
||||
public static final String EXTRA_TRACK_ICON = "TRACK_ICON";
|
||||
public static final String EXTRA_TRACK_DESCRIPTION = "TRACK_DESCRIPTION";
|
||||
|
||||
public static final String EXTRA_STATS_TARGET_PACKAGE = "STATS_TARGET_PACKAGE";
|
||||
@@ -40,8 +41,11 @@ public class StartRecording extends AbstractAPIActivity {
|
||||
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(this);
|
||||
Track track = contentProviderUtils.getTrack(trackId);
|
||||
|
||||
TrackUtils.updateTrack(this, track, bundle.getString(EXTRA_TRACK_NAME, null),
|
||||
bundle.getString(EXTRA_TRACK_CATEGORY, null), bundle.getString(EXTRA_TRACK_DESCRIPTION, null),
|
||||
TrackUtils.updateTrack(this, track,
|
||||
bundle.getString(EXTRA_TRACK_NAME, null),
|
||||
bundle.getString(EXTRA_TRACK_CATEGORY, null),
|
||||
bundle.getString(EXTRA_TRACK_ICON, null),
|
||||
bundle.getString(EXTRA_TRACK_DESCRIPTION, null),
|
||||
contentProviderUtils);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,17 @@ import de.dennisguse.opentracks.data.models.Track;
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
@Deprecated //TODO Refactor: all this should happen somewhere else (ContentProviderUtils?)
|
||||
public class TrackUtils {
|
||||
|
||||
private TrackUtils() {
|
||||
}
|
||||
|
||||
public static void updateTrack(Context context, Track track, String name, String category, String description, ContentProviderUtils contentProviderUtils) {
|
||||
updateTrack(context, track, name, category, TrackIconUtils.getIconValue(context, category), description, contentProviderUtils);
|
||||
}
|
||||
|
||||
public static void updateTrack(Context context, Track track, String name, String category, String iconValue, String description, ContentProviderUtils contentProviderUtils) {
|
||||
boolean update = false;
|
||||
if (name != null) {
|
||||
track.setName(name);
|
||||
@@ -39,9 +44,13 @@ public class TrackUtils {
|
||||
}
|
||||
if (category != null) {
|
||||
track.setCategory(category);
|
||||
track.setIcon(TrackIconUtils.getIconValue(context, category));
|
||||
update = true;
|
||||
}
|
||||
if (iconValue != null) {
|
||||
track.setIcon(iconValue);
|
||||
} else if (category != null){
|
||||
track.setIcon(TrackIconUtils.getIconValue(context, category));
|
||||
}
|
||||
if (description != null) {
|
||||
track.setDescription(description);
|
||||
update = true;
|
||||
|
||||
Reference in New Issue
Block a user