Merge heads

This commit is contained in:
youtaol
2013-08-15 09:46:14 +08:00
parent 4d8c44782e
commit d64b6a4d93
30 changed files with 785 additions and 189 deletions
@@ -363,7 +363,8 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
int elevationGainIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.ELEVATIONGAIN);
int minGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MINGRADE);
int maxGradeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.MAXGRADE);
int photoUrlIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.PHOTOURL);
Waypoint waypoint = new Waypoint();
if (!cursor.isNull(idIndex)) {
@@ -468,6 +469,10 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
if (hasTripStatistics) {
waypoint.setTripStatistics(tripStatistics);
}
if (!cursor.isNull(photoUrlIndex)) {
waypoint.setPhotoUrl(cursor.getString(photoUrlIndex));
}
return waypoint;
}
@@ -672,6 +677,8 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
values.put(WaypointsColumns.MINGRADE, tripStatistics.getMinGrade());
values.put(WaypointsColumns.MAXGRADE, tripStatistics.getMaxGrade());
}
values.put(WaypointsColumns.PHOTOURL, waypoint.getPhotoUrl());
return values;
}
@@ -47,12 +47,13 @@ public final class Waypoint implements Parcelable {
private long stopId = -1L;
private Location location = null;
private TripStatistics tripStatistics = null;
private String photoUrl = "";
public Waypoint() {}
public Waypoint(String name, String description, String category, String icon, long trackId,
WaypointType type, double length, long duration, long startId, long stopId, Location location,
TripStatistics tripStatistics) {
TripStatistics tripStatistics, String photoUrl) {
this.name = name;
this.description = description;
this.category = category;
@@ -65,6 +66,7 @@ public final class Waypoint implements Parcelable {
this.stopId = stopId;
this.location = location;
this.tripStatistics = tripStatistics;
this.photoUrl = photoUrl;
}
private Waypoint(Parcel source) {
@@ -89,6 +91,7 @@ public final class Waypoint implements Parcelable {
if (hasStats > 0) {
tripStatistics = source.readParcelable(classLoader);
}
photoUrl = source.readString();
}
@Override
@@ -117,6 +120,7 @@ public final class Waypoint implements Parcelable {
if (tripStatistics != null) {
dest.writeParcelable(tripStatistics, 0);
}
dest.writeString(photoUrl);
}
public static final Parcelable.Creator<Waypoint> CREATOR = new Parcelable.Creator<Waypoint>() {
@@ -233,5 +237,13 @@ public final class Waypoint implements Parcelable {
public void setTripStatistics(TripStatistics tripStatistics) {
this.tripStatistics = tripStatistics;
}
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(String photoUrl) {
this.photoUrl = photoUrl;
}
}
@@ -34,6 +34,7 @@ public class WaypointCreationRequest implements Parcelable {
private String category;
private String description;
private String iconUrl;
private String photoUrl;
public final static WaypointCreationRequest DEFAULT_WAYPOINT = new WaypointCreationRequest(
WaypointType.WAYPOINT, false);
@@ -43,17 +44,18 @@ public class WaypointCreationRequest implements Parcelable {
WaypointType.STATISTICS, true);
private WaypointCreationRequest(WaypointType type, boolean isTrackStatistics) {
this(type, isTrackStatistics, null, null, null, null);
this(type, isTrackStatistics, null, null, null, null, null);
}
public WaypointCreationRequest(WaypointType type, boolean isTrackStatistics, String name,
String category, String description, String iconUrl) {
String category, String description, String iconUrl, String photoUrl) {
this.type = type;
this.isTrackStatistics = isTrackStatistics;
this.name = name;
this.category = category;
this.description = description;
this.iconUrl = iconUrl;
this.photoUrl = photoUrl;
}
public static class Creator implements Parcelable.Creator<WaypointCreationRequest> {
@@ -66,6 +68,7 @@ public class WaypointCreationRequest implements Parcelable {
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString());
return request;
}
@@ -90,6 +93,7 @@ public class WaypointCreationRequest implements Parcelable {
parcel.writeString(category);
parcel.writeString(description);
parcel.writeString(iconUrl);
parcel.writeString(photoUrl);
}
public WaypointType getType() {
@@ -115,4 +119,8 @@ public class WaypointCreationRequest implements Parcelable {
public String getIconUrl() {
return iconUrl;
}
public String getPhotoUrl() {
return photoUrl;
}
}
@@ -70,6 +70,8 @@ public interface WaypointsColumns extends BaseColumns {
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
public static final String MINGRADE = "mingrade"; // min grade
public static final String MAXGRADE = "maxgrade"; // max grade
public static final String PHOTOURL = "photoUrl"; // url for the photo
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
@@ -101,7 +103,8 @@ public interface WaypointsColumns extends BaseColumns {
+ MAXELEVATION + " FLOAT, "
+ ELEVATIONGAIN + " FLOAT, "
+ MINGRADE + " FLOAT, "
+ MAXGRADE + " FLOAT"
+ MAXGRADE + " FLOAT, "
+ PHOTOURL + " STRING"
+ ");";
public static final String[] COLUMNS = {
@@ -134,7 +137,8 @@ public interface WaypointsColumns extends BaseColumns {
MAXELEVATION,
ELEVATIONGAIN,
MINGRADE,
MAXGRADE
MAXGRADE,
PHOTOURL
};
public static final byte[] COLUMN_TYPES = {
@@ -167,6 +171,7 @@ public interface WaypointsColumns extends BaseColumns {
FLOAT_TYPE_ID, // max elevation
FLOAT_TYPE_ID, // elevation gain
FLOAT_TYPE_ID, // min grade
FLOAT_TYPE_ID // max grade
FLOAT_TYPE_ID, // max grade
STRING_TYPE_ID // photo url
};
}