Total time walked gets saved and loaded
This commit is contained in:
@@ -63,6 +63,9 @@ public enum Data {
|
|||||||
|
|
||||||
public void addTimeWalked(long time) {
|
public void addTimeWalked(long time) {
|
||||||
totalTime += time;
|
totalTime += time;
|
||||||
|
|
||||||
|
editor.putLong("timeWalked", totalTime);
|
||||||
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getDistanceTraveled() {
|
public double getDistanceTraveled() {
|
||||||
@@ -105,8 +108,9 @@ public enum Data {
|
|||||||
public void load(){
|
public void load(){
|
||||||
SharedPreferences prefs = context.getSharedPreferences("Data", Context.MODE_PRIVATE);
|
SharedPreferences prefs = context.getSharedPreferences("Data", Context.MODE_PRIVATE);
|
||||||
this.editor = prefs.edit();
|
this.editor = prefs.edit();
|
||||||
Data.INSTANCE.addDistance(Double.parseDouble(prefs.getString("distanceTraveled", "0")));
|
this.addDistance(Double.parseDouble(prefs.getString("distanceTraveled", "0")));
|
||||||
this.locationsVisited = loadAndGetVisitedNamesList().size();
|
this.locationsVisited = loadAndGetVisitedNamesList().size();
|
||||||
|
this.totalTime = prefs.getLong("timeWalked", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public android.location.Location getLocation() {
|
public android.location.Location getLocation() {
|
||||||
|
|||||||
Reference in New Issue
Block a user