Change code style about code of calorie calculation.

This commit is contained in:
youtaol
2013-08-20 11:06:37 +08:00
parent cbd6d8158a
commit d16949c139
9 changed files with 78 additions and 49 deletions
@@ -89,8 +89,8 @@ public interface TracksColumns extends BaseColumns {
// The owner of the shared with me track
public static final String SHAREDOWNER = "sharedOwner";
// Calorie expenditure of the track
public static final String CALORIE = "calories";
// Calorie burned of the track
public static final String CALORIE = "calorie";
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" // table
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " // id
@@ -124,7 +124,7 @@ public interface TracksColumns extends BaseColumns {
+ MODIFIEDTIME + " INTEGER, " // modified time
+ SHAREDWITHME + " INTEGER, " // shared with me
+ SHAREDOWNER + " STRING, " // shared owner
+ CALORIE + " INTEGER);"; // calories
+ CALORIE + " INTEGER);"; // calorie
public static final String[] COLUMNS = { _ID, // id
NAME, // name
@@ -157,7 +157,7 @@ public interface TracksColumns extends BaseColumns {
MODIFIEDTIME, // modified time
SHAREDWITHME, // shared with me
SHAREDOWNER,// shared owner
CALORIE }; // calories
CALORIE }; // calorie
public static final byte[] COLUMN_TYPES = { ContentTypeIds.LONG_TYPE_ID, // id
ContentTypeIds.STRING_TYPE_ID, // name
@@ -190,6 +190,6 @@ public interface TracksColumns extends BaseColumns {
ContentTypeIds.LONG_TYPE_ID, // modified time
ContentTypeIds.BOOLEAN_TYPE_ID, // shared with me
ContentTypeIds.STRING_TYPE_ID, // shared owner
ContentTypeIds.INT_TYPE_ID // calories
ContentTypeIds.INT_TYPE_ID // calorie
};
}
@@ -62,8 +62,8 @@ public class TripStatistics implements Parcelable {
// The min and max grade seen on this trip.
private final ExtremityMonitor gradeExtremities = new ExtremityMonitor();
// The calorie expenditure of current track.
private double calorie = 0;
// The calorie of current track.
private double calorie;
/**
* Default constructor.
@@ -493,7 +493,7 @@ public class TripStatistics implements Parcelable {
+ "; Max Longitude: " + getRightDegrees() + "; Max Speed: " + getMaxSpeed()
+ "; Min Elevation: " + getMinElevation() + "; Max Elevation: " + getMaxElevation()
+ "; Elevation Gain: " + getTotalElevationGain() + "; Min Grade: " + getMinGrade()
+ "; Max Grade: " + getMaxGrade() + "; Calorie expenditure: " + getCalorie()
+ "; Max Grade: " + getMaxGrade() + "; Calorie: " + getCalorie()
+ "}";
}
@@ -531,8 +531,7 @@ public class TripStatistics implements Parcelable {
double maxGrade = source.readDouble();
data.gradeExtremities.set(minGrade, maxGrade);
double calorie = source.readDouble();
data.setCalorie(calorie);
data.calorie = source.readDouble();
return data;
}
@@ -576,7 +575,7 @@ public class TripStatistics implements Parcelable {
/**
* Adds calorie value.
*
* @param calorieAdded
* @param calorieAdded add the value to the total calorie
*/
public void addCalorie(double calorieAdded) {
this.calorie += calorieAdded;
@@ -584,9 +583,11 @@ public class TripStatistics implements Parcelable {
/**
* Sets calorie value.
*
* @param calorie the new value of calorie
*/
public void setCalorie(double newCalorie) {
calorie = newCalorie;
public void setCalorie(double calorie) {
this.calorie = calorie;
}
/**