Compare commits
8 Commits
routeFragm
...
ButtonFix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57edff604e | ||
|
|
04defe4643 | ||
|
|
02c2981d58 | ||
|
|
209e3f3681 | ||
|
|
d87adeec8d | ||
|
|
27a7feb05a | ||
|
|
6edcd7b74f | ||
|
|
5587c318d0 |
@@ -63,6 +63,9 @@ public enum Data {
|
||||
|
||||
public void addTimeWalked(long time) {
|
||||
totalTime += time;
|
||||
|
||||
editor.putLong("timeWalked", totalTime);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public double getDistanceTraveled() {
|
||||
@@ -105,8 +108,9 @@ public enum Data {
|
||||
public void load(){
|
||||
SharedPreferences prefs = context.getSharedPreferences("Data", Context.MODE_PRIVATE);
|
||||
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.totalTime = prefs.getLong("timeWalked", 0);
|
||||
}
|
||||
|
||||
public android.location.Location getLocation() {
|
||||
|
||||
@@ -208,7 +208,7 @@ public class HomeFragment extends Fragment implements LocationListener {
|
||||
if (currentLocation == null) currentLocation = location;
|
||||
|
||||
if (location != null) {
|
||||
GeoPoint start = new GeoPoint(location.getLatitude(), location.getLongitude());
|
||||
GeoPoint start = new GeoPoint(currentLocation.getLatitude(), currentLocation.getLongitude());
|
||||
mapController.setCenter(start);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="9dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/statistics"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/coupon_back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:text="@string/coupons"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/secondaryColour"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/coupon_back_button"
|
||||
app:layout_constraintBottom_toBottomOf="@id/coupon_back_button"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/coupon_back_button"
|
||||
@@ -26,7 +29,6 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
android:layout_margin="9dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/locations"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/location_back_button"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
|
||||
@@ -24,9 +24,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="9dp"
|
||||
android:text="@string/routes"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/route_back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/route_back_button"
|
||||
app:layout_constraintBottom_toBottomOf="@id/route_back_button"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/route_recyclerview"
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -22,7 +21,7 @@
|
||||
android:id="@+id/route_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@color/secondaryColour"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/route_detail_image"
|
||||
android:text=""
|
||||
@@ -31,13 +30,13 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_margin="40dp"
|
||||
android:id="@+id/route_detail_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/route_detail_back_button"
|
||||
android:layout_width="228dp"
|
||||
android:layout_height="208dp"
|
||||
android:layout_margin="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/route_detail_back_button" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
@@ -58,18 +57,16 @@
|
||||
</ScrollView>
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/start_route_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="45dp"
|
||||
android:backgroundTint="@color/secondaryColour"
|
||||
android:text="@string/start_route"
|
||||
android:textColor="@color/primaryColour"
|
||||
android:layout_marginBottom="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.498"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/total_distance" />
|
||||
|
||||
@@ -77,7 +74,6 @@
|
||||
android:id="@+id/total_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@color/primaryColour"
|
||||
android:text="@string/total_distance"
|
||||
android:textColor="@color/secondaryColour"
|
||||
|
||||
Reference in New Issue
Block a user