Compare commits
65 Commits
directions
...
RecyclerVi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0f87af42b | ||
|
|
192f1a4c64 | ||
|
|
391792a5e2 | ||
|
|
1f53890a4b | ||
|
|
09ced99654 | ||
|
|
86bc0f0c19 | ||
|
|
deb599db25 | ||
|
|
9be5ba27ab | ||
|
|
926a984c71 | ||
|
|
f5da1c8a83 | ||
|
|
0e63bff0f1 | ||
|
|
5e76ced998 | ||
|
|
f6af7ae80b | ||
|
|
d4cfa17fda | ||
|
|
abc58d3606 | ||
|
|
1877a693d0 | ||
|
|
80764591ad | ||
|
|
738a733b72 | ||
|
|
587380fd89 | ||
|
|
faa79b5553 | ||
|
|
1834aec01b | ||
|
|
062739ac7b | ||
|
|
360198e784 | ||
|
|
16bd30f785 | ||
|
|
2e5f57aa23 | ||
|
|
fbf8cbe1c5 | ||
|
|
aae67f53ec | ||
|
|
bc8b83e4f6 | ||
|
|
65d2f31e3f | ||
|
|
40331f3135 | ||
|
|
f5f077db0f | ||
|
|
d53f63a6d7 | ||
|
|
e8af38981f | ||
|
|
d63b150275 | ||
|
|
a75b81033f | ||
|
|
bcd9eb6378 | ||
|
|
a12493972a | ||
|
|
678b179e04 | ||
|
|
1b770020ed | ||
|
|
29b3623ab5 | ||
|
|
da45a0a40e | ||
|
|
e761dd80e5 | ||
|
|
79e24621e2 | ||
|
|
1549fc7a59 | ||
|
|
edcfd2ff0a | ||
|
|
547d676a68 | ||
|
|
d96a54863c | ||
|
|
7b9ca656aa | ||
|
|
2118336815 | ||
|
|
36eb28ce07 | ||
|
|
eea66fd153 | ||
|
|
ff32eefab0 | ||
|
|
e2bccb6e76 | ||
|
|
c355f64d38 | ||
|
|
91c0435e55 | ||
|
|
9ca3b12d71 | ||
|
|
08d9543e3b | ||
|
|
70a9878b06 | ||
|
|
294814dea8 | ||
|
|
6b197c4742 | ||
|
|
a3d8bdfd77 | ||
|
|
6f10444126 | ||
|
|
1f7cd49a90 | ||
|
|
aba26f3211 | ||
|
|
6c923d27b2 |
@@ -55,4 +55,5 @@ dependencies {
|
|||||||
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
testImplementation 'org.mockito:mockito-core:2.7.22'
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"code": "2345",
|
"code": "KROKET10",
|
||||||
"reward": "fdasfasdf"
|
"reward": "Gratis 2e kroket bij Kees Kroket™"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "654",
|
||||||
|
"reward": ",juygly"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
"name":"MEZZ Breda Keizerstraat 101",
|
"name":"MEZZ Breda Keizerstraat 101",
|
||||||
"coordinates":"51.58394697737321,4.779757901349616",
|
"coordinates":"51.58394697737321,4.779757901349616",
|
||||||
"description":"4811HL Breda",
|
"description":"4811HL Breda",
|
||||||
"imageUrl":"NULL"
|
"imageUrl":"mezz_breda"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Het Klooster Breda Schorsmolenstraat 13",
|
"name":"Het Klooster Breda Schorsmolenstraat 13",
|
||||||
|
|||||||
@@ -3,9 +3,35 @@
|
|||||||
"name": "rondje stad",
|
"name": "rondje stad",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"name": "kees kroket",
|
"name":"Prison Escape Kloosterlaan 168",
|
||||||
"coordinates": "2.4654645,6.2342323",
|
"coordinates":"51.59073795635181,4.784917104321059",
|
||||||
"description": "lekkere patatjes"
|
"description":"4811EE Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"De Koepel - FutureDome Events Nassausingel 26",
|
||||||
|
"coordinates":"51.590431588532105,4.786756741648511",
|
||||||
|
"description":"4811HP Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Escaping Breda: Escape Room Games Boschstraat 114",
|
||||||
|
"coordinates":" 51.59110835530862,4.784147222780912",
|
||||||
|
"description":"4811GK Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"MEZZ Breda Keizerstraat 101",
|
||||||
|
"coordinates":"51.58394697737321,4.779757901349616",
|
||||||
|
"description":"4811HL Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Het Klooster Breda Schorsmolenstraat 13",
|
||||||
|
"coordinates":"51.58775443759389,4.765568874365066",
|
||||||
|
"description":"4811VN Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"totalDistance": 2.3434,
|
"totalDistance": 2.3434,
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
package com.a1.nextlocation;
|
package com.a1.nextlocation;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
import com.a1.nextlocation.data.FileIO;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
import com.a1.nextlocation.fragments.HomeFragment;
|
import com.a1.nextlocation.fragments.HomeFragment;
|
||||||
import com.a1.nextlocation.fragments.RouteFragment;
|
import com.a1.nextlocation.fragments.RouteFragment;
|
||||||
import com.a1.nextlocation.fragments.SettingsFragment;
|
import com.a1.nextlocation.fragments.SettingsFragment;
|
||||||
@@ -19,7 +21,12 @@ import com.a1.nextlocation.recyclerview.LocationListManager;
|
|||||||
import com.a1.nextlocation.recyclerview.RouteListManager;
|
import com.a1.nextlocation.recyclerview.RouteListManager;
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
private static final String TAG = MainActivity.class.getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* onCreate method that creates the main activity
|
* onCreate method that creates the main activity
|
||||||
* @param savedInstanceState the saved instance state of the app
|
* @param savedInstanceState the saved instance state of the app
|
||||||
@@ -29,9 +36,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
BottomNavigationView bottomNav = findViewById(R.id.navbar);
|
BottomNavigationView bottomNav = findViewById(R.id.navigation_bar);
|
||||||
bottomNav.setOnNavigationItemSelectedListener(navListener);
|
bottomNav.setOnNavigationItemSelectedListener(navListener);
|
||||||
|
|
||||||
|
|
||||||
|
/*System.out.println(Arrays.toString(getFilesDir().listFiles()));
|
||||||
|
FileIO<Route> fileIO = new FileIO<>();
|
||||||
|
fileIO.writeFileData(new Route("TERSTSET"), getApplicationContext());
|
||||||
|
Log.d(TAG, "onCreate: " + "FILE GESCHREVENN!!!!!");*/
|
||||||
|
|
||||||
LocationListManager.INSTANCE.setContext(this);
|
LocationListManager.INSTANCE.setContext(this);
|
||||||
LocationListManager.INSTANCE.load();
|
LocationListManager.INSTANCE.load();
|
||||||
CouponListManager.INSTANCE.setContext(this);
|
CouponListManager.INSTANCE.setContext(this);
|
||||||
|
|||||||
@@ -2,17 +2,26 @@ package com.a1.nextlocation.data;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
@@ -50,7 +59,45 @@ public class FileIO<T> {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeFileData(T objectToWrite) {
|
// public void writeFileData(T objectToWrite, Context context) {
|
||||||
//TODO make
|
// //TODO make
|
||||||
}
|
// //object naar jsonobject
|
||||||
|
// //jsonarray toevoegen/maken
|
||||||
|
// //filewriter naar file
|
||||||
|
//
|
||||||
|
// String filename = "";
|
||||||
|
// if (objectToWrite instanceof Coupon){
|
||||||
|
// filename = "coupons.json";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (objectToWrite instanceof Route){
|
||||||
|
// filename = "routes.json";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (objectToWrite instanceof Location){
|
||||||
|
// filename = "locations.json";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// try (FileOutputStream fileOutputStream = context.openFileOutput(filename, Context.MODE_PRIVATE)){
|
||||||
|
// String json = new Gson().toJson(objectToWrite);
|
||||||
|
//
|
||||||
|
// fileOutputStream.write(json.getBytes(StandardCharsets.UTF_8));
|
||||||
|
//
|
||||||
|
// } catch (FileNotFoundException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /*try (FileWriter fileWriter = new FileWriter(filename)){
|
||||||
|
//
|
||||||
|
// String json = new Gson().toJson(objectToWrite);
|
||||||
|
//
|
||||||
|
// fileWriter.append(json);
|
||||||
|
// fileWriter.flush();
|
||||||
|
//
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }*/
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.a1.nextlocation.data;
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.osmdroid.util.GeoPoint;
|
import org.osmdroid.util.GeoPoint;
|
||||||
|
|
||||||
public class Location {
|
public class Location implements Parcelable {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String name;
|
private String name;
|
||||||
@@ -32,6 +35,29 @@ public class Location {
|
|||||||
this(name,getStringFromCoordinates(latCoord,longCoord),description,imageUrl);
|
this(name,getStringFromCoordinates(latCoord,longCoord),description,imageUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Location(String name, android.location.Location loc, String description, String imageUrl) {
|
||||||
|
this(name,getStringFromCoordinates(loc.getLatitude(),loc.getLongitude()),description,imageUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Location(Parcel in) {
|
||||||
|
name = in.readString();
|
||||||
|
coordinates = in.readString();
|
||||||
|
description = in.readString();
|
||||||
|
imageUrl = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<Location> CREATOR = new Creator<Location>() {
|
||||||
|
@Override
|
||||||
|
public Location createFromParcel(Parcel in) {
|
||||||
|
return new Location(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location[] newArray(int size) {
|
||||||
|
return new Location[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
@@ -68,8 +94,8 @@ public class Location {
|
|||||||
|
|
||||||
public double[] getCoordinatesAsDoubles() {
|
public double[] getCoordinatesAsDoubles() {
|
||||||
double[] res = new double[2];
|
double[] res = new double[2];
|
||||||
res[0] = getLat();
|
res[1] = getLat();
|
||||||
res[1] = getLong();
|
res[0] = getLong();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -83,11 +109,61 @@ public class Location {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getStringFromCoordinates(double lat1, double long1) {
|
public static String getStringFromCoordinates(double lat1, double long1) {
|
||||||
return lat1 + "," + long1;
|
return long1 + "," + lat1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDistance(Location other) {
|
||||||
|
double dlon = other.getLong() - getLong();
|
||||||
|
double dlat = other.getLat() - getLong();
|
||||||
|
double a = Math.pow(Math.sin(dlat / 2), 2)
|
||||||
|
+ Math.cos(getLat()) * Math.cos(other.getLong())
|
||||||
|
* Math.pow(Math.sin(dlon / 2),2);
|
||||||
|
|
||||||
|
double c = 2 * Math.asin(Math.sqrt(a));
|
||||||
|
|
||||||
|
// Radius of earth in kilometers. Use 3956
|
||||||
|
// for miles
|
||||||
|
double r = 6371;
|
||||||
|
|
||||||
|
// calculate the result
|
||||||
|
double distance = c * r;
|
||||||
|
|
||||||
|
return Math.floor(distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getDistance(double lat1, double lon1, double lat2, double lon2) {
|
||||||
|
double dlon = lon2 - lon1;
|
||||||
|
double dlat = lat2 - lat1;
|
||||||
|
double a = Math.pow(Math.sin(dlat / 2), 2)
|
||||||
|
+ Math.cos(lat1) * Math.cos(lat2)
|
||||||
|
* Math.pow(Math.sin(dlon / 2),2);
|
||||||
|
|
||||||
|
double c = 2 * Math.asin(Math.sqrt(a));
|
||||||
|
|
||||||
|
// Radius of earth in kilometers. Use 3956
|
||||||
|
// for miles
|
||||||
|
double r = 6371;
|
||||||
|
|
||||||
|
// calculate the result
|
||||||
|
double distance = c * r;
|
||||||
|
|
||||||
|
return Math.floor(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoPoint convertToGeoPoint() {
|
public GeoPoint convertToGeoPoint() {
|
||||||
return new GeoPoint(this.getLat(),this.getLong());
|
return new GeoPoint(this.getLat(),this.getLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeString(name);
|
||||||
|
parcel.writeString(coordinates);
|
||||||
|
parcel.writeString(description);
|
||||||
|
parcel.writeString(imageUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.a1.nextlocation.data;
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -7,28 +10,40 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Route {
|
public class Route implements Parcelable {
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String name;
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
private List<Location> locations;
|
private List<Location> locations;
|
||||||
|
|
||||||
|
|
||||||
private float totalDistance;
|
private float totalDistance;
|
||||||
|
|
||||||
|
|
||||||
private int totalTime;
|
private int totalTime;
|
||||||
|
|
||||||
public Route(@NotNull String name) {
|
public Route(@NotNull String name) {
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.locations = new ArrayList<>();
|
this.locations = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Route(Parcel in) {
|
||||||
|
this.name = in.readString();
|
||||||
|
this.locations = in.createTypedArrayList(Location.CREATOR);
|
||||||
|
this.totalDistance = in.readFloat();
|
||||||
|
this.totalTime = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<Route> CREATOR = new Creator<Route>() {
|
||||||
|
@Override
|
||||||
|
public Route createFromParcel(Parcel in) {
|
||||||
|
return new Route(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Route[] newArray(int size) {
|
||||||
|
return new Route[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public void addLocation(Location location) {
|
public void addLocation(Location location) {
|
||||||
this.locations.add(location);
|
this.locations.add(location);
|
||||||
}
|
}
|
||||||
@@ -69,4 +84,24 @@ public class Route {
|
|||||||
this.totalTime = totalTime;
|
this.totalTime = totalTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
|
parcel.writeString(name);
|
||||||
|
parcel.writeTypedList(locations);
|
||||||
|
parcel.writeFloat(totalDistance);
|
||||||
|
parcel.writeInt(totalTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
app/src/main/java/com/a1/nextlocation/data/RouteHandler.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
|
import org.osmdroid.views.overlay.Polyline;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* singleton to track the current route that is being followed
|
||||||
|
*/
|
||||||
|
public enum RouteHandler {
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
private boolean isFollowingRoute = false;
|
||||||
|
private Route currentRoute;
|
||||||
|
private int stepCount = 0;
|
||||||
|
private RouteFinishedListener routeFinishedListener;
|
||||||
|
|
||||||
|
private Polyline currentRouteLine;
|
||||||
|
|
||||||
|
public void setCurrentRouteLine(Polyline currentRouteLine) {
|
||||||
|
this.currentRouteLine = currentRouteLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Polyline getCurrentRouteLine() {
|
||||||
|
return currentRouteLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRouteFinishedListener(RouteFinishedListener routeFinishedListener) {
|
||||||
|
this.routeFinishedListener = routeFinishedListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStepCount() {
|
||||||
|
return stepCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addStep() {
|
||||||
|
stepCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishRoute() {
|
||||||
|
stepCount = 0;
|
||||||
|
isFollowingRoute = false;
|
||||||
|
currentRoute = null;
|
||||||
|
currentRouteLine = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void followRoute(Route route) {
|
||||||
|
this.currentRoute = route;
|
||||||
|
setFollowingRoute(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFollowingRoute(Route route) {
|
||||||
|
return isFollowingRoute && route.equals(currentRoute);
|
||||||
|
}
|
||||||
|
public void setFollowingRoute(boolean followingRoute) {
|
||||||
|
isFollowingRoute = followingRoute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFollowingRoute() {
|
||||||
|
return isFollowingRoute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Route getCurrentRoute() {
|
||||||
|
return currentRoute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface RouteFinishedListener {
|
||||||
|
void onRouteFinish();
|
||||||
|
}
|
||||||
|
}
|
||||||
39
app/src/main/java/com/a1/nextlocation/data/StaticData.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
|
import org.osmdroid.views.overlay.Polyline;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* singleton to keep track of different global data
|
||||||
|
*/
|
||||||
|
public enum StaticData {
|
||||||
|
INSTANCE;
|
||||||
|
private double distanceTraveled = 0;
|
||||||
|
private int locationsVisited = 0;
|
||||||
|
|
||||||
|
private ArrayList<String> visitedNames = new ArrayList<>();
|
||||||
|
|
||||||
|
public void addDistance(double d) {
|
||||||
|
distanceTraveled += d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getDistanceTraveled() {
|
||||||
|
return distanceTraveled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitLocation(Location location) {
|
||||||
|
if (!visitedNames.contains(location.getName())) {
|
||||||
|
locationsVisited++;
|
||||||
|
visitedNames.add(location.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLocationsVisited() {
|
||||||
|
return locationsVisited;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,26 +1,84 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
import com.a1.nextlocation.recyclerview.CouponAdapter;
|
||||||
|
import com.a1.nextlocation.recyclerview.CouponListManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CouponFragment extends Fragment {
|
public class CouponFragment extends Fragment {
|
||||||
|
|
||||||
|
private RecyclerView couponRecyclerView;
|
||||||
|
private RecyclerView.LayoutManager layoutManager;
|
||||||
|
private List<Coupon> couponList;
|
||||||
|
private CouponAdapter couponAdapter;
|
||||||
|
private ImageButton imageButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
View view = inflater.inflate(R.layout.fragment_coupon, container, false);
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_coupon, container, false);
|
this.couponRecyclerView = view.findViewById(R.id.coupon_recyclerview);
|
||||||
|
this.couponRecyclerView.setHasFixedSize(true);
|
||||||
|
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
|
||||||
|
CouponListManager.INSTANCE.setContext(this.getContext());
|
||||||
|
CouponListManager.INSTANCE.load();
|
||||||
|
this.couponList = CouponListManager.INSTANCE.getCouponList();
|
||||||
|
|
||||||
|
this.couponAdapter = new CouponAdapter(this.getContext(), this.couponList, clickedPosition -> showPopup(this.couponList.get(clickedPosition)));
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.coupon_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
StatisticFragment statisticFragment = new StatisticFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.couponRecyclerView.setLayoutManager(this.layoutManager);
|
||||||
|
this.couponRecyclerView.setAdapter(this.couponAdapter);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPopup(Coupon coupon) {
|
||||||
|
AlertDialog.Builder activateBuilder = new AlertDialog.Builder(getContext());
|
||||||
|
AlertDialog.Builder couponCodeBuilder = new AlertDialog.Builder(getContext());
|
||||||
|
// TODO: use string resources instead of hardcoded strings
|
||||||
|
activateBuilder.setMessage("Weet je zeker dat je deze coupon wilt activeren?");
|
||||||
|
activateBuilder.setCancelable(true);
|
||||||
|
// TODO: use string resources instead of hardcoded strings
|
||||||
|
activateBuilder.setPositiveButton("activeren", (dialog, which) -> {
|
||||||
|
// TODO: use string resources instead of hardcoded strings
|
||||||
|
dialog.cancel();
|
||||||
|
couponCodeBuilder.setMessage("Code: " + coupon.getCode());
|
||||||
|
couponCodeBuilder.setPositiveButton("Klaar", (dialog1, which1) -> {
|
||||||
|
dialog.cancel();
|
||||||
|
});
|
||||||
|
AlertDialog couponCodePopup = couponCodeBuilder.create();
|
||||||
|
couponCodePopup.show();
|
||||||
|
});
|
||||||
|
// TODO: use string resources instead of hardcoded strings
|
||||||
|
activateBuilder.setNegativeButton("annuleren", (dialog, which) -> dialog.cancel());
|
||||||
|
AlertDialog couponPopup = activateBuilder.create();
|
||||||
|
couponPopup.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,50 +1,64 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
import com.a1.nextlocation.data.Route;
|
import com.a1.nextlocation.data.RouteHandler;
|
||||||
import com.a1.nextlocation.recyclerview.CouponListManager;
|
import com.a1.nextlocation.data.StaticData;
|
||||||
import com.a1.nextlocation.recyclerview.CustomOverlay;
|
import com.a1.nextlocation.json.DirectionsResult;
|
||||||
|
import com.a1.nextlocation.network.ApiHandler;
|
||||||
import com.a1.nextlocation.recyclerview.LocationListManager;
|
import com.a1.nextlocation.recyclerview.LocationListManager;
|
||||||
import com.a1.nextlocation.recyclerview.RouteListManager;
|
|
||||||
|
|
||||||
import org.osmdroid.api.IMapController;
|
import org.osmdroid.api.IMapController;
|
||||||
import org.osmdroid.config.Configuration;
|
import org.osmdroid.config.Configuration;
|
||||||
import org.osmdroid.util.GeoPoint;
|
import org.osmdroid.util.GeoPoint;
|
||||||
import org.osmdroid.views.MapView;
|
import org.osmdroid.views.MapView;
|
||||||
|
import org.osmdroid.views.overlay.ItemizedIconOverlay;
|
||||||
import org.osmdroid.views.overlay.Overlay;
|
import org.osmdroid.views.overlay.Overlay;
|
||||||
import org.osmdroid.views.overlay.OverlayItem;
|
import org.osmdroid.views.overlay.OverlayItem;
|
||||||
|
import org.osmdroid.views.overlay.Polyline;
|
||||||
import org.osmdroid.views.overlay.compass.CompassOverlay;
|
import org.osmdroid.views.overlay.compass.CompassOverlay;
|
||||||
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider;
|
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider;
|
||||||
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider;
|
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider;
|
||||||
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
|
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment implements LocationListener {
|
||||||
private final String userAgent = "com.ai.nextlocation.fragments";
|
private final String userAgent = "com.ai.nextlocation.fragments";
|
||||||
|
public final static String MAPQUEST_API_KEY = "vuyXjqnAADpjeL9QwtgWGleIk95e36My";
|
||||||
|
private ImageButton imageButton;
|
||||||
|
private ImageButton stopButton;
|
||||||
private MapView mapView;
|
private MapView mapView;
|
||||||
private final int REQUEST_PERMISSIONS_REQUEST_CODE = 1;
|
private final int REQUEST_PERMISSIONS_REQUEST_CODE = 1;
|
||||||
private final String TAG = HomeFragment.class.getCanonicalName();
|
private final String TAG = HomeFragment.class.getCanonicalName();
|
||||||
|
// private RoadManager roadManager;
|
||||||
|
private Polyline roadOverlay;
|
||||||
|
private int color;
|
||||||
|
private Location currentLocation;
|
||||||
|
private Overlay allLocationsOverlay;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -55,14 +69,58 @@ public class HomeFragment extends Fragment {
|
|||||||
// WRITE_EXTERNAL_STORAGE is required in order to show the map
|
// WRITE_EXTERNAL_STORAGE is required in order to show the map
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
|
|
||||||
|
color = requireContext().getColor(R.color.red);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_home, container, false);
|
|
||||||
|
|
||||||
|
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||||
|
|
||||||
|
// set up the location list button
|
||||||
|
this.imageButton = view.findViewById(R.id.location_list_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
LocationFragment locationFragment = new LocationFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// set up the route stop button
|
||||||
|
stopButton = view.findViewById(R.id.home_stop_route_button);
|
||||||
|
stopButton.setOnClickListener(v -> {
|
||||||
|
RouteHandler.INSTANCE.finishRoute();
|
||||||
|
stopButton.setVisibility(View.GONE);
|
||||||
|
Toast.makeText(requireContext(),getResources().getString(R.string.route_stop_toast),Toast.LENGTH_SHORT).show();
|
||||||
|
mapView.getOverlays().remove(roadOverlay);
|
||||||
|
mapView.getOverlays().remove(allLocationsOverlay);
|
||||||
|
addLocations();
|
||||||
|
mapView.invalidate();
|
||||||
|
roadOverlay = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (RouteHandler.INSTANCE.isFollowingRoute()) {
|
||||||
|
stopButton.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
stopButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
ApiHandler.INSTANCE.addListener(this::onDirectionsAvailable);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback method that gets called when there are new directions available in the form of a {@link DirectionsResult} object.
|
||||||
|
* @param directionsResult the directions received from the api
|
||||||
|
*/
|
||||||
|
private void onDirectionsAvailable(DirectionsResult directionsResult) {
|
||||||
|
Log.d(TAG, "onDirectionsAvailable: got result! " + directionsResult);
|
||||||
|
ArrayList<GeoPoint> geoPoints = directionsResult.getGeoPoints();
|
||||||
|
roadOverlay = new Polyline();
|
||||||
|
roadOverlay.setPoints(geoPoints);
|
||||||
|
roadOverlay.setColor(color);
|
||||||
|
|
||||||
|
|
||||||
|
RouteHandler.INSTANCE.setCurrentRouteLine(roadOverlay);
|
||||||
|
Log.d(TAG, "onDirectionsAvailable: successfully added road!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,12 +131,17 @@ public class HomeFragment extends Fragment {
|
|||||||
initMap(view);
|
initMap(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method initializes the map and all the things it needs
|
||||||
|
*
|
||||||
|
* @param view the view the map is on
|
||||||
|
*/
|
||||||
private void initMap(@NonNull View view) {
|
private void initMap(@NonNull View view) {
|
||||||
// set the user agent
|
// set the user agent
|
||||||
Configuration.getInstance().setUserAgentValue(userAgent);
|
Configuration.getInstance().setUserAgentValue(userAgent);
|
||||||
|
|
||||||
// create the map view
|
// create the map view
|
||||||
mapView = view.findViewById(R.id.mapView);
|
mapView = view.findViewById(R.id.map_view);
|
||||||
mapView.setDestroyMode(false);
|
mapView.setDestroyMode(false);
|
||||||
mapView.setTag("mapView");
|
mapView.setTag("mapView");
|
||||||
mapView.setMultiTouchControls(true);
|
mapView.setMultiTouchControls(true);
|
||||||
@@ -87,29 +150,18 @@ public class HomeFragment extends Fragment {
|
|||||||
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(this.requireContext());
|
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(this.requireContext());
|
||||||
|
|
||||||
// add the compass overlay
|
// add the compass overlay
|
||||||
CompassOverlay compassOverlay = new CompassOverlay(requireContext(),new InternalCompassOrientationProvider(requireContext()),mapView);
|
CompassOverlay compassOverlay = new CompassOverlay(requireContext(), new InternalCompassOrientationProvider(requireContext()), mapView);
|
||||||
compassOverlay.enableCompass();
|
compassOverlay.enableCompass();
|
||||||
mapView.getOverlays().add(compassOverlay);
|
mapView.getOverlays().add(compassOverlay);
|
||||||
|
|
||||||
|
addLocations();
|
||||||
|
|
||||||
// add the location overlay
|
// add the location overlay
|
||||||
MyLocationNewOverlay mLocationOverlay = new MyLocationNewOverlay(gpsMyLocationProvider, mapView);
|
MyLocationNewOverlay mLocationOverlay = new MyLocationNewOverlay(gpsMyLocationProvider, mapView);
|
||||||
mLocationOverlay.enableFollowLocation();
|
mLocationOverlay.enableFollowLocation();
|
||||||
mLocationOverlay.enableMyLocation();
|
mLocationOverlay.enableMyLocation();
|
||||||
mapView.getOverlays().add(mLocationOverlay);
|
mapView.getOverlays().add(mLocationOverlay);
|
||||||
|
|
||||||
CustomOverlay customOverlay = new CustomOverlay(getResources().getDrawable(R.drawable.ic_baseline_location_on_24),mapView);
|
|
||||||
|
|
||||||
for (com.a1.nextlocation.data.Location l : LocationListManager.INSTANCE.getLocationList()) {
|
|
||||||
GeoPoint p = new GeoPoint(l.getLat(), l.getLong());
|
|
||||||
OverlayItem overlayItem = new OverlayItem(l.getName(),l.getDescription(), p);
|
|
||||||
|
|
||||||
customOverlay.addOverlayItem(overlayItem);
|
|
||||||
Log.d(TAG, "initMap: " + "succes");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
mapView.getOverlays().add(customOverlay);
|
|
||||||
|
|
||||||
// add the zoom controller
|
// add the zoom controller
|
||||||
IMapController mapController = mapView.getController();
|
IMapController mapController = mapView.getController();
|
||||||
mapController.setZoom(15.0);
|
mapController.setZoom(15.0);
|
||||||
@@ -119,9 +171,19 @@ public class HomeFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// request location updates for the distance checking
|
||||||
|
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
|
||||||
|
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
|
||||||
|
|
||||||
|
// get the current location and set it as center
|
||||||
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||||
GeoPoint startPoint = new GeoPoint(location.getLatitude(), location.getLongitude());
|
if (currentLocation == null) currentLocation = location;
|
||||||
mapController.setCenter(startPoint);
|
|
||||||
|
if (location != null) {
|
||||||
|
GeoPoint start = new GeoPoint(location.getLatitude(), location.getLongitude());
|
||||||
|
mapController.setCenter(start);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
Log.d(TAG, "onViewCreated: exception while getting location: " + e.getLocalizedMessage());
|
Log.d(TAG, "onViewCreated: exception while getting location: " + e.getLocalizedMessage());
|
||||||
@@ -134,7 +196,99 @@ public class HomeFragment extends Fragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
displayRoute();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* displays the route that is currently being followed as a red line
|
||||||
|
*/
|
||||||
|
private void displayRoute() {
|
||||||
|
|
||||||
|
if (RouteHandler.INSTANCE.isFollowingRoute()) {
|
||||||
|
if (roadOverlay == null) {
|
||||||
|
if (RouteHandler.INSTANCE.getCurrentRouteLine() != null) {
|
||||||
|
roadOverlay = RouteHandler.INSTANCE.getCurrentRouteLine();
|
||||||
|
mapView.getOverlays().add(roadOverlay);
|
||||||
|
mapView.invalidate();
|
||||||
|
Log.d(TAG, "initMap: successfully added road!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mapView.getOverlays().add(roadOverlay);
|
||||||
|
mapView.invalidate();
|
||||||
|
Log.d(TAG, "initMap: successfully added road!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds the locations of the current route to the map. If there is no current route, show all locations
|
||||||
|
*/
|
||||||
|
private void addLocations() {
|
||||||
|
// get the locations of the current route or all locations
|
||||||
|
List<com.a1.nextlocation.data.Location> locations = RouteHandler.INSTANCE.isFollowingRoute() ? RouteHandler.INSTANCE.getCurrentRoute().getLocations() : LocationListManager.INSTANCE.getLocationList();
|
||||||
|
final ArrayList<OverlayItem> items = new ArrayList<>(locations.size());
|
||||||
|
// marker icon
|
||||||
|
Drawable marker = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24);
|
||||||
|
marker.setAlpha(255);
|
||||||
|
marker.setTint(getResources().getColor(R.color.primaryColour));
|
||||||
|
|
||||||
|
// add all locations to the overlay itemss
|
||||||
|
for (com.a1.nextlocation.data.Location location : locations) {
|
||||||
|
OverlayItem item = new OverlayItem(location.getName(), location.getDescription(), location.convertToGeoPoint());
|
||||||
|
item.setMarker(marker);
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the overlay that will hold all locations and add listeners
|
||||||
|
allLocationsOverlay = new ItemizedIconOverlay<OverlayItem>(items,
|
||||||
|
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
|
||||||
|
/**
|
||||||
|
* on sinlge click, navigate to that location's detail fragment
|
||||||
|
* @param index the index in the location list
|
||||||
|
* @param item the item that was clicked
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onItemSingleTapUp(int index, OverlayItem item) {
|
||||||
|
com.a1.nextlocation.data.Location clicked = locations.get(index);
|
||||||
|
requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new LocationDetailFragment(clicked)).commit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* on item long press, show that location's name in a toast message
|
||||||
|
* @param index the index in the location list
|
||||||
|
* @param item the item that was clicked
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongPress(int index, OverlayItem item) {
|
||||||
|
com.a1.nextlocation.data.Location clicked = locations.get(index);
|
||||||
|
Toast.makeText(requireContext(), clicked.getName(), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
// create a route to the clicked location, didn't work and didn't have enough time to make it work ¯\_(ツ)_/¯
|
||||||
|
|
||||||
|
// Route route = new Route("Route to " + clicked.getName());
|
||||||
|
// route.addLocation(new com.a1.nextlocation.data.Location("Current location",currentLocation.getLatitude(),currentLocation.getLongitude(),"your location",null));
|
||||||
|
// route.addLocation(clicked);
|
||||||
|
// ApiHandler.INSTANCE.getDirections(route);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, requireContext());
|
||||||
|
|
||||||
|
// add the overlay to the map
|
||||||
|
mapView.getOverlays().add(allLocationsOverlay);
|
||||||
|
Log.d(TAG, "addLocations: successfully added locations");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ricky
|
||||||
|
* request the permissions needed for location and network, made by Ricky
|
||||||
|
* @param permissions tbe permissions we want to ask
|
||||||
|
*/
|
||||||
private void requestPermissionsIfNecessary(String... permissions) {
|
private void requestPermissionsIfNecessary(String... permissions) {
|
||||||
ArrayList<String> permissionsToRequest = new ArrayList<>();
|
ArrayList<String> permissionsToRequest = new ArrayList<>();
|
||||||
if (this.getContext() != null)
|
if (this.getContext() != null)
|
||||||
@@ -152,4 +306,62 @@ public class HomeFragment extends Fragment {
|
|||||||
REQUEST_PERMISSIONS_REQUEST_CODE);
|
REQUEST_PERMISSIONS_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* location callback that gets called each time the location is updated. It is used for updating the distance walked and checking if there are locations you have visited
|
||||||
|
* @param location the new location
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(@NonNull Location location) {
|
||||||
|
// calculate the distance walked
|
||||||
|
double distance = currentLocation.distanceTo(location); // in meters
|
||||||
|
StaticData.INSTANCE.addDistance(distance);
|
||||||
|
currentLocation = location;
|
||||||
|
|
||||||
|
//new thread because we don't want the main thread to hang, this method gets called a lot
|
||||||
|
Thread t = new Thread(() -> {
|
||||||
|
for (com.a1.nextlocation.data.Location l : LocationListManager.INSTANCE.getLocationList()) {
|
||||||
|
if (com.a1.nextlocation.data.Location.getDistance(currentLocation.getLatitude(), currentLocation.getLongitude(), l.getLat(), l.getLong()) < 10) {
|
||||||
|
StaticData.INSTANCE.visitLocation(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// empty override methods for the LocationListener
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderEnabled(@NonNull String provider) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderDisabled(@NonNull String provider) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* method that gets called when the app gets paused
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
mapView.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* method that gets called when the app gets resumed
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
mapView.onResume();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,52 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
|
||||||
public class LocationDetailFragment extends Fragment {
|
public class LocationDetailFragment extends Fragment {
|
||||||
|
private static final String TAG = LocationDetailFragment.class.getCanonicalName();
|
||||||
|
|
||||||
|
private ImageButton imageButton;
|
||||||
|
private Location location;
|
||||||
|
|
||||||
|
public LocationDetailFragment() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocationDetailFragment(Location location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
|
||||||
// Inflate the layout for this fragment
|
View view = inflater.inflate(R.layout.fragment_location_detail, container, false);
|
||||||
return inflater.inflate(R.layout.fragment_location_detail, container, false);
|
this.imageButton = view.findViewById(R.id.detail_location_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
LocationFragment locationFragment = new LocationFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (location != null) {
|
||||||
|
Log.d(TAG, "onCreateView: the location has a name of: " + location.getName());
|
||||||
|
}
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,68 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
import android.media.Image;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.a1.nextlocation.recyclerview.LocationAdapter;
|
||||||
|
import com.a1.nextlocation.recyclerview.LocationListManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class LocationFragment extends Fragment {
|
public class LocationFragment extends Fragment {
|
||||||
|
private RecyclerView locationRecyclerView;
|
||||||
|
private LocationAdapter locationAdapter;
|
||||||
|
private RecyclerView.LayoutManager layoutManager;
|
||||||
|
private List<Location> locationList;
|
||||||
|
private ImageButton imageButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
|
||||||
// Inflate the layout for this fragment
|
View view = inflater.inflate(R.layout.fragment_location, container, false);
|
||||||
return inflater.inflate(R.layout.fragment_location, container, false);
|
|
||||||
|
this.locationRecyclerView = view.findViewById(R.id.location_recyclerview);
|
||||||
|
this.locationRecyclerView.setHasFixedSize(true);
|
||||||
|
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.location_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
LocationListManager.INSTANCE.setContext(this.getContext());
|
||||||
|
LocationListManager.INSTANCE.load();
|
||||||
|
this.locationList = LocationListManager.INSTANCE.getLocationList();
|
||||||
|
|
||||||
|
this.locationAdapter = new LocationAdapter(this.getContext(), this.locationList, clickedPosition -> {
|
||||||
|
LocationDetailFragment locationDetailFragment = new LocationDetailFragment();
|
||||||
|
locationDetailFragment.setLocation(this.locationList.get(clickedPosition));
|
||||||
|
Bundle locationBundle = new Bundle();
|
||||||
|
locationBundle.putParcelable("location", this.locationList.get(clickedPosition));
|
||||||
|
locationDetailFragment.setLocation(this.locationList.get(clickedPosition));
|
||||||
|
locationDetailFragment.setArguments(locationBundle);
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationDetailFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.locationRecyclerView.setLayoutManager(this.layoutManager);
|
||||||
|
this.locationRecyclerView.setAdapter(this.locationAdapter);
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,15 +3,24 @@ package com.a1.nextlocation.fragments;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
public class RouteDetailFragment extends Fragment {
|
public class RouteDetailFragment extends Fragment {
|
||||||
|
|
||||||
|
private Route route;
|
||||||
|
private TextView routeDetailText;
|
||||||
|
private TextView routeName;
|
||||||
|
private ImageButton imageButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -19,9 +28,25 @@ public class RouteDetailFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
View view = inflater.inflate(R.layout.fragment_route_detail, container, false);
|
||||||
// Inflate the layout for this fragment
|
if(getArguments().getParcelable("route") != null) {
|
||||||
return inflater.inflate(R.layout.fragment_route_detail, container, false);
|
this.route = getArguments().getParcelable("route");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.routeName = view.findViewById(R.id.route_title);
|
||||||
|
this.routeName.setText(this.route.getName());
|
||||||
|
|
||||||
|
this.routeDetailText = view.findViewById(R.id.reoute_detail_tekst);
|
||||||
|
this.routeDetailText.setText(this.route.getDescription());
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.route_detail_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
RouteFragment routeFragment = new RouteFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,22 @@ import android.os.Bundle;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
import com.a1.nextlocation.recyclerview.RouteAdapter;
|
||||||
|
import com.a1.nextlocation.recyclerview.RouteListManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import com.a1.nextlocation.data.Location;
|
import com.a1.nextlocation.data.Location;
|
||||||
import com.a1.nextlocation.data.Route;
|
import com.a1.nextlocation.data.Route;
|
||||||
import com.a1.nextlocation.json.DirectionsResult;
|
import com.a1.nextlocation.json.DirectionsResult;
|
||||||
@@ -21,34 +30,63 @@ import com.a1.nextlocation.network.DirectionsListener;
|
|||||||
public class RouteFragment extends Fragment {
|
public class RouteFragment extends Fragment {
|
||||||
private static final String TAG = RouteFragment.class.getCanonicalName();
|
private static final String TAG = RouteFragment.class.getCanonicalName();
|
||||||
|
|
||||||
|
private RecyclerView routeRecyclerView;
|
||||||
|
private RecyclerView.LayoutManager layoutManager;
|
||||||
|
private List<Route> routeList;
|
||||||
|
private RouteAdapter routeAdapter;
|
||||||
|
private ImageButton imageButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
ApiHandler.INSTANCE.addListener(this::onDirectionsAvailable);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
View view = inflater.inflate(R.layout.fragment_route, container, false);
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_route, container, false);
|
this.routeRecyclerView = view.findViewById(R.id.route_recyclerview);
|
||||||
|
this.routeRecyclerView.setHasFixedSize(true);
|
||||||
|
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
|
||||||
|
RouteListManager.INSTANCE.setContext(this.getContext());
|
||||||
|
RouteListManager.INSTANCE.load();
|
||||||
|
this.routeList = RouteListManager.INSTANCE.getRouteList();
|
||||||
|
|
||||||
|
this.routeAdapter = new RouteAdapter(this.getContext(), this.routeList, clickedPosition -> {
|
||||||
|
RouteDetailFragment routeDetailFragment = new RouteDetailFragment();
|
||||||
|
Bundle routeBundle = new Bundle();
|
||||||
|
routeBundle.putParcelable("route", this.routeList.get(clickedPosition));
|
||||||
|
routeDetailFragment.setArguments(routeBundle);
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeDetailFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.route_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.routeRecyclerView.setLayoutManager(this.layoutManager);
|
||||||
|
this.routeRecyclerView.setAdapter(this.routeAdapter);
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
// ApiHandler.INSTANCE.getDirections(8.681436,49.41461,8.687872,49.420318);
|
// ApiHandler.INSTANCE.getDirections(51.49017262451581, 4.289038164073164,51.47337383133509, 4.303535222390562);
|
||||||
Route r = new Route("test");
|
// Route r = new Route("test");
|
||||||
r.addLocation(new Location("test",8.681436,49.41461,"route",null));
|
// r.addLocation(new Location("test",51.574473766034046, 4.7628379328055175,"route",null));
|
||||||
r.addLocation(new Location("test",8.687872,49.420318,"route",null));
|
// r.addLocation(new Location("test",51.577354223919876, 4.771120593941968,"route",null));
|
||||||
ApiHandler.INSTANCE.getDirections(r);
|
// r.addLocation(new Location("test",51.573033468635174, 4.782750651807139,"route",null));
|
||||||
}
|
// r.addLocation(new Location("test",51.56519104881196, 4.748246716295709,"route",null));
|
||||||
|
// r.addLocation(new Location("test",51.57367360644676, 4.74404101271347,"route",null));
|
||||||
public void onDirectionsAvailable(DirectionsResult result) {
|
// r.addLocation(new Location("test",51.57852769146427, 4.739878224473907,"route",null));
|
||||||
Log.d(TAG, "onDirectionsAvailable: got result! " + result);
|
//// r.addLocation(new Location("test",51.489063681658145, 4.289596063527951,"route",null));
|
||||||
|
//// r.addLocation(new Location("test",51.483012677667766, 4.28003245468457,"route",null));
|
||||||
|
// ApiHandler.INSTANCE.getDirections(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import com.a1.nextlocation.MainActivity;
|
import com.a1.nextlocation.MainActivity;
|
||||||
@@ -17,6 +21,10 @@ import com.a1.nextlocation.R;
|
|||||||
|
|
||||||
public class SettingsFragment extends Fragment {
|
public class SettingsFragment extends Fragment {
|
||||||
|
|
||||||
|
private ImageView imageButton;
|
||||||
|
|
||||||
|
SwitchCompat fontChanger;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -36,6 +44,41 @@ public class SettingsFragment extends Fragment {
|
|||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.settings_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
fontChanger = view.findViewById(R.id.BigFont);
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences = requireActivity().getSharedPreferences("com.a1.nextlocation",0);
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
fontChanger.setChecked(sharedPreferences.getBoolean("switch", false));
|
||||||
|
|
||||||
|
if (fontChanger.isChecked()){
|
||||||
|
requireActivity().setTheme(R.style.Theme_NextLocationBig);
|
||||||
|
}else if (!fontChanger.isChecked()){
|
||||||
|
requireActivity().setTheme(R.style.Theme_NextLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
fontChanger.setOnClickListener(view1 -> {
|
||||||
|
if(fontChanger.isChecked())
|
||||||
|
{
|
||||||
|
requireActivity().setTheme(R.style.Theme_NextLocationBig);
|
||||||
|
editor.putBoolean("switch",true);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
if(!fontChanger.isChecked())
|
||||||
|
{
|
||||||
|
requireActivity().setTheme(R.style.Theme_NextLocation);
|
||||||
|
editor.putBoolean("switch",false);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
editor.commit();
|
||||||
|
});
|
||||||
|
|
||||||
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
|
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
|
||||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
|
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
|
||||||
|
|
||||||
|
|||||||
@@ -2,26 +2,72 @@ package com.a1.nextlocation.fragments;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
import com.a1.nextlocation.data.StaticData;
|
||||||
|
import com.a1.nextlocation.recyclerview.CouponAdapter;
|
||||||
|
import com.a1.nextlocation.recyclerview.CouponListManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class StatisticFragment extends Fragment {
|
public class StatisticFragment extends Fragment {
|
||||||
|
|
||||||
|
private List<Coupon> couponList;
|
||||||
|
private ImageView imageButton;
|
||||||
|
private ImageView couponButton;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
View view = inflater.inflate(R.layout.fragment_statistic, container, false);
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_statistic, container, false);
|
TextView distance = view.findViewById(R.id.statistics_km);
|
||||||
|
TextView locs = view.findViewById(R.id.statistics_locations_visited);
|
||||||
|
double dist = StaticData.INSTANCE.getDistanceTraveled()/1000;
|
||||||
|
distance.setText("" + String.format("%.1f",dist) + " km");
|
||||||
|
locs.setText("" + StaticData.INSTANCE.getLocationsVisited());
|
||||||
|
|
||||||
|
|
||||||
|
this.couponList = CouponListManager.INSTANCE.getCouponList();
|
||||||
|
CouponAdapter adapter = new CouponAdapter(this.getContext(), this.couponList);
|
||||||
|
TextView couponNumber = view.findViewById(R.id.couponAmount);
|
||||||
|
couponNumber.setText(String.valueOf(adapter.getItemCount()));
|
||||||
|
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.statistics_back_button);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.couponButton = view.findViewById(R.id.coupon_button);
|
||||||
|
this.couponButton.setOnClickListener(v -> {
|
||||||
|
CouponFragment couponFragment = new CouponFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
ConstraintLayout constraintLayout = view.findViewById(R.id.Box4);
|
||||||
|
constraintLayout.setOnClickListener(v -> {
|
||||||
|
CouponFragment couponFragment = new CouponFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ import org.osmdroid.util.GeoPoint;
|
|||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DirectionsResult {
|
public class DirectionsResult {
|
||||||
@@ -23,6 +24,7 @@ public class DirectionsResult {
|
|||||||
private double distance;
|
private double distance;
|
||||||
private double duration;
|
private double duration;
|
||||||
private double[][] wayPointCoordinates;
|
private double[][] wayPointCoordinates;
|
||||||
|
private GeoPoint[] startAndEndPoint = new GeoPoint[2];
|
||||||
|
|
||||||
public List<DirectionsStep> getSteps() {
|
public List<DirectionsStep> getSteps() {
|
||||||
return steps;
|
return steps;
|
||||||
@@ -52,8 +54,31 @@ public class DirectionsResult {
|
|||||||
this.steps.add(step);
|
this.steps.add(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GeoPoint[] getStartAndEndPoint() {
|
||||||
|
return startAndEndPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* converts all the geopoints in all the steps into an arraylist to display it on the map
|
||||||
|
* @return the list of geopoints
|
||||||
|
*/
|
||||||
|
public ArrayList<GeoPoint> getGeoPoints() {
|
||||||
|
int size = 0;
|
||||||
|
// we'll have a lot of waypoints, so calculate the size first so that the list won't have to be extended (o p t i m i z e)
|
||||||
|
for (int i = 0; i < this.getSteps().size(); i++) {
|
||||||
|
size += this.getSteps().get(i).getWaypoints().length;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<GeoPoint> res = new ArrayList<>(size);
|
||||||
|
for (DirectionsStep step : this.getSteps()) {
|
||||||
|
Collections.addAll(res, step.getWaypoints());
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parses a given json string into this object. It gets all the waypoints and steps and combines them so that every step also has the correct coordinates associated with it
|
* parses a given json string into this object. It gets all the waypoints and steps and combines them so that every step also has the correct coordinates associated with it
|
||||||
|
*
|
||||||
* @param json the json string to parse.
|
* @param json the json string to parse.
|
||||||
*/
|
*/
|
||||||
public void parse(String json) {
|
public void parse(String json) {
|
||||||
@@ -86,7 +111,7 @@ public class DirectionsResult {
|
|||||||
|
|
||||||
for (JsonElement j : steps) {
|
for (JsonElement j : steps) {
|
||||||
|
|
||||||
DirectionsStep step = gson.fromJson(j,DirectionsStep.class);
|
DirectionsStep step = gson.fromJson(j, DirectionsStep.class);
|
||||||
double lat;
|
double lat;
|
||||||
double longl;
|
double longl;
|
||||||
|
|
||||||
@@ -94,7 +119,7 @@ public class DirectionsResult {
|
|||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
lat = this.wayPointCoordinates[step.getWay_points().get(i)][0];
|
lat = this.wayPointCoordinates[step.getWay_points().get(i)][0];
|
||||||
longl = this.wayPointCoordinates[step.getWay_points().get(i)][1];
|
longl = this.wayPointCoordinates[step.getWay_points().get(i)][1];
|
||||||
step.getWaypoints()[i] = new GeoPoint(lat,longl);
|
step.getWaypoints()[i] = new GeoPoint(lat, longl);
|
||||||
}
|
}
|
||||||
|
|
||||||
addStep(step);
|
addStep(step);
|
||||||
@@ -102,6 +127,9 @@ public class DirectionsResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startAndEndPoint[0] = this.getSteps().get(0).getWaypoints()[0];
|
||||||
|
startAndEndPoint[1] = this.getSteps().get(this.getSteps().size()-1).getWaypoints()[1];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseRoute(String json) {
|
public void parseRoute(String json) {
|
||||||
@@ -115,7 +143,7 @@ public class DirectionsResult {
|
|||||||
this.duration = summary.get("duration").getAsDouble();
|
this.duration = summary.get("duration").getAsDouble();
|
||||||
|
|
||||||
JsonPrimitive geometry = route.getAsJsonPrimitive("geometry");
|
JsonPrimitive geometry = route.getAsJsonPrimitive("geometry");
|
||||||
JsonArray wayPointCoordinates = GeometryDecoder.decodeGeometry(geometry.getAsString(),false);
|
JsonArray wayPointCoordinates = GeometryDecoder.decodeGeometry(geometry.getAsString(), false);
|
||||||
this.wayPointCoordinates = new double[wayPointCoordinates.size()][2];
|
this.wayPointCoordinates = new double[wayPointCoordinates.size()][2];
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +168,7 @@ public class DirectionsResult {
|
|||||||
|
|
||||||
for (JsonElement j : steps) {
|
for (JsonElement j : steps) {
|
||||||
|
|
||||||
DirectionsStep step = gson.fromJson(j,DirectionsStep.class);
|
DirectionsStep step = gson.fromJson(j, DirectionsStep.class);
|
||||||
double lat;
|
double lat;
|
||||||
double longl;
|
double longl;
|
||||||
|
|
||||||
@@ -148,7 +176,7 @@ public class DirectionsResult {
|
|||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
lat = this.wayPointCoordinates[step.getWay_points().get(i)][0];
|
lat = this.wayPointCoordinates[step.getWay_points().get(i)][0];
|
||||||
longl = this.wayPointCoordinates[step.getWay_points().get(i)][1];
|
longl = this.wayPointCoordinates[step.getWay_points().get(i)][1];
|
||||||
step.getWaypoints()[i] = new GeoPoint(lat,longl);
|
step.getWaypoints()[i] = new GeoPoint(lat, longl);
|
||||||
}
|
}
|
||||||
|
|
||||||
addStep(step);
|
addStep(step);
|
||||||
@@ -158,7 +186,5 @@ public class DirectionsResult {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public enum ApiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void getDirections(double startLat, double startLong, double endLat, double endLong) {
|
public void getDirections(double startLat, double startLong, double endLat, double endLong) {
|
||||||
getDirections(startLat + "," + startLong, endLat + "," + endLong);
|
getDirections(startLong + "," + startLat, endLong + "," + endLat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getDirections(String startLocation, String endLocation) {
|
public void getDirections(String startLocation, String endLocation) {
|
||||||
@@ -69,6 +69,12 @@ public enum ApiHandler {
|
|||||||
|
|
||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// t.join();
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener(DirectionsListener listener) {
|
public void addListener(DirectionsListener listener) {
|
||||||
@@ -104,6 +110,10 @@ public enum ApiHandler {
|
|||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
String responseString = Objects.requireNonNull(response.body()).string();
|
String responseString = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "getDirections: got response: " + responseString);
|
Log.d(TAG, "getDirections: got response: " + responseString);
|
||||||
|
if (responseString.startsWith("{\"error")) {
|
||||||
|
Log.e(TAG, "getDirections: ERROR IN REQUEST!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DirectionsResult result = new DirectionsResult();
|
DirectionsResult result = new DirectionsResult();
|
||||||
result.parseRoute(responseString);
|
result.parseRoute(responseString);
|
||||||
@@ -117,10 +127,17 @@ public enum ApiHandler {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d(TAG, "getDirections: caught exception: " + e.getLocalizedMessage());
|
Log.d(TAG, "getDirections: caught exception: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
|
try {
|
||||||
|
t.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.a1.nextlocation.recyclerview;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.R;
|
||||||
import com.a1.nextlocation.data.Coupon;
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,31 +26,49 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
|
|||||||
|
|
||||||
class CouponViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
class CouponViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
|
private TextView couponCode;
|
||||||
|
private TextView couponReward;
|
||||||
|
|
||||||
public CouponViewHolder(@NonNull View itemView) {
|
public CouponViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setTextViewName(String text){
|
||||||
|
this.couponReward = itemView.findViewById(R.id.coupon_name);
|
||||||
|
this.couponReward.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View v) {
|
||||||
clickListener.onItemClick(getAdapterPosition());
|
clickListener.onItemClick(getAdapterPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CouponAdapter(Context context, List<Coupon> coupon, OnItemClickListener listener){
|
public CouponAdapter(Context context, List<Coupon> coupon, OnItemClickListener listener){
|
||||||
appContext = context;
|
this.appContext = context;
|
||||||
couponList = coupon;
|
this.couponList = coupon;
|
||||||
clickListener = listener;
|
this.clickListener = listener;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CouponAdapter(Context context, List<Coupon> coupon) {
|
||||||
|
this.appContext = context;
|
||||||
|
this.couponList = coupon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public CouponViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public CouponViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
return null;
|
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.coupon_item, parent, false);
|
||||||
|
return new CouponViewHolder(itemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull CouponViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull CouponViewHolder holder, int position) {
|
||||||
|
Coupon coupon = couponList.get(position);
|
||||||
|
holder.setTextViewName(coupon.getReward());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -55,7 +76,4 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
|
|||||||
return couponList.size();
|
return couponList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.a1.nextlocation.data.Coupon;
|
import com.a1.nextlocation.data.Coupon;
|
||||||
import com.a1.nextlocation.data.FileIO;
|
import com.a1.nextlocation.data.FileIO;
|
||||||
import com.a1.nextlocation.data.Location;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CouponLoader implements Loader<List<Coupon>> {
|
public class CouponLoader implements Loader<List<Coupon>> {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -18,7 +19,7 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
|||||||
|
|
||||||
private Context appContext;
|
private Context appContext;
|
||||||
private List<Location> locationList;
|
private List<Location> locationList;
|
||||||
private CouponAdapter.OnItemClickListener clickListener;
|
private OnItemClickListener clickListener;
|
||||||
|
|
||||||
public interface OnItemClickListener {
|
public interface OnItemClickListener {
|
||||||
void onItemClick(int clickedPosition);
|
void onItemClick(int clickedPosition);
|
||||||
@@ -27,10 +28,13 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
|||||||
class LocationViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
class LocationViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
private TextView locationName;
|
private TextView locationName;
|
||||||
|
private ImageView locationImage;
|
||||||
|
|
||||||
public LocationViewHolder(@NonNull View itemView) {
|
public LocationViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
this.locationName = itemView.findViewById(R.id.location_name);
|
this.locationName = itemView.findViewById(R.id.location_name);
|
||||||
|
this.locationImage = itemView.findViewById(R.id.location_image);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,11 +43,19 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setTextViewText(String text){
|
public void setTextViewText(String text){
|
||||||
|
this.locationName = itemView.findViewById(R.id.location_name);
|
||||||
locationName.setText(text);
|
locationName.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setImageViewImage(String text){
|
||||||
|
this.locationImage = itemView.findViewById(R.id.location_image);
|
||||||
|
Context context = locationImage.getContext();
|
||||||
|
int id = context.getResources().getIdentifier(text, "drawable", context.getPackageName());
|
||||||
|
locationImage.setImageResource(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocationAdapter(Context context, List<Location> location, CouponAdapter.OnItemClickListener listener){
|
public LocationAdapter(Context context, List<Location> location, OnItemClickListener listener){
|
||||||
this.appContext = context;
|
this.appContext = context;
|
||||||
this.locationList = location;
|
this.locationList = location;
|
||||||
this.clickListener = listener;
|
this.clickListener = listener;
|
||||||
@@ -52,15 +64,15 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public LocationAdapter.LocationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public LocationAdapter.LocationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_location, parent, false);
|
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.location_item, parent, false);
|
||||||
LocationViewHolder viewHolder = new LocationViewHolder(itemView);
|
return new LocationViewHolder(itemView);
|
||||||
return viewHolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull LocationAdapter.LocationViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull LocationAdapter.LocationViewHolder holder, int position) {
|
||||||
Location location = locationList.get(position);
|
Location location = locationList.get(position);
|
||||||
holder.setTextViewText(location.getName());
|
holder.setTextViewText(location.getName());
|
||||||
|
holder.setImageViewImage(location.getImageUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
import com.a1.nextlocation.data.Route;
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,14 +28,23 @@ public class RouteAdapter extends RecyclerView.Adapter<RouteAdapter.RouteViewHol
|
|||||||
|
|
||||||
class RouteViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
class RouteViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
|
private TextView routeName;
|
||||||
|
|
||||||
public RouteViewHolder(@NonNull View itemView) {
|
public RouteViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
this.routeName = itemView.findViewById(R.id.route_name);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
clickListener.onItemClick(getAdapterPosition());
|
clickListener.onItemClick(getAdapterPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTextViewText(String text){
|
||||||
|
this.routeName = itemView.findViewById(R.id.route_name);
|
||||||
|
this.routeName.setText(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteAdapter(Context context, List<Route> route, CouponAdapter.OnItemClickListener listener){
|
public RouteAdapter(Context context, List<Route> route, CouponAdapter.OnItemClickListener listener){
|
||||||
@@ -42,12 +56,14 @@ public class RouteAdapter extends RecyclerView.Adapter<RouteAdapter.RouteViewHol
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public RouteAdapter.RouteViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public RouteAdapter.RouteViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
return null;
|
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.route_item, parent, false);
|
||||||
|
return new RouteViewHolder(itemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RouteAdapter.RouteViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull RouteAdapter.RouteViewHolder holder, int position) {
|
||||||
|
Route route = routeList.get(position);
|
||||||
|
holder.setTextViewText(route.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
12
app/src/main/res/drawable-anydpi/ic_stop_icon.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="#333333"
|
||||||
|
android:alpha="0.6">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M8,16h8V8H8V16zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2L12,2z"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
</vector>
|
||||||
BIN
app/src/main/res/drawable-hdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 318 B |
BIN
app/src/main/res/drawable-mdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 213 B |
BIN
app/src/main/res/drawable-xhdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 416 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 552 B |
BIN
app/src/main/res/drawable/beach_and_lounge_club.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
app/src/main/res/drawable/belcrum_beach.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
app/src/main/res/drawable/belcrum_watertoren.png
Normal file
|
After Width: | Height: | Size: 780 KiB |
BIN
app/src/main/res/drawable/coffee_and_lunch.png
Normal file
|
After Width: | Height: | Size: 981 KiB |
BIN
app/src/main/res/drawable/de_boter_hal.png
Normal file
|
After Width: | Height: | Size: 3.8 MiB |
BIN
app/src/main/res/drawable/de_koepel_future_events.png
Normal file
|
After Width: | Height: | Size: 1.9 MiB |
BIN
app/src/main/res/drawable/escaping_room.png
Normal file
|
After Width: | Height: | Size: 619 KiB |
BIN
app/src/main/res/drawable/gauchos.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
app/src/main/res/drawable/hercules_park_valkenburg.png
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
app/src/main/res/drawable/het_klooster_breda.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
app/src/main/res/drawable/kees_kroket.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
app/src/main/res/drawable/koningin_wilhelimna_paviljoen.png
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
app/src/main/res/drawable/mc_donalds.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
app/src/main/res/drawable/mezz_breda.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
app/src/main/res/drawable/nassau_baroniemonument.png
Normal file
|
After Width: | Height: | Size: 432 KiB |
BIN
app/src/main/res/drawable/prison_escape_room.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
app/src/main/res/drawable/station_breda.png
Normal file
|
After Width: | Height: | Size: 502 KiB |
BIN
app/src/main/res/drawable/stop_icon.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable/subway.png
Normal file
|
After Width: | Height: | Size: 648 KiB |
BIN
app/src/main/res/drawable/t_zusje_breda.png
Normal file
|
After Width: | Height: | Size: 3.4 MiB |
BIN
app/src/main/res/drawable/the_tosti_club.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
app/src/main/res/drawable/vr_world.png
Normal file
|
After Width: | Height: | Size: 324 KiB |
BIN
app/src/main/res/drawable/wok_to_go.png
Normal file
|
After Width: | Height: | Size: 264 KiB |
@@ -1,284 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:background="@color/primaryColour"
|
|
||||||
tools:context=".fragments.CouponFragment">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/primaryColour"
|
|
||||||
android:src="@drawable/ic_back_button_24"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textView"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/textView" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="@string/coupons"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="30sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box2"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Code"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Waarde"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box3"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box1"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="FRISDRANKJE20"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk2"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk2"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1x Frisdrank"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk2"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box3"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box4"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box2"
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="CHOCOMEL30"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk3"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk3"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1x Chocomel"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk3"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box4"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box5"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box3"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="FRISTI200"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk4"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk4"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="2x Fristi"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk4"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box5"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/ButtonActivate"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box4"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="OLA30"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk5"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk5"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1x Waterijsje"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk5"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/ButtonActivate"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/buttonColour"
|
|
||||||
android:text="Activate"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box5"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="Locatie detail"
|
android:text="@string/locatie_detail"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
android:layout_height="283dp"
|
android:layout_height="283dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:background="@color/secondaryColour"
|
android:background="@color/secondaryColour"
|
||||||
android:text="Detail tekst"
|
android:text="@string/locatie_detail_tekst"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_name" />
|
app:layout_constraintTop_toBottomOf="@+id/detail_location_name" />
|
||||||
|
|||||||
@@ -7,32 +7,46 @@
|
|||||||
android:background="@color/primaryColour"
|
android:background="@color/primaryColour"
|
||||||
tools:context=".fragments.RouteDetailFragment">
|
tools:context=".fragments.RouteDetailFragment">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/start_route_button2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:backgroundTint="@color/secondaryColour"
|
||||||
|
android:text="@string/start_route"
|
||||||
|
android:textColor="@color/buttonColour"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/reoute_detail_tekst"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/reoute_detail_tekst"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/reoute_detail_tekst"
|
||||||
|
app:layout_constraintVertical_bias="0.873" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/routeDetailBackButton"
|
android:id="@+id/routeDetailBackButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:background="@drawable/ic_back_button_24"
|
android:background="@drawable/ic_back_button_24"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/routeTitle"
|
app:layout_constraintBottom_toBottomOf="@+id/route_title"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/routeTitle"
|
app:layout_constraintTop_toTopOf="@+id/route_title"
|
||||||
app:layout_constraintEnd_toStartOf="@id/routeTitle"
|
app:layout_constraintEnd_toStartOf="@id/route_title"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/routeTitle"
|
android:id="@+id/route_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="250dp"
|
android:layout_marginEnd="250dp"
|
||||||
android:text="titel"
|
android:text="titel"
|
||||||
android:textSize="20sp"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/routeDetailImage"
|
android:textSize="30sp"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/routeDetailText"
|
app:layout_constraintBottom_toTopOf="@+id/route_detail_image"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/reoute_detail_tekst"
|
||||||
app:layout_constraintStart_toEndOf="@id/routeDetailBackButton"
|
app:layout_constraintStart_toEndOf="@id/routeDetailBackButton"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/routeDetailImage"
|
android:id="@+id/route_detail_image"
|
||||||
android:layout_width="250dp"
|
android:layout_width="250dp"
|
||||||
android:layout_height="250dp"
|
android:layout_height="250dp"
|
||||||
android:layout_marginEnd="350dp"
|
android:layout_marginEnd="350dp"
|
||||||
@@ -42,7 +56,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/routeDetailText"
|
android:id="@+id/reoute_detail_tekst"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="10dp"
|
android:layout_height="10dp"
|
||||||
android:layout_marginStart="50dp"
|
android:layout_marginStart="50dp"
|
||||||
@@ -51,33 +65,7 @@
|
|||||||
android:text=""
|
android:text=""
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/routeDetailImage"
|
app:layout_constraintStart_toEndOf="@id/route_detail_image"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/startRouteButton"
|
|
||||||
android:src="@drawable/ic_baseline_play_arrow_24"
|
|
||||||
android:backgroundTint="@color/primaryColour"
|
|
||||||
android:scaleX="5"
|
|
||||||
android:scaleY="5"
|
|
||||||
android:layout_width="70dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_marginStart="350dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/startRouteText"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/startRouteText"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/startRouteText" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/startRouteText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:text="@string/start_route"
|
|
||||||
android:textSize="50sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/startRouteButton"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/routeDetailImage" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -10,15 +10,15 @@
|
|||||||
android:id="@+id/fragment_layout"
|
android:id="@+id/fragment_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/top_bar"
|
||||||
app:layout_constraintBottom_toTopOf="@id/navbar"
|
app:layout_constraintBottom_toTopOf="@id/navigation_bar"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
android:showAsAction="always|withText"
|
android:showAsAction="always|withText"
|
||||||
android:id="@+id/navbar"
|
android:id="@+id/navigation_bar"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
@@ -31,10 +31,9 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/topBar"
|
android:id="@+id/top_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/fragment_layout"
|
app:layout_constraintBottom_toTopOf="@id/fragment_layout"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -42,27 +41,27 @@
|
|||||||
android:background="@color/primaryColour"/>
|
android:background="@color/primaryColour"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/infoButton"
|
android:id="@+id/info_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_baseline_info_24"
|
android:src="@drawable/ic_baseline_info_24"
|
||||||
android:backgroundTint="@color/primaryColour"
|
android:backgroundTint="@color/primaryColour"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/topBar"
|
app:layout_constraintTop_toTopOf="@id/top_bar"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/topBar"
|
app:layout_constraintBottom_toBottomOf="@id/top_bar"
|
||||||
android:tint="@color/secondaryColour"
|
android:tint="@color/secondaryColour"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/text_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintStart_toEndOf="@id/infoButton"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/topBar"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/topBar"
|
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
android:textSize="25dp"
|
|
||||||
android:textColor="@color/secondaryColour"
|
android:textColor="@color/secondaryColour"
|
||||||
/>
|
android:textSize="25sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/top_bar"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/info_button"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/top_bar" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
37
app/src/main/res/layout/coupon_item.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/name_box"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
|
||||||
|
android:background="@color/secondaryColour"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.4"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/coupon_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:text="@string/naam"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,284 +1,41 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:background="@color/primaryColour"
|
android:background="@color/primaryColour"
|
||||||
tools:context=".fragments.CouponFragment">
|
tools:context=".fragments.LocationFragment">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/primaryColour"
|
|
||||||
android:src="@drawable/ic_back_button_24"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textView"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/textView" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/coupon_RV"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_margin="9dp"
|
||||||
android:text="@string/coupons"
|
android:layout_marginTop="20dp"
|
||||||
android:textColor="@color/white"
|
android:text="@string/statistieken"
|
||||||
android:textSize="30sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintStart_toEndOf="@id/coupon_back_button"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/coupon_back_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:background="@drawable/ic_back_button_24"
|
||||||
|
android:backgroundTint="@color/buttonColour"
|
||||||
|
android:text="@string/terug"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/Box1"
|
android:layout_width="0dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_height="70dp"
|
android:id="@+id/coupon_recyclerview"
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box2"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Code"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Waarde"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box3"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box1"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="FRISDRANKJE20"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk2"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk2"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1x Frisdrank"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk2"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box3"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box4"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box2"
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="CHOCOMEL30"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk3"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk3"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1x Chocomel"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk3"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box4"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box5"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box3"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="FRISTI200"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk4"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk4"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="2x Fristi"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk4"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/Box5"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/ButtonActivate"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box4"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="OLA30"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/Balk5"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/Balk5"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1x Waterijsje"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk5"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/ButtonActivate"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/buttonColour"
|
|
||||||
android:text="Activate"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box5"
|
app:layout_constraintTop_toBottomOf="@+id/coupon_back_button" />
|
||||||
/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,14 +1,43 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".fragments.HomeFragment">
|
tools:context=".fragments.HomeFragment">
|
||||||
|
|
||||||
|
|
||||||
<org.osmdroid.views.MapView
|
<org.osmdroid.views.MapView
|
||||||
android:id="@+id/mapView"
|
android:id="@+id/map_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</org.osmdroid.views.MapView>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/location_list_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:backgroundTint="@color/secondaryColour"
|
||||||
|
android:src="@drawable/ic_baseline_outlined_flag_24"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/home_stop_route_button"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/location_list_button"
|
||||||
|
android:backgroundTint="@color/secondaryColour"
|
||||||
|
android:src="@drawable/ic_stop_icon"/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
@@ -12,27 +12,31 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="9dp"
|
android:layout_margin="9dp"
|
||||||
android:text="Locations"
|
android:layout_marginTop="20dp"
|
||||||
|
android:text="@string/locaties"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
app:layout_constraintStart_toEndOf="@id/location_back_button"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/routeBackButton"
|
android:id="@+id/location_back_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:background="@drawable/ic_back_button_24"
|
android:background="@drawable/ic_back_button_24"
|
||||||
android:backgroundTint="@color/buttonColour"
|
android:backgroundTint="@color/buttonColour"
|
||||||
android:text="Back"
|
android:text="@string/terug"
|
||||||
android:layout_margin="10dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:layout_width="0dp"
|
android:id="@+id/location_recyclerview"
|
||||||
android:layout_height="0dp"
|
android:layout_width="match_parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="60dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/routeBackButton" />
|
app:layout_constraintTop_toBottomOf="@+id/location_RV" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -9,12 +9,13 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/detail_location_name"
|
android:id="@+id/detail_location_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="300dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="Locatie detail"
|
android:text="@string/locatie_detail"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
|
android:gravity="center"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -29,26 +30,34 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_name"
|
app:layout_constraintTop_toBottomOf="@+id/detail_location_name"
|
||||||
tools:src="@tools:sample/avatars" />
|
tools:src="@tools:sample/avatars" />
|
||||||
|
|
||||||
<TextView
|
<ScrollView
|
||||||
android:id="@+id/detail_location_text"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="200dp"
|
||||||
android:layout_margin="20dp"
|
android:layout_margin="20dp"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:text="Detail tekst"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_image" />
|
app:layout_constraintTop_toBottomOf="@+id/detail_location_image">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/detail_location_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/secondaryColour"
|
||||||
|
android:text="@string/locatie_detail_tekst"
|
||||||
|
/>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/detail_location_back_button"
|
android:id="@+id/detail_location_back_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_back_button_24"
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:backgroundTint="@color/primaryColour"
|
android:backgroundTint="@color/primaryColour"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/detail_location_name"
|
android:src="@drawable/ic_back_button_24"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/detail_location_name"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/detail_location_name" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -8,33 +8,33 @@
|
|||||||
tools:context=".fragments.RouteFragment">
|
tools:context=".fragments.RouteFragment">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/routeBackButton"
|
android:id="@+id/route_back_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:background="@drawable/ic_back_button_24"
|
android:background="@drawable/ic_back_button_24"
|
||||||
android:text="Back"
|
android:text="@string/terug"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/routeTitle"
|
android:id="@+id/route_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="9dp"
|
android:layout_margin="9dp"
|
||||||
android:text="titel"
|
android:text="@string/titel"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
app:layout_constraintStart_toEndOf="@id/route_back_button"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/routeListRV"
|
android:id="@+id/route_recyclerview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:background="@color/primaryColour"
|
android:background="@color/primaryColour"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/routeBackButton" />
|
app:layout_constraintTop_toBottomOf="@+id/route_back_button" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -8,23 +8,23 @@
|
|||||||
tools:context=".fragments.RouteDetailFragment">
|
tools:context=".fragments.RouteDetailFragment">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/routeDetailBackButton"
|
android:id="@+id/route_detail_back_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="100dp"
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
android:background="@drawable/ic_back_button_24"
|
android:background="@drawable/ic_back_button_24"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/routeTitle"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/routeTitle"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/routeTitle" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/routeTitle"
|
android:id="@+id/route_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="titel"
|
android:text="@string/titel"
|
||||||
android:textSize="20sp"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/routeDetailImage"
|
android:textSize="30sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/route_detail_image"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -33,49 +33,37 @@
|
|||||||
android:layout_width="250dp"
|
android:layout_width="250dp"
|
||||||
android:layout_height="250dp"
|
android:layout_height="250dp"
|
||||||
android:layout_margin="40dp"
|
android:layout_margin="40dp"
|
||||||
android:id="@+id/routeDetailImage"
|
android:id="@+id/route_detail_image"
|
||||||
app:layout_constraintTop_toBottomOf="@id/routeDetailBackButton"
|
app:layout_constraintTop_toBottomOf="@id/route_detail_back_button"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/routeDetailText"
|
app:layout_constraintBottom_toTopOf="@id/reoute_detail_tekst"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/routeDetailText"
|
android:id="@+id/reoute_detail_tekst"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
android:layout_marginBottom="100dp"
|
android:layout_marginTop="56dp"
|
||||||
app:layout_constraintBottom_toTopOf="@id/startRouteText"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.6"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/routeDetailImage" />
|
app:layout_constraintTop_toBottomOf="@id/route_detail_image" />
|
||||||
|
|
||||||
<ImageButton
|
<Button
|
||||||
android:id="@+id/startRouteButton"
|
android:id="@+id/start_route_button"
|
||||||
android:backgroundTint="@color/primaryColour"
|
|
||||||
android:scaleX="5"
|
|
||||||
android:scaleY="5"
|
|
||||||
android:layout_width="70dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_margin="20dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/startRouteText"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/startRouteText"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/startRouteText"
|
|
||||||
android:src="@drawable/ic_baseline_play_arrow_24"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/startRouteText"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="20dp"
|
|
||||||
android:text="@string/start_route"
|
android:text="@string/start_route"
|
||||||
android:textSize="50sp"
|
android:backgroundTint="@color/secondaryColour"
|
||||||
|
android:textColor="@color/buttonColour"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/startRouteButton"
|
app:layout_constraintHorizontal_bias="0.498"
|
||||||
app:layout_constraintTop_toBottomOf="@id/routeDetailText" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/reoute_detail_tekst"
|
||||||
|
app:layout_constraintVertical_bias="0.671" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -8,21 +8,22 @@
|
|||||||
tools:context=".fragments.SettingsFragment">
|
tools:context=".fragments.SettingsFragment">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
<androidx.appcompat.widget.AppCompatImageButton
|
||||||
|
android:id="@+id/settings_back_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:backgroundTint="@color/primaryColour"
|
android:backgroundTint="@color/primaryColour"
|
||||||
android:src="@drawable/ic_back_button_24"
|
android:src="@drawable/ic_back_button_24"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textView"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/textView" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="@string/settings"
|
android:text="@string/instellingen"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/Box1"
|
android:id="@+id/name_box"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box2"
|
app:layout_constraintBottom_toTopOf="@id/Box2"
|
||||||
@@ -86,7 +87,7 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@id/Box3"
|
app:layout_constraintBottom_toTopOf="@id/Box3"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box1"
|
app:layout_constraintTop_toBottomOf="@id/name_box"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@
|
|||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/BigFont"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/Balk3"
|
app:layout_constraintStart_toStartOf="@id/Balk3"
|
||||||
|
|||||||
@@ -1,22 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:background="@color/primaryColour"
|
android:background="@color/primaryColour"
|
||||||
tools:context=".fragments.StatisticFragment">
|
tools:context=".fragments.StatisticFragment">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/primaryColour"
|
|
||||||
android:src="@drawable/ic_back_button_24"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textView"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/textView" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -30,15 +20,15 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/Box1"
|
android:id="@+id/name_box"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:background="@color/secondaryColour"
|
||||||
app:layout_constraintBottom_toTopOf="@id/Box2"
|
app:layout_constraintBottom_toTopOf="@id/Box2"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
app:layout_constraintTop_toBottomOf="@id/textView"
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
@@ -61,13 +51,13 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/statistics_km"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text=" km"
|
android:text="@string/km"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@@ -87,7 +77,7 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@id/Box3"
|
app:layout_constraintBottom_toTopOf="@id/Box3"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box1"
|
app:layout_constraintTop_toBottomOf="@id/name_box"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
@@ -113,9 +103,10 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/statistics_locations_visited"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="GETAL"
|
android:text="@string/getal"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@@ -135,8 +126,7 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@id/Box4"
|
app:layout_constraintBottom_toTopOf="@id/Box4"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box2"
|
app:layout_constraintTop_toBottomOf="@id/Box2">
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -162,7 +152,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text=" minuten"
|
android:text="@string/minuten"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@@ -177,14 +167,14 @@
|
|||||||
android:id="@+id/Box4"
|
android:id="@+id/Box4"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:background="@color/secondaryColour"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.85"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/Box3"
|
|
||||||
android:background="@color/secondaryColour"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
|
|
||||||
>
|
app:layout_constraintTop_toBottomOf="@id/Box3">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -205,13 +195,13 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/couponAmount"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="GETAL"
|
android:text="@string/getal"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@@ -219,6 +209,31 @@
|
|||||||
app:layout_constraintStart_toStartOf="@id/Balk4"
|
app:layout_constraintStart_toStartOf="@id/Balk4"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/coupon_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:background="@drawable/ic_back_button_24"
|
||||||
|
android:scaleX="-1"
|
||||||
|
android:text="@string/terug"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/couponAmount"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/couponAmount" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/statistics_back_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@drawable/ic_back_button_24"
|
||||||
|
android:backgroundTint="@color/buttonColour"
|
||||||
|
android:src="@drawable/ic_back_button_24"
|
||||||
|
android:text="@string/terug"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
@@ -7,20 +8,26 @@
|
|||||||
android:layout_margin="20dp">
|
android:layout_margin="20dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/location_image"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:id="@+id/location_image"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
/>
|
app:layout_constraintEnd_toStartOf="@id/location_name"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="1.0" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/location_name"
|
android:id="@+id/location_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="321dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="47dp"
|
||||||
android:gravity="center"
|
android:gravity="left"
|
||||||
android:text="location"
|
android:text="@string/locaties"
|
||||||
android:textSize="20dp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintStart_toEndOf="@+id/routeImage" />
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
@@ -9,19 +10,20 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:id="@+id/routeImage"
|
android:id="@+id/route_Image"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/route_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/routeName"
|
|
||||||
android:text="test text"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="20dp"
|
android:text="@string/titel"
|
||||||
app:layout_constraintStart_toEndOf="@+id/routeImage"
|
android:textSize="20sp"
|
||||||
/>
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/route_Image"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/locations"
|
android:id="@+id/locations"
|
||||||
android:title="@string/locations"
|
android:title="@string/locaties"
|
||||||
android:icon="@drawable/ic_baseline_outlined_flag_24"
|
android:icon="@drawable/ic_baseline_outlined_flag_24"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -15,13 +15,13 @@
|
|||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/statistics"
|
android:id="@+id/statistics"
|
||||||
android:title="@string/statistics"
|
android:title="@string/statistieken"
|
||||||
android:icon="@drawable/ic_baseline_graphic_eq_24"
|
android:icon="@drawable/ic_baseline_graphic_eq_24"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/settings"
|
android:id="@+id/settings"
|
||||||
android:title="@string/settings"
|
android:title="@string/instellingen"
|
||||||
android:icon="@drawable/ic_baseline_settings_24"
|
android:icon="@drawable/ic_baseline_settings_24"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -10,4 +10,5 @@
|
|||||||
<color name="primaryColour">#FF115571</color>
|
<color name="primaryColour">#FF115571</color>
|
||||||
<color name="secondaryColour">#FF31AFB4</color>
|
<color name="secondaryColour">#FF31AFB4</color>
|
||||||
<color name="buttonColour">#FF14212D</color>
|
<color name="buttonColour">#FF14212D</color>
|
||||||
|
<color name="red">#FF0000</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -17,4 +17,5 @@
|
|||||||
<string name="coupons_gespaard">Coupons gespaard:</string>
|
<string name="coupons_gespaard">Coupons gespaard:</string>
|
||||||
<string name="coupons">Coupons</string>
|
<string name="coupons">Coupons</string>
|
||||||
<string name="start_route">Start Route</string>
|
<string name="start_route">Start Route</string>
|
||||||
|
<string name="route_stop_toast">Route stopped!</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -7,5 +7,16 @@
|
|||||||
<item name="colorSecondary">@color/secondaryColour</item>
|
<item name="colorSecondary">@color/secondaryColour</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorButtonNormal">@color/buttonColour</item>
|
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||||
|
<item name="android:textSize">16sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.NextLocationBig" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/primaryColour</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/secondaryColour</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||||
|
<item name="android:textSize">24sp</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
32
app/src/test/java/com/a1/nextlocation/CouponTestClass.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package com.a1.nextlocation;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class CouponTestClass {
|
||||||
|
private Coupon testCoupon;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void init(){
|
||||||
|
testCoupon = new Coupon("TESTCODE", "REWARDISTRUE");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetCode() {
|
||||||
|
testCoupon.setCode("testing");
|
||||||
|
String expected = "testing";
|
||||||
|
assertEquals(expected, testCoupon.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetReward() {
|
||||||
|
testCoupon.setReward("testreward");
|
||||||
|
String expected = "testreward";
|
||||||
|
assertNotNull(testCoupon.getReward());
|
||||||
|
assertEquals(expected, testCoupon.getReward());
|
||||||
|
}
|
||||||
|
}
|
||||||
81
app/src/test/java/com/a1/nextlocation/DataTestClass.java
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package com.a1.nextlocation;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
import com.a1.nextlocation.data.Data;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DataTestClass {
|
||||||
|
private Data data;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void init(){
|
||||||
|
data = new Data();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetDistanceTraveled() {
|
||||||
|
data.setDistanceTraveled(100);
|
||||||
|
|
||||||
|
int expected = 100;
|
||||||
|
assertEquals(expected, data.getDistanceTraveled(), 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetLocationsVisited() {
|
||||||
|
data.setLocationsVisited(16);
|
||||||
|
|
||||||
|
int expected = 16;
|
||||||
|
assertEquals(expected, data.getLocationsVisited());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetTotalTime() {
|
||||||
|
data.setTotalTime(120);
|
||||||
|
|
||||||
|
int expected = 120;
|
||||||
|
assertEquals(expected, data.getTotalTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetCouponList() {
|
||||||
|
List<Coupon> expected = new ArrayList<>();
|
||||||
|
expected.add(new Coupon("CODE1", "REWARD1"));
|
||||||
|
expected.add(new Coupon("CODE2", "REWARD2"));
|
||||||
|
expected.add(new Coupon("CODE3", "REWARD3"));
|
||||||
|
|
||||||
|
data.setCouponList(expected);
|
||||||
|
assertEquals(expected, data.getCouponList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNextLocation() {
|
||||||
|
Location expected = new Location("name1", "cord1", "desc1", null);
|
||||||
|
data.setNextLocation(expected);
|
||||||
|
assertEquals(expected, data.getNextLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLastLocation() {
|
||||||
|
Location expected = new Location("name2", "cord2", "desc2", null);
|
||||||
|
data.setLastLocation(expected);
|
||||||
|
assertEquals(expected, data.getLastLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCurrentRoute() {
|
||||||
|
Route expected = new Route("testRoute1");
|
||||||
|
data.setCurrentRoute(expected);
|
||||||
|
assertEquals(expected, data.getCurrentRoute());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
57
app/src/test/java/com/a1/nextlocation/FileIOTest.java
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
package com.a1.nextlocation;
|
||||||
|
|
||||||
|
import android.app.Instrumentation;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.InstrumentationInfo;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.FileIO;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
import static org.mockito.MockitoAnnotations.initMocks;
|
||||||
|
|
||||||
|
public class FileIOTest {
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
// public void testReadFileIO() {
|
||||||
|
// //System.out.println(Arrays.toString(mMockContext.fileList()));
|
||||||
|
// Context mMockContext = mock(MainActivity.class);
|
||||||
|
// List<Route> expected = new ArrayList<>();
|
||||||
|
// Route testRoute = new Route("rondje stad");
|
||||||
|
// testRoute.addLocation(new Location("kees kroket", "2.4654645,6.2342323", "lekkere patatjes", null));
|
||||||
|
// testRoute.setTotalDistance(2.3434f);
|
||||||
|
// testRoute.setTotalTime(342342);
|
||||||
|
// expected.add(testRoute);
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// FileIO<ArrayList<Route>> fileIO = new FileIO<>();
|
||||||
|
// ArrayList<Route> res = fileIO.readFileData(context, "routes.json",new TypeToken<ArrayList<Route>>(){}.getType());
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// if (mMockContext.getAssets() == null)
|
||||||
|
// System.out.println("daar ga je");
|
||||||
|
//
|
||||||
|
// FileIO<ArrayList<Route>> fileIO = new FileIO<>();
|
||||||
|
// ArrayList<Route> res = fileIO.readFileData(mMockContext, "routes.json", new TypeToken<ArrayList<Route>>(){}.getType());
|
||||||
|
//
|
||||||
|
// assertEquals(expected, res);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
97
app/src/test/java/com/a1/nextlocation/LocationTest.java
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
package com.a1.nextlocation;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.osmdroid.util.GeoPoint;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class LocationTest {
|
||||||
|
private Location testLocation;
|
||||||
|
@Before
|
||||||
|
public void init(){
|
||||||
|
testLocation = new Location("testName", "15.4,27.5", "testDesc", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nameTest(){
|
||||||
|
String testName = "nameTestName";
|
||||||
|
|
||||||
|
String expectedBefore = "testName";
|
||||||
|
String expectedAfter = "nameTestName";
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, testLocation.getName());
|
||||||
|
testLocation.setName(testName);
|
||||||
|
assertEquals(expectedAfter, testLocation.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void coordinatesTest(){
|
||||||
|
String testCoordinaates = "32.4,15.7";
|
||||||
|
|
||||||
|
String expectedBefore = "15.4,27.5";
|
||||||
|
String expectedAfter = "32.4,15.7";
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, testLocation.getCoordinates());
|
||||||
|
testLocation.setCoordinates(testCoordinaates);
|
||||||
|
assertEquals(expectedAfter, testLocation.getCoordinates());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void descriptionTest(){
|
||||||
|
String testDescription = "This description is a test!";
|
||||||
|
|
||||||
|
String expectedBefore = "testDesc";
|
||||||
|
String expectedAfter = "This description is a test!";
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, testLocation.getDescription());
|
||||||
|
testLocation.setDescription(testDescription);
|
||||||
|
assertEquals(expectedAfter, testLocation.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void ImageURLTest(){
|
||||||
|
String testURL = "https://i.imgur.com/FvohwaS.png";
|
||||||
|
|
||||||
|
String expectedBefore = null;
|
||||||
|
String expectedAfter = "https://i.imgur.com/FvohwaS.png";
|
||||||
|
|
||||||
|
assertEquals(expectedBefore ,testLocation.getImageUrl());
|
||||||
|
testLocation.setImageUrl(testURL);
|
||||||
|
assertEquals(expectedAfter, testLocation.getImageUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void coordinateDoublesTest(){
|
||||||
|
double[] testDoubles = new double[2];
|
||||||
|
testDoubles[0] = 15.4;
|
||||||
|
testDoubles[1] = 27.5;
|
||||||
|
|
||||||
|
double [] expectedCoordAsDouble = testDoubles;
|
||||||
|
String expectedStringFromDouble = "15.4,27.5";
|
||||||
|
|
||||||
|
assertArrayEquals(expectedCoordAsDouble, testLocation.getCoordinatesAsDoubles(), 0.1);
|
||||||
|
assertEquals(expectedStringFromDouble, testLocation.getStringFromCoordinates(testDoubles[0], testDoubles[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void geoPointTest(){
|
||||||
|
String testGeoPointCoords = "30.3,55.5";
|
||||||
|
|
||||||
|
GeoPoint expectedBefore = new GeoPoint(15.4, 27.5);
|
||||||
|
GeoPoint expectedAfter = new GeoPoint(30.3, 55.5);
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, testLocation.convertToGeoPoint());
|
||||||
|
testLocation.setCoordinates(testGeoPointCoords);
|
||||||
|
assertEquals(expectedAfter, testLocation.convertToGeoPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void AlternateConstructorTest(){
|
||||||
|
Location alternateTestLocation = new Location("testName", 15.4, 27.5, "testDesc", null);
|
||||||
|
|
||||||
|
assertNotNull(alternateTestLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
93
app/src/test/java/com/a1/nextlocation/RouteTest.java
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
package com.a1.nextlocation;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class RouteTest {
|
||||||
|
private Route route;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void init(){
|
||||||
|
route = new Route("testName");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nameTest(){
|
||||||
|
String testName = "secondTestName";
|
||||||
|
|
||||||
|
String expectedBefore = "testName";
|
||||||
|
String expectedAfter = "secondTestName";
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, route.getName());
|
||||||
|
route.setName(testName);
|
||||||
|
assertEquals(expectedAfter, route.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLocationsTest(){
|
||||||
|
List<Location> expected = new ArrayList<>();
|
||||||
|
|
||||||
|
assertEquals(expected, route.getLocations());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void SetLocationsTest(){
|
||||||
|
List<Location> testList = new ArrayList<>();
|
||||||
|
testList.add(new Location("name1", "coord1", "desc1", null));
|
||||||
|
testList.add(new Location("name2", "coord2", "desc2", null));
|
||||||
|
testList.add(new Location("name3", "coord3", "desc3", null));
|
||||||
|
|
||||||
|
List<Location> expectedBefore = new ArrayList<>();
|
||||||
|
List<Location> expectedAfter = testList;
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, route.getLocations());
|
||||||
|
route.setLocations(testList);
|
||||||
|
assertEquals(expectedAfter, route.getLocations());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void AddLocationTest(){
|
||||||
|
Location testLocation = new Location("testLocationName", "testCoordinates", "testDescription", null);
|
||||||
|
|
||||||
|
List<Location> expectedBefore = new ArrayList<>();
|
||||||
|
List<Location> expectedAfter = new ArrayList<>();
|
||||||
|
expectedAfter.add(testLocation);
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, route.getLocations());
|
||||||
|
route.addLocation(testLocation);
|
||||||
|
assertEquals(expectedAfter, route.getLocations());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void totalDistanceTest(){
|
||||||
|
float testDistance = 523;
|
||||||
|
|
||||||
|
float expectedBefore = 0;
|
||||||
|
float expectedAfter = 523;
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, route.getTotalDistance(), 0.01);
|
||||||
|
route.setTotalDistance(testDistance);
|
||||||
|
assertEquals(expectedAfter, route.getTotalDistance(), 0.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void totalTimeTest(){
|
||||||
|
int testTime = 36;
|
||||||
|
|
||||||
|
int expectedBefore = 0;
|
||||||
|
int expectedAfter = 36;
|
||||||
|
|
||||||
|
assertEquals(expectedBefore, route.getTotalTime());
|
||||||
|
route.setTotalTime(testTime);
|
||||||
|
assertEquals(expectedAfter, route.getTotalTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||