mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Merge heads
This commit is contained in:
@@ -1,14 +1,5 @@
|
||||
#Tue Jul 17 10:23:25 PDT 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
@@ -17,7 +8,6 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
@@ -74,7 +64,6 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field.count_dependent=1585|-1|1585
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.location.Location;
|
||||
@@ -126,28 +128,28 @@ public interface MyTracksProviderUtils {
|
||||
|
||||
/**
|
||||
* Gets the first waypoint id for a track. The first waypoint is special as it
|
||||
* contains the stats for the current segment. Returns -1L if it doesn't
|
||||
* exist.
|
||||
* contains the stats for the track. Returns -1L if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getFirstWaypointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last statistics waypoint for a track. Returns null if it doesn't exist.
|
||||
* Gets the last waypoint for a type. Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param waypointType the waypoint type
|
||||
*/
|
||||
public Waypoint getLastStatisticsWaypoint(long trackId);
|
||||
public Waypoint getLastWaypoint(long trackId, WaypointType waypointType);
|
||||
|
||||
/**
|
||||
* Gets the next waypoint number. Returns -1 if not able to get the next
|
||||
* Gets the next waypoint number for a type. Returns -1 if not able to get the next
|
||||
* waypoint number.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param statistics true for statistics marker, false for waypoint marker
|
||||
* @param waypointType the waypoint type
|
||||
*/
|
||||
public int getNextWaypointNumber(long trackId, boolean statistics);
|
||||
public int getNextWaypointNumber(long trackId, WaypointType waypointType);
|
||||
|
||||
/**
|
||||
* Gets a waypoint from a waypoint id. Returns null if not found.
|
||||
|
||||
+13
-12
@@ -17,6 +17,7 @@
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
|
||||
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
|
||||
@@ -350,7 +351,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
waypoint.setTrackId(cursor.getLong(trackIdIndex));
|
||||
}
|
||||
if (!cursor.isNull(typeIndex)) {
|
||||
waypoint.setType(cursor.getInt(typeIndex));
|
||||
waypoint.setType(WaypointType.values()[cursor.getInt(typeIndex)]);
|
||||
}
|
||||
if (!cursor.isNull(lengthIndex)) {
|
||||
waypoint.setLength(cursor.getFloat(lengthIndex));
|
||||
@@ -439,7 +440,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
@Override
|
||||
public void deleteWaypoint(long waypointId, DescriptionGenerator descriptionGenerator) {
|
||||
final Waypoint waypoint = getWaypoint(waypointId);
|
||||
if (waypoint != null && waypoint.getType() == Waypoint.TYPE_STATISTICS
|
||||
if (waypoint != null && waypoint.getType() == WaypointType.STATISTICS
|
||||
&& descriptionGenerator != null) {
|
||||
final Waypoint nextWaypoint = getNextStatisticsWaypointAfter(waypoint);
|
||||
if (nextWaypoint == null) {
|
||||
@@ -479,15 +480,15 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Waypoint getLastStatisticsWaypoint(long trackId) {
|
||||
public Waypoint getLastWaypoint(long trackId, WaypointType waypointType) {
|
||||
if (trackId < 0) {
|
||||
return null;
|
||||
}
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
String selection = WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns.TYPE + "="
|
||||
+ Waypoint.TYPE_STATISTICS;
|
||||
String[] selectionArgs = new String[] { Long.toString(trackId) };
|
||||
String selection = WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns.TYPE + "=?";
|
||||
String[] selectionArgs = new String[] {
|
||||
Long.toString(trackId), Integer.toString(waypointType.ordinal()) };
|
||||
cursor = getWaypointCursor(null, selection, selectionArgs, WaypointsColumns._ID + " DESC", 1);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
return createWaypoint(cursor);
|
||||
@@ -501,7 +502,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextWaypointNumber(long trackId, boolean statistics) {
|
||||
public int getNextWaypointNumber(long trackId, WaypointType waypointType) {
|
||||
if (trackId < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -509,8 +510,8 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
try {
|
||||
String[] projection = { WaypointsColumns._ID };
|
||||
String selection = WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns.TYPE + "=?";
|
||||
int type = statistics ? Waypoint.TYPE_STATISTICS : Waypoint.TYPE_WAYPOINT;
|
||||
String[] selectionArgs = new String[] { Long.toString(trackId), Integer.toString(type) };
|
||||
String[] selectionArgs = new String[] {
|
||||
Long.toString(trackId), Integer.toString(waypointType.ordinal()) };
|
||||
cursor = getWaypointCursor(projection, selection, selectionArgs, WaypointsColumns._ID, -1);
|
||||
if (cursor != null) {
|
||||
int count = cursor.getCount();
|
||||
@@ -518,7 +519,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
* For statistics markers, the first marker is for the track statistics,
|
||||
* so return the count as the next user visible number.
|
||||
*/
|
||||
return statistics ? count : count + 1;
|
||||
return waypointType == WaypointType.STATISTICS ? count : count + 1;
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
@@ -597,7 +598,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
values.put(WaypointsColumns.CATEGORY, waypoint.getCategory());
|
||||
values.put(WaypointsColumns.ICON, waypoint.getIcon());
|
||||
values.put(WaypointsColumns.TRACKID, waypoint.getTrackId());
|
||||
values.put(WaypointsColumns.TYPE, waypoint.getType());
|
||||
values.put(WaypointsColumns.TYPE, waypoint.getType().ordinal());
|
||||
values.put(WaypointsColumns.LENGTH, waypoint.getLength());
|
||||
values.put(WaypointsColumns.DURATION, waypoint.getDuration());
|
||||
values.put(WaypointsColumns.STARTID, waypoint.getStartId());
|
||||
@@ -644,7 +645,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
String selection = WaypointsColumns._ID + ">? AND " + WaypointsColumns.TRACKID + "=? AND "
|
||||
+ WaypointsColumns.TYPE + "=" + Waypoint.TYPE_STATISTICS;
|
||||
+ WaypointsColumns.TYPE + "=" + WaypointType.STATISTICS.ordinal();
|
||||
String[] selectionArgs = new String[] {
|
||||
Long.toString(waypoint.getId()), Long.toString(waypoint.getTrackId()) };
|
||||
cursor = getWaypointCursor(null, selection, selectionArgs, WaypointsColumns._ID, 1);
|
||||
|
||||
@@ -30,8 +30,9 @@ import android.os.Parcelable;
|
||||
*/
|
||||
public final class Waypoint implements Parcelable {
|
||||
|
||||
public static final int TYPE_WAYPOINT = 0;
|
||||
public static final int TYPE_STATISTICS = 1;
|
||||
public static enum WaypointType {
|
||||
WAYPOINT, STATISTICS;
|
||||
}
|
||||
|
||||
private long id = -1L;
|
||||
private String name = "";
|
||||
@@ -39,7 +40,7 @@ public final class Waypoint implements Parcelable {
|
||||
private String category = "";
|
||||
private String icon = "";
|
||||
private long trackId = -1L;
|
||||
private int type = 0;
|
||||
private WaypointType type = WaypointType.WAYPOINT;
|
||||
private double length = 0.0;
|
||||
private long duration = 0;
|
||||
private long startId = -1L;
|
||||
@@ -50,7 +51,7 @@ public final class Waypoint implements Parcelable {
|
||||
public Waypoint() {}
|
||||
|
||||
public Waypoint(String name, String description, String category, String icon, long trackId,
|
||||
int type, double length, long duration, long startId, long stopId, Location location,
|
||||
WaypointType type, double length, long duration, long startId, long stopId, Location location,
|
||||
TripStatistics tripStatistics) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
@@ -73,7 +74,7 @@ public final class Waypoint implements Parcelable {
|
||||
category = source.readString();
|
||||
icon = source.readString();
|
||||
trackId = source.readLong();
|
||||
type = source.readInt();
|
||||
type = WaypointType.values()[source.readInt()];
|
||||
length = source.readDouble();
|
||||
duration = source.readLong();
|
||||
startId = source.readLong();
|
||||
@@ -103,7 +104,7 @@ public final class Waypoint implements Parcelable {
|
||||
dest.writeString(category);
|
||||
dest.writeString(icon);
|
||||
dest.writeLong(trackId);
|
||||
dest.writeInt(type);
|
||||
dest.writeInt(type.ordinal());
|
||||
dest.writeDouble(length);
|
||||
dest.writeLong(duration);
|
||||
dest.writeLong(startId);
|
||||
@@ -178,11 +179,11 @@ public final class Waypoint implements Parcelable {
|
||||
this.trackId = trackId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
public WaypointType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
public void setType(WaypointType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -25,10 +27,6 @@ import android.os.Parcelable;
|
||||
*/
|
||||
public class WaypointCreationRequest implements Parcelable {
|
||||
|
||||
public static enum WaypointType {
|
||||
WAYPOINT, STATISTICS;
|
||||
}
|
||||
|
||||
private WaypointType type;
|
||||
// true if this marker contains the track statistics
|
||||
private boolean isTrackStatistics;
|
||||
|
||||
Reference in New Issue
Block a user