Compare commits
62 Commits
data
...
couponPopu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
678b179e04 | ||
|
|
1b770020ed | ||
|
|
e761dd80e5 | ||
|
|
79e24621e2 | ||
|
|
1549fc7a59 | ||
|
|
edcfd2ff0a | ||
|
|
547d676a68 | ||
|
|
d96a54863c | ||
|
|
2118336815 | ||
|
|
ff32eefab0 | ||
|
|
e2bccb6e76 | ||
|
|
c355f64d38 | ||
|
|
91c0435e55 | ||
|
|
9ca3b12d71 | ||
|
|
70a9878b06 | ||
|
|
294814dea8 | ||
|
|
6b197c4742 | ||
|
|
a3d8bdfd77 | ||
|
|
6f10444126 | ||
|
|
1ca13e3a6b | ||
|
|
1f7cd49a90 | ||
|
|
9c4eb98fb4 | ||
|
|
610b23b056 | ||
|
|
aba26f3211 | ||
|
|
95a2e4e849 | ||
|
|
74fb4440ed | ||
|
|
6c923d27b2 | ||
|
|
17d977bb17 | ||
|
|
b52c5556d2 | ||
|
|
70342c6506 | ||
|
|
311a794a69 | ||
|
|
dbc10014f9 | ||
|
|
1f835a94b0 | ||
|
|
12c8d6a62d | ||
|
|
9e8e9f4cdd | ||
|
|
1d48ada0ab | ||
|
|
6a07ce77f0 | ||
|
|
5edf50c808 | ||
|
|
db7d944a41 | ||
|
|
3f132f48a7 | ||
|
|
17f624cc30 | ||
|
|
4f68398f33 | ||
|
|
4229acf87c | ||
|
|
521c9fd188 | ||
|
|
1fd245f4f0 | ||
|
|
8d210a9707 | ||
|
|
ee1ae23e0f | ||
|
|
49f78efdd3 | ||
|
|
512ad3980f | ||
|
|
e2f76c94f7 | ||
|
|
2479563474 | ||
|
|
ea59b97f0f | ||
|
|
75b7ff47cd | ||
|
|
a2d1ecfc71 | ||
|
|
996b061b65 | ||
|
|
ad6e171a14 | ||
|
|
16b9b15856 | ||
|
|
63c49c40d7 | ||
|
|
13b73fb0de | ||
|
|
e5fa7db27d | ||
|
|
aee2797a0f | ||
|
|
12b446b679 |
@@ -30,11 +30,6 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
def room_version = "2.2.5"
|
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
|
||||||
|
|
||||||
//gson
|
//gson
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
|
||||||
|
|||||||
10
app/src/main/assets/coupons.json
Normal file
10
app/src/main/assets/coupons.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "KROKET10",
|
||||||
|
"reward": "Gratis 2e kroket bij Kees Kroket™"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "654",
|
||||||
|
"reward": ",juygly"
|
||||||
|
}
|
||||||
|
]
|
||||||
135
app/src/main/assets/locations.json
Normal file
135
app/src/main/assets/locations.json
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name":"McDonald's Breda Karnemelkstraat",
|
||||||
|
"coordinates":"51.58596318905295,4.77586651481887",
|
||||||
|
"description":"McDonald's restaurant",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Subway Karnemelkstraat 10 A, 1",
|
||||||
|
"coordinates":"51.58632782568612,4.775219531501114",
|
||||||
|
"description":"4811 KJ Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Wok To Go Halstraat 40",
|
||||||
|
"coordinates":"51.58650312572897,4.777467069592386",
|
||||||
|
"description":"4811HX Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"De Boterhal Grote Markt 19",
|
||||||
|
"coordinates":"51.588069667604756,4.7762685632180695",
|
||||||
|
"description":"4811XL Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Gauchos Grote Markt 33",
|
||||||
|
"coordinates":"51.58859328857082,4.77601349563689",
|
||||||
|
"description":"4811XP Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"The Tosti Club Breda A4, Vlaszak 2",
|
||||||
|
"coordinates":"51.58905632735254,4.780729463841719",
|
||||||
|
"description":"4811GR Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Coffee & Lunch 4 you Oude Vest 31",
|
||||||
|
"coordinates":"51.58741730235298,4.779832967540571",
|
||||||
|
"description":"4811HS Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"t Zusje Breda Vismarktstraat 28",
|
||||||
|
"coordinates":"51.590133292554434,4.773911506170458",
|
||||||
|
"description":"4811WE Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"VR-World Nassaustraat 2",
|
||||||
|
"coordinates":"51.5913566342086,4.786256804321071",
|
||||||
|
"description":"4811DD Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Kees Kroket Houtmarkt 9",
|
||||||
|
"coordinates":"51.58647180329833,4.77741809637617",
|
||||||
|
"description":"KEEEEES KROKET!",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Prison Escape Kloosterlaan 168",
|
||||||
|
"coordinates":"51.59073795635181,4.784917104321059",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Beach & Lounge club Spider “rooftop bar” Nieuwe Prinsenkade",
|
||||||
|
"coordinates":"51.59212977605884,4.774043765582372",
|
||||||
|
"description":"4811VC Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Koningin Wilhelmina Paviljoen Kraanstraat 4b",
|
||||||
|
"coordinates":"51.590645369292396,4.776045124415531",
|
||||||
|
"description":"4811XV Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Hercules en de Nemeïsche leeuw",
|
||||||
|
"coordinates":"51.59130522182325,4.778161739135078",
|
||||||
|
"description":"4811XJ Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Nassau-Baroniemonument - 1905 - Pierre Cuypers Delpratsingel 1",
|
||||||
|
"coordinates":"51.592530636759136,4.780278353833301",
|
||||||
|
"description":"4811AM Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Station Breda Gravinnen van Nassauboulevard 43",
|
||||||
|
"coordinates":"51.59569850758307,4.780295549958155",
|
||||||
|
"description":"4815CA Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"Belcrum Beach Veilingkade 12a",
|
||||||
|
"coordinates":"51.599434239284726,4.76632797992092",
|
||||||
|
"description":"4815HC Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"De Belcrum Watertoren (1935) Speelhuislaan 158",
|
||||||
|
"coordinates":"51.60135351009892,4.7705765989322755",
|
||||||
|
"description":"4815CJ Breda",
|
||||||
|
"imageUrl":"NULL"
|
||||||
|
}
|
||||||
|
]
|
||||||
14
app/src/main/assets/routes.json
Normal file
14
app/src/main/assets/routes.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "rondje stad",
|
||||||
|
"locations": [
|
||||||
|
{
|
||||||
|
"name": "KesCrOkÊt breeda",
|
||||||
|
"coordinates": "2.4654645,6.2342323",
|
||||||
|
"description": "lekkere patatjes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalDistance": 2.3434,
|
||||||
|
"totalTime": 342342
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,13 +1,24 @@
|
|||||||
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.FragmentTransaction;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.fragments.HomeFragment;
|
||||||
|
import com.a1.nextlocation.fragments.RouteFragment;
|
||||||
|
import com.a1.nextlocation.fragments.SettingsFragment;
|
||||||
|
import com.a1.nextlocation.fragments.StatisticFragment;
|
||||||
|
import com.a1.nextlocation.recyclerview.CouponListManager;
|
||||||
|
import com.a1.nextlocation.recyclerview.LocationListManager;
|
||||||
|
import com.a1.nextlocation.recyclerview.RouteListManager;
|
||||||
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -16,5 +27,40 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
BottomNavigationView bottomNav = findViewById(R.id.navbar);
|
||||||
|
bottomNav.setOnNavigationItemSelectedListener(navListener);
|
||||||
|
|
||||||
|
LocationListManager.INSTANCE.setContext(this);
|
||||||
|
LocationListManager.INSTANCE.load();
|
||||||
|
CouponListManager.INSTANCE.setContext(this);
|
||||||
|
CouponListManager.INSTANCE.load();
|
||||||
|
RouteListManager.INSTANCE.setContext(this);
|
||||||
|
RouteListManager.INSTANCE.load();
|
||||||
|
|
||||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new HomeFragment()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private BottomNavigationView.OnNavigationItemSelectedListener navListener = item -> {
|
||||||
|
Fragment selectedFragment = null;
|
||||||
|
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.locations:
|
||||||
|
selectedFragment = new HomeFragment();
|
||||||
|
break;
|
||||||
|
case R.id.routes:
|
||||||
|
selectedFragment = new RouteFragment();
|
||||||
|
break;
|
||||||
|
case R.id.statistics:
|
||||||
|
selectedFragment = new StatisticFragment();
|
||||||
|
break;
|
||||||
|
case R.id.settings:
|
||||||
|
selectedFragment = new SettingsFragment();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, selectedFragment).commit();
|
||||||
|
return true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,18 @@
|
|||||||
package com.a1.nextlocation.data;
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.room.ColumnInfo;
|
|
||||||
import androidx.room.Entity;
|
|
||||||
import androidx.room.PrimaryKey;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@Entity(tableName = "coupon")
|
|
||||||
public class Coupon {
|
public class Coupon {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fields need to be public for the database to be able to use them
|
* fields need to be public for the database to be able to use them
|
||||||
*/
|
*/
|
||||||
@PrimaryKey
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@ColumnInfo(name = "code")
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@ColumnInfo(name = "reward")
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String reward;
|
private String reward;
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +1,24 @@
|
|||||||
package com.a1.nextlocation.data;
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.room.ColumnInfo;
|
|
||||||
import androidx.room.Entity;
|
|
||||||
import androidx.room.Ignore;
|
|
||||||
import androidx.room.PrimaryKey;
|
|
||||||
import androidx.room.TypeConverters;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.db.CouponListTypeConverter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity(tableName = "userdata")
|
|
||||||
public class Data {
|
public class Data {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PrimaryKey
|
|
||||||
@NonNull
|
|
||||||
@ColumnInfo(name = "distance_traveled")
|
|
||||||
private float distanceTraveled;
|
private float distanceTraveled;
|
||||||
|
|
||||||
@ColumnInfo(name = "locations_visited")
|
|
||||||
private int locationsVisited;
|
private int locationsVisited;
|
||||||
|
|
||||||
@ColumnInfo(name = "total_time")
|
|
||||||
private int totalTime;
|
private int totalTime;
|
||||||
|
|
||||||
@TypeConverters(CouponListTypeConverter.class)
|
|
||||||
private List<Coupon> couponList;
|
private List<Coupon> couponList;
|
||||||
|
|
||||||
@Ignore
|
|
||||||
private Location nextLocation;
|
private Location nextLocation;
|
||||||
|
|
||||||
@Ignore
|
|
||||||
private Location lastLocation;
|
private Location lastLocation;
|
||||||
|
|
||||||
@Ignore
|
|
||||||
private Route currentRoute;
|
private Route currentRoute;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,56 @@
|
|||||||
package com.a1.nextlocation.data;
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
public class FileIO {
|
import android.content.Context;
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
public static void readFileData() {
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
public class FileIO<T> {
|
||||||
|
private final String TAG = FileIO.class.getCanonicalName();
|
||||||
|
|
||||||
|
|
||||||
|
public T readFileData(Context context, String fileName, Type typeOf) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
AssetManager am = context.getAssets();
|
||||||
|
T res = null;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
try {
|
||||||
|
InputStream is = am.open(fileName);
|
||||||
|
InputStreamReader inputStreamReader = new InputStreamReader(is);
|
||||||
|
BufferedReader reader = new BufferedReader(inputStreamReader);
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine())!= null) {
|
||||||
|
sb.append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Log.d(TAG, "readFileData: got string: " + sb.toString());
|
||||||
|
res = gson.fromJson(sb.toString(),typeOf);
|
||||||
|
Log.d(TAG, "readFileData: got object: " + res);
|
||||||
|
|
||||||
|
reader.close();
|
||||||
|
inputStreamReader.close();
|
||||||
|
is.close();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.d(TAG, "readFileData: exception! " + e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeFileData() {
|
public void writeFileData(T objectToWrite) {
|
||||||
|
//TODO make
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,59 @@
|
|||||||
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.room.Entity;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.room.PrimaryKey;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.osmdroid.util.GeoPoint;
|
||||||
|
|
||||||
@Entity(tableName = "location")
|
public class Location implements Parcelable {
|
||||||
public class Location {
|
|
||||||
|
|
||||||
@PrimaryKey
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* coordinates will be saved as for example: 2.434343,4.65656;3.656565,6.43434
|
||||||
|
* so lat1,long1;lat2,long2
|
||||||
|
*/
|
||||||
private String coordinates;
|
private String coordinates;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public Location(@NotNull String name, String coordinates, String description) {
|
@Nullable
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
public Location(@NotNull String name, String coordinates, String description, @Nullable String imageUrl) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.coordinates = coordinates;
|
this.coordinates = coordinates;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Location(@NotNull String name, double latCoord, double longCoord, String description, @Nullable String imageUrl) {
|
||||||
|
this(name,getStringFromCoordinates(latCoord,longCoord),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;
|
||||||
@@ -46,4 +78,50 @@ public class Location {
|
|||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageUrl(@Nullable String imageUrl) {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] getCoordinatesAsDoubles() {
|
||||||
|
double[] res = new double[2];
|
||||||
|
res[0] = getLat();
|
||||||
|
res[1] = getLong();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLat() {
|
||||||
|
return Double.parseDouble(this.coordinates.split(",")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLong() {
|
||||||
|
return Double.parseDouble(this.coordinates.split(",")[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getStringFromCoordinates(double lat1, double long1) {
|
||||||
|
return lat1 + "," + long1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoPoint convertToGeoPoint() {
|
||||||
|
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,32 +1,28 @@
|
|||||||
package com.a1.nextlocation.data;
|
package com.a1.nextlocation.data;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import android.os.Parcel;
|
||||||
import androidx.room.ColumnInfo;
|
import android.os.Parcelable;
|
||||||
import androidx.room.Entity;
|
|
||||||
import androidx.room.PrimaryKey;
|
|
||||||
import androidx.room.TypeConverters;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.db.LocationListTypeConverter;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity(tableName = "route")
|
public class Route implements Parcelable {
|
||||||
public class Route {
|
|
||||||
|
|
||||||
@PrimaryKey
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@TypeConverters(LocationListTypeConverter.class)
|
|
||||||
private List<Location> locations;
|
private List<Location> locations;
|
||||||
|
|
||||||
@ColumnInfo(name = "total_distance")
|
|
||||||
private float totalDistance;
|
private float totalDistance;
|
||||||
|
|
||||||
@ColumnInfo(name = "total_time")
|
|
||||||
private int totalTime;
|
private int totalTime;
|
||||||
|
|
||||||
public Route(@NotNull String name) {
|
public Route(@NotNull String name) {
|
||||||
@@ -36,6 +32,25 @@ public class Route {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@@ -76,4 +91,16 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db;
|
|
||||||
|
|
||||||
import androidx.room.TypeConverter;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Coupon;
|
|
||||||
import com.a1.nextlocation.data.Route;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CouponListTypeConverter {
|
|
||||||
private static Gson gson = new Gson();
|
|
||||||
|
|
||||||
@TypeConverter
|
|
||||||
public static List<Coupon> toRoutesList(String data) {
|
|
||||||
if (data == null) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
Type listType = new TypeToken<List<Coupon>>() {}.getType();
|
|
||||||
|
|
||||||
return gson.fromJson(data,listType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TypeConverter
|
|
||||||
public static String fromRoutesList(List<Coupon> list) {
|
|
||||||
return gson.toJson(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.room.Room;
|
|
||||||
import androidx.room.RoomDatabase;
|
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
|
||||||
|
|
||||||
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 com.a1.nextlocation.data.db.dao.CouponDao;
|
|
||||||
import com.a1.nextlocation.data.db.dao.DataDao;
|
|
||||||
import com.a1.nextlocation.data.db.dao.LocationDao;
|
|
||||||
import com.a1.nextlocation.data.db.dao.RouteDao;
|
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sem
|
|
||||||
*/
|
|
||||||
@androidx.room.Database(entities = {Coupon.class,Route.class, Location.class, Data.class},version = 1,exportSchema = false)
|
|
||||||
public abstract class Database extends RoomDatabase {
|
|
||||||
|
|
||||||
public abstract RouteDao routeDao();
|
|
||||||
public abstract CouponDao couponDao();
|
|
||||||
public abstract LocationDao locationDao();
|
|
||||||
public abstract DataDao dataDao();
|
|
||||||
|
|
||||||
private static volatile Database INSTANCE;
|
|
||||||
private static final int NUMBER_OF_THREADS = 4;
|
|
||||||
static final ExecutorService databaseWriterExecutor = Executors.newFixedThreadPool(NUMBER_OF_THREADS);
|
|
||||||
|
|
||||||
public static Database getDatabase(final Context context) {
|
|
||||||
if (INSTANCE == null){
|
|
||||||
synchronized (Database.class) {
|
|
||||||
if (INSTANCE == null) {
|
|
||||||
|
|
||||||
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
|
||||||
Database.class,"next_location_db").addCallback(callback).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static RoomDatabase.Callback callback = new RoomDatabase.Callback() {
|
|
||||||
@Override
|
|
||||||
public void onCreate(@NonNull SupportSQLiteDatabase db) {
|
|
||||||
super.onCreate(db);
|
|
||||||
|
|
||||||
databaseWriterExecutor.execute(() -> {
|
|
||||||
// TODO populate our database here
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db;
|
|
||||||
|
|
||||||
import androidx.room.TypeConverter;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Location;
|
|
||||||
import com.a1.nextlocation.data.Route;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class LocationListTypeConverter {
|
|
||||||
private static Gson gson = new Gson();
|
|
||||||
|
|
||||||
@TypeConverter
|
|
||||||
public static List<Location> toLocationList(String data) {
|
|
||||||
if (data == null) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
Type listType = new TypeToken<List<Location>>() {}.getType();
|
|
||||||
|
|
||||||
return gson.fromJson(data,listType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TypeConverter
|
|
||||||
public static String fromLocationList(List<Location> list) {
|
|
||||||
return gson.toJson(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.dao;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.room.Dao;
|
|
||||||
import androidx.room.Insert;
|
|
||||||
import androidx.room.OnConflictStrategy;
|
|
||||||
import androidx.room.Query;
|
|
||||||
import androidx.room.Update;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Coupon;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Dao
|
|
||||||
public interface CouponDao {
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
||||||
void insertAll(Coupon... coupons);
|
|
||||||
|
|
||||||
@Query("DELETE FROM coupon")
|
|
||||||
void deleteAll();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM coupon")
|
|
||||||
LiveData<List<Coupon>> selectAll();
|
|
||||||
|
|
||||||
/*
|
|
||||||
to add an observer to the livedata, you can use the example from https://medium.com/mindorks/using-room-database-with-livedata-android-jetpack-cbf89b677b47
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Query("SELECT * FROM coupon WHERE code = :code LIMIT 1")
|
|
||||||
Coupon selectCouponByCode(String code);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.dao;
|
|
||||||
|
|
||||||
import androidx.room.Dao;
|
|
||||||
import androidx.room.Insert;
|
|
||||||
import androidx.room.OnConflictStrategy;
|
|
||||||
import androidx.room.Query;
|
|
||||||
import androidx.room.Update;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Data;
|
|
||||||
|
|
||||||
@Dao
|
|
||||||
public interface DataDao {
|
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
||||||
void insertAll(Data... datas);
|
|
||||||
|
|
||||||
@Update
|
|
||||||
void update(Data data);
|
|
||||||
|
|
||||||
@Query("DELETE FROM userdata")
|
|
||||||
void delete();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM userdata LIMIT 1")
|
|
||||||
Data getData();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.dao;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.room.Dao;
|
|
||||||
import androidx.room.Insert;
|
|
||||||
import androidx.room.OnConflictStrategy;
|
|
||||||
import androidx.room.Query;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Location;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Dao
|
|
||||||
public interface LocationDao {
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
||||||
void insertAll(Location... locations);
|
|
||||||
|
|
||||||
@Query("DELETE FROM location")
|
|
||||||
void deleteAll();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM location")
|
|
||||||
LiveData<List<Location>> selectAll();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM location WHERE name = :name LIMIT 1")
|
|
||||||
Location getLocationByName(String name);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.dao;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.room.Dao;
|
|
||||||
import androidx.room.Insert;
|
|
||||||
import androidx.room.Query;
|
|
||||||
import androidx.room.Update;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Route;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Dao
|
|
||||||
public interface RouteDao {
|
|
||||||
|
|
||||||
@Insert
|
|
||||||
void insertAll(Route... routes);
|
|
||||||
|
|
||||||
@Query("DELETE FROM route")
|
|
||||||
void deleteAll();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM route")
|
|
||||||
LiveData<List<Route>> getAll();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM route where name = :name LIMIT 1")
|
|
||||||
Route getRouteByName(String name);
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.repositories;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Coupon;
|
|
||||||
import com.a1.nextlocation.data.db.dao.CouponDao;
|
|
||||||
import com.a1.nextlocation.data.db.Database;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CouponRepository {
|
|
||||||
private CouponDao mCouponDao;
|
|
||||||
private LiveData<List<Coupon>> mAllCoupons;
|
|
||||||
|
|
||||||
public CouponRepository(Context context) {
|
|
||||||
Database db = Database.getDatabase(context);
|
|
||||||
mCouponDao = db.couponDao();
|
|
||||||
mAllCoupons = mCouponDao.selectAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<List<Coupon>> getAllCoupons() {
|
|
||||||
return mAllCoupons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coupon getCoupon(String code) {
|
|
||||||
return mCouponDao.selectCouponByCode(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.repositories;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Data;
|
|
||||||
import com.a1.nextlocation.data.db.Database;
|
|
||||||
import com.a1.nextlocation.data.db.dao.DataDao;
|
|
||||||
|
|
||||||
public class DataRepository {
|
|
||||||
private DataDao mDataDao;
|
|
||||||
private Data data;
|
|
||||||
|
|
||||||
public DataRepository(Context context) {
|
|
||||||
Database db = Database.getDatabase(context);
|
|
||||||
mDataDao = db.dataDao();
|
|
||||||
data = mDataDao.getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Data getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.repositories;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Location;
|
|
||||||
import com.a1.nextlocation.data.db.Database;
|
|
||||||
import com.a1.nextlocation.data.db.dao.LocationDao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class LocationRepository {
|
|
||||||
private LocationDao mLocationDao;
|
|
||||||
private LiveData<List<Location>> mAllLocations;
|
|
||||||
|
|
||||||
public LocationRepository(Context context) {
|
|
||||||
Database db = Database.getDatabase(context);
|
|
||||||
mLocationDao = db.locationDao();
|
|
||||||
mAllLocations = mLocationDao.selectAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<List<Location>> getAllLocations() {
|
|
||||||
return mAllLocations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getLocationByName(String name) {
|
|
||||||
return mLocationDao.getLocationByName(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.a1.nextlocation.data.db.repositories;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.data.Route;
|
|
||||||
import com.a1.nextlocation.data.db.Database;
|
|
||||||
import com.a1.nextlocation.data.db.dao.RouteDao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RouteRepository {
|
|
||||||
private RouteDao mRouteDao;
|
|
||||||
private LiveData<List<Route>> mAllRoutes;
|
|
||||||
|
|
||||||
public RouteRepository(Context context) {
|
|
||||||
Database db = Database.getDatabase(context);
|
|
||||||
mRouteDao = db.routeDao();
|
|
||||||
mAllRoutes = mRouteDao.getAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<List<Route>> getAllRoutes() {
|
|
||||||
return mAllRoutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Route getRouteByName(String name) {
|
|
||||||
return mRouteDao.getRouteByName(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +1,85 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
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.couponRecyclerView);
|
||||||
|
this.couponRecyclerView.setHasFixedSize(true);
|
||||||
|
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.couponBackButton);
|
||||||
|
this.imageButton.setOnClickListener(v -> {
|
||||||
|
StatisticFragment statisticFragment = new StatisticFragment();
|
||||||
|
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
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.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,29 +1,40 @@
|
|||||||
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.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
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 android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
import com.a1.nextlocation.recyclerview.CouponListManager;
|
||||||
|
import com.a1.nextlocation.recyclerview.CustomOverlay;
|
||||||
|
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.Overlay;
|
||||||
|
import org.osmdroid.views.overlay.OverlayItem;
|
||||||
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;
|
||||||
@@ -33,6 +44,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
private final String userAgent = "com.ai.nextlocation.fragments";
|
private final String userAgent = "com.ai.nextlocation.fragments";
|
||||||
|
private ImageButton imageButton;
|
||||||
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();
|
||||||
@@ -51,10 +63,16 @@ public class HomeFragment extends Fragment {
|
|||||||
@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);
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,7 +87,7 @@ public class HomeFragment extends Fragment {
|
|||||||
Configuration.getInstance().setUserAgentValue(userAgent);
|
Configuration.getInstance().setUserAgentValue(userAgent);
|
||||||
|
|
||||||
// create the map view
|
// create the map view
|
||||||
mapView = (MapView) view.findViewById(R.id.mapView);
|
mapView = view.findViewById(R.id.mapView);
|
||||||
mapView.setDestroyMode(false);
|
mapView.setDestroyMode(false);
|
||||||
mapView.setTag("mapView");
|
mapView.setTag("mapView");
|
||||||
mapView.setMultiTouchControls(true);
|
mapView.setMultiTouchControls(true);
|
||||||
@@ -88,6 +106,21 @@ public class HomeFragment extends Fragment {
|
|||||||
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);
|
||||||
@@ -95,6 +128,7 @@ public class HomeFragment extends Fragment {
|
|||||||
// add location manager and set the start point
|
// add location manager and set the start point
|
||||||
LocationManager locationManager = (LocationManager) requireActivity().getSystemService(Context.LOCATION_SERVICE);
|
LocationManager locationManager = (LocationManager) requireActivity().getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||||
GeoPoint startPoint = new GeoPoint(location.getLatitude(), location.getLongitude());
|
GeoPoint startPoint = new GeoPoint(location.getLatitude(), location.getLongitude());
|
||||||
|
|||||||
@@ -3,15 +3,19 @@ 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 com.a1.nextlocation.R;
|
import com.a1.nextlocation.R;
|
||||||
|
|
||||||
public class LocationDetailFragment extends Fragment {
|
public class LocationDetailFragment extends Fragment {
|
||||||
|
|
||||||
|
private ImageButton imageButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -21,7 +25,15 @@ public class LocationDetailFragment extends Fragment {
|
|||||||
@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_location_detail, container, false);
|
View view = 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();
|
||||||
|
// });
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,25 +3,65 @@ 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 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.CouponAdapter;
|
||||||
|
import com.a1.nextlocation.recyclerview.LocationAdapter;
|
||||||
|
import com.a1.nextlocation.recyclerview.LocationListManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
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.locationRecyclerView);
|
||||||
|
this.locationRecyclerView.setHasFixedSize(true);
|
||||||
|
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
|
||||||
|
this.imageButton = view.findViewById(R.id.locationBackButton);
|
||||||
|
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();
|
||||||
|
Bundle locationBundle = new Bundle();
|
||||||
|
locationBundle.putParcelable("location", 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,11 +7,16 @@ import androidx.fragment.app.Fragment;
|
|||||||
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.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;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -19,9 +24,16 @@ 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.routeDetailText = view.findViewById(R.id.routeDetailText);
|
||||||
|
this.routeDetailText.setText(this.route.getName());
|
||||||
|
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,15 +3,29 @@ 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 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 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.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class RouteFragment extends Fragment {
|
public class RouteFragment extends Fragment {
|
||||||
|
|
||||||
|
private RecyclerView routeRecyclerView;
|
||||||
|
private RecyclerView.LayoutManager layoutManager;
|
||||||
|
private List<Route> routeList;
|
||||||
|
private RouteAdapter routeAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -19,9 +33,27 @@ public class RouteFragment 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, container, false);
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_route, container, false);
|
this.routeRecyclerView = view.findViewById(R.id.routeRecyclerView);
|
||||||
|
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.routeRecyclerView.setLayoutManager(this.layoutManager);
|
||||||
|
this.routeRecyclerView.setAdapter(this.routeAdapter);
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.a1.nextlocation.fragments;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -23,15 +25,20 @@ public class SettingsFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
return inflater.inflate(R.layout.fragment_settings, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = getView();
|
|
||||||
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
dropdown.setAdapter(arrayAdapter);
|
dropdown.setAdapter(arrayAdapter);
|
||||||
|
|
||||||
return inflater.inflate(R.layout.fragment_settings, container, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,26 +2,51 @@ 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.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;
|
||||||
|
|
||||||
|
|
||||||
@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);
|
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()));
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.a1.nextlocation.network;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public enum ApiHandler {
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
|
||||||
|
private static String TAG = ApiHandler.class.getCanonicalName();
|
||||||
|
public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
|
||||||
|
private final String BASE_URL = "https://api.openrouteservice.org/v2/directions/";
|
||||||
|
private final String API_KEY = "5b3ce3597851110001cf6248d4eee2099f724255918adc71cc502b2a";
|
||||||
|
private final String DIRECTIONS_MODE = "foot_walking";
|
||||||
|
|
||||||
|
private OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
|
public Route getDirections(Location startLocation, Location endLocation) {
|
||||||
|
return getDirections(startLocation.getCoordinates(),endLocation.getCoordinates());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Route getDirections(double startLat, double startLong, double endLat, double endLong) {
|
||||||
|
return getDirections(startLat + "," + startLong, endLat + "," + endLong);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Route getDirections(String startLocation, String endLocation) {
|
||||||
|
String requestUrl = BASE_URL + DIRECTIONS_MODE + "?api_key=" + API_KEY + "&start=" +startLocation + "&end=" + endLocation;
|
||||||
|
AtomicReference<Route> res = null;
|
||||||
|
Thread t = new Thread(() -> {
|
||||||
|
|
||||||
|
Request request = new Request.Builder().url(requestUrl).build();
|
||||||
|
|
||||||
|
try (Response response = client.newCall(request).execute()) {
|
||||||
|
if (response.body() != null) {
|
||||||
|
String responseString = Objects.requireNonNull(response.body()).string();
|
||||||
|
Log.d(TAG, "getDirections: got response: " + responseString);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.d(TAG, "getDirections: caught exception: " + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
t.start();
|
||||||
|
|
||||||
|
try {
|
||||||
|
t.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return res.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,79 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class CouponAdapter {
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
class CouponViewHolder {
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponViewHolder> {
|
||||||
|
|
||||||
|
private Context appContext;
|
||||||
|
private List<Coupon> couponList;
|
||||||
|
private OnItemClickListener clickListener;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(int clickedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
class CouponViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
|
private TextView couponCode;
|
||||||
|
private TextView couponReward;
|
||||||
|
|
||||||
|
public CouponViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setTextViewName(String text){
|
||||||
|
this.couponReward = itemView.findViewById(R.id.coupon_name);
|
||||||
|
this.couponReward.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
clickListener.onItemClick(getAdapterPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CouponAdapter(Context context, List<Coupon> coupon, OnItemClickListener listener){
|
||||||
|
this.appContext = context;
|
||||||
|
this.couponList = coupon;
|
||||||
|
this.clickListener = listener;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CouponAdapter(Context context, List<Coupon> coupon) {
|
||||||
|
this.appContext = context;
|
||||||
|
this.couponList = coupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public CouponViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.coupon_item, parent, false);
|
||||||
|
return new CouponViewHolder(itemView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull CouponViewHolder holder, int position) {
|
||||||
|
Coupon coupon = couponList.get(position);
|
||||||
|
holder.setTextViewName(coupon.getReward());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return couponList.size();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class CouponListManager {
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public enum CouponListManager {
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
private List<Coupon> couponList;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public void setContext(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
this.couponList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Coupon> getCouponList() {
|
||||||
|
return couponList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Coupon getCoupon(int place) {
|
||||||
|
return couponList.get(place);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load(){
|
||||||
|
CouponLoader couponLoader = new CouponLoader(this.context);
|
||||||
|
this.couponList = couponLoader.load();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,30 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class CouponLoader {
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Coupon;
|
||||||
|
import com.a1.nextlocation.data.FileIO;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CouponLoader implements Loader<List<Coupon>> {
|
||||||
|
private final Context context;
|
||||||
|
private final String TAG = CouponLoader.class.getCanonicalName();
|
||||||
|
|
||||||
|
public CouponLoader(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<Coupon> load() {
|
||||||
|
FileIO<ArrayList<Coupon>> fileIO = new FileIO<>();
|
||||||
|
ArrayList<Coupon> res = fileIO.readFileData(context, "coupons.json",new TypeToken<ArrayList<Coupon>>(){}.getType());
|
||||||
|
Log.d(TAG, "load: " + res);
|
||||||
|
|
||||||
|
return res == null ? new ArrayList<>() : res;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import org.osmdroid.api.IMapView;
|
||||||
|
import org.osmdroid.views.MapView;
|
||||||
|
import org.osmdroid.views.overlay.ItemizedOverlay;
|
||||||
|
import org.osmdroid.views.overlay.OverlayItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class CustomOverlay extends ItemizedOverlay<OverlayItem> {
|
||||||
|
private final MapView mapView;
|
||||||
|
private ArrayList<OverlayItem> overlayItems = new ArrayList<>();
|
||||||
|
|
||||||
|
public CustomOverlay(Drawable pDefaultMarker, MapView mapView) {
|
||||||
|
super(pDefaultMarker);
|
||||||
|
this.mapView = mapView;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOverlayItem(OverlayItem item) {
|
||||||
|
overlayItems.add(item);
|
||||||
|
populate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected OverlayItem createItem(int i) {
|
||||||
|
return overlayItems.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return overlayItems.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSnapToItem(int x, int y, Point snapPoint, IMapView mapView) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
|
public interface Loader<T> {
|
||||||
|
T load();
|
||||||
|
}
|
||||||
@@ -1,8 +1,71 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class LocationAdapter {
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
class LocationViewHolder {
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.LocationViewHolder> {
|
||||||
|
|
||||||
|
private Context appContext;
|
||||||
|
private List<Location> locationList;
|
||||||
|
private OnItemClickListener clickListener;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(int clickedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
|
private TextView locationName;
|
||||||
|
|
||||||
|
public LocationViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
this.locationName = itemView.findViewById(R.id.location_name);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
clickListener.onItemClick(getAdapterPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextViewText(String text){
|
||||||
|
this.locationName = itemView.findViewById(R.id.location_name);
|
||||||
|
locationName.setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocationAdapter(Context context, List<Location> location, OnItemClickListener listener){
|
||||||
|
this.appContext = context;
|
||||||
|
this.locationList = location;
|
||||||
|
this.clickListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public LocationAdapter.LocationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.location_item, parent, false);
|
||||||
|
return new LocationViewHolder(itemView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull LocationAdapter.LocationViewHolder holder, int position) {
|
||||||
|
Location location = locationList.get(position);
|
||||||
|
holder.setTextViewText(location.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return locationList.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,36 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class LocationListManager {
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
|
||||||
|
import org.osmdroid.util.GeoPoint;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public enum LocationListManager {
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
private List<Location> locationList;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public void setContext(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
this.locationList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Location> getLocationList() {
|
||||||
|
return locationList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLocation(int place) {
|
||||||
|
return locationList.get(place);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
LocationLoader locationLoader = new LocationLoader(this.context);
|
||||||
|
this.locationList = locationLoader.load();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,28 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class LocationLoader {
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.FileIO;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LocationLoader implements Loader<List<Location>> {
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
public LocationLoader(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<Location> load() {
|
||||||
|
FileIO<ArrayList<Location>> fileIO = new FileIO<>();
|
||||||
|
|
||||||
|
ArrayList<Location> res = fileIO.readFileData(context,"locations.json",new TypeToken<ArrayList<Location>>(){}.getType());
|
||||||
|
|
||||||
|
return res == null ? new ArrayList<>() : res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,73 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class RouteAdapter {
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
class RouteViewHolder {
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.R;
|
||||||
|
import com.a1.nextlocation.data.Location;
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RouteAdapter extends RecyclerView.Adapter<RouteAdapter.RouteViewHolder>{
|
||||||
|
|
||||||
|
private Context appContext;
|
||||||
|
private List<Route> routeList;
|
||||||
|
private CouponAdapter.OnItemClickListener clickListener;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
void onItemClick(int clickedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RouteViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
|
private TextView routeName;
|
||||||
|
|
||||||
|
public RouteViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
this.routeName = itemView.findViewById(R.id.route_name);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
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){
|
||||||
|
appContext = context;
|
||||||
|
routeList = route;
|
||||||
|
clickListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RouteAdapter.RouteViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.route_item, parent, false);
|
||||||
|
return new RouteViewHolder(itemView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RouteAdapter.RouteViewHolder holder, int position) {
|
||||||
|
Route route = routeList.get(position);
|
||||||
|
holder.setTextViewText(route.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return routeList.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class RouteListManager {
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.a1.nextlocation.data.Route;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public enum RouteListManager{
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
private List<Route> routeList;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public void setContext(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
this.routeList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Route> getRouteList() {
|
||||||
|
return routeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Route getRoute(int place) {
|
||||||
|
return routeList.get(place);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
RouteLoader routeLoader = new RouteLoader(this.context);
|
||||||
|
this.routeList = routeLoader.load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,29 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class RouteLoader {
|
import android.content.Context;
|
||||||
|
|
||||||
|
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 java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RouteLoader implements Loader<List<Route>> {
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
public RouteLoader(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<Route> load() {
|
||||||
|
|
||||||
|
FileIO<ArrayList<Route>> fileIO = new FileIO<>();
|
||||||
|
ArrayList<Route> res = fileIO.readFileData(context, "routes.json",new TypeToken<ArrayList<Route>>(){}.getType());
|
||||||
|
return res == null ? new ArrayList<>() : res;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
android:viewportHeight="24"
|
android:viewportHeight="24"
|
||||||
android:tint="?attr/colorControlNormal">
|
android:tint="?attr/colorControlNormal">
|
||||||
<path
|
<path
|
||||||
android:fillColor="@android:color/white"
|
android:fillColor="@color/primaryColour"
|
||||||
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
10
app/src/main/res/drawable/ic_baseline_play_arrow_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_play_arrow_24.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M8,5v14l11,-7z"/>
|
||||||
|
</vector>
|
||||||
10
app/src/main/res/drawable/ic_home.xml
Normal file
10
app/src/main/res/drawable/ic_home.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||||
|
</vector>
|
||||||
10
app/src/main/res/drawable/ic_placeholder.xml
Normal file
10
app/src/main/res/drawable/ic_placeholder.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:pathData="M17.6,11.48 L19.44,8.3a0.63,0.63 0,0 0,-1.09 -0.63l-1.88,3.24a11.43,11.43 0,0 0,-8.94 0L5.65,7.67a0.63,0.63 0,0 0,-1.09 0.63L6.4,11.48A10.81,10.81 0,0 0,1 20L23,20A10.81,10.81 0,0 0,17.6 11.48ZM7,17.25A1.25,1.25 0,1 1,8.25 16,1.25 1.25,0 0,1 7,17.25ZM17,17.25A1.25,1.25 0,1 1,18.25 16,1.25 1.25,0 0,1 17,17.25Z"
|
||||||
|
android:fillColor="@android:color/white"/>
|
||||||
|
</vector>
|
||||||
@@ -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>
|
|
||||||
83
app/src/main/res/layout-land/fragment_route_detail.xml
Normal file
83
app/src/main/res/layout-land/fragment_route_detail.xml
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?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.RouteDetailFragment">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/routeDetailBackButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:background="@drawable/ic_back_button_24"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/routeTitle"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/routeTitle"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/routeTitle"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/routeTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="250dp"
|
||||||
|
android:text="titel"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/routeDetailImage"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/routeDetailText"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/routeDetailBackButton"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/routeDetailImage"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
android:layout_marginEnd="350dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/routeDetailText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="200dp"
|
||||||
|
android:text=""
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/routeDetailImage"
|
||||||
|
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>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
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/topBar"
|
||||||
app:layout_constraintBottom_toTopOf="@id/navbar"
|
app:layout_constraintBottom_toTopOf="@id/navbar"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -34,7 +34,6 @@
|
|||||||
android:id="@+id/topBar"
|
android:id="@+id/topBar"
|
||||||
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"
|
||||||
|
|||||||
37
app/src/main/res/layout/coupon_item.xml
Normal file
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/Box1"
|
||||||
|
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="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,39 @@
|
|||||||
<?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:text="Statistics"
|
||||||
android:textColor="@color/white"
|
android:textSize="20sp"
|
||||||
android:textSize="30sp"
|
app:layout_constraintStart_toEndOf="@id/couponBackButton"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/couponBackButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/ic_back_button_24"
|
||||||
|
android:backgroundTint="@color/buttonColour"
|
||||||
|
android:text="Back"
|
||||||
|
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.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/couponRecyclerView"
|
||||||
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/couponBackButton" />
|
||||||
/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,14 +1,32 @@
|
|||||||
<?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">
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.gms.maps.MapView
|
<org.osmdroid.views.MapView
|
||||||
android:id="@+id/mapView"
|
android:id="@+id/mapView"
|
||||||
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:src="@drawable/ic_baseline_outlined_flag_24"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
@@ -14,11 +14,11 @@
|
|||||||
android:layout_margin="9dp"
|
android:layout_margin="9dp"
|
||||||
android:text="Locations"
|
android:text="Locations"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
app:layout_constraintStart_toEndOf="@id/locationBackButton"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/routeBackButton"
|
android:id="@+id/locationBackButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/ic_back_button_24"
|
android:background="@drawable/ic_back_button_24"
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:id="@+id/locationRecyclerView"
|
||||||
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"
|
||||||
|
|||||||
@@ -31,16 +31,14 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/detail_location_text"
|
android:id="@+id/detail_location_text"
|
||||||
android:layout_width="378dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="379dp"
|
android:layout_margin="20dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/secondaryColour"
|
android:background="@color/secondaryColour"
|
||||||
android:text="Detail tekst"
|
android:text="Detail tekst"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.484"
|
|
||||||
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" />
|
||||||
app:layout_constraintVertical_bias="0.446" />
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/detail_location_back_button"
|
android:id="@+id/detail_location_back_button"
|
||||||
|
|||||||
@@ -1,48 +1,40 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout 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.RouteFragment">
|
tools:context=".fragments.RouteFragment">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<ImageButton
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/routeBackButton"
|
||||||
android:layout_height="match_parent">
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:background="@drawable/ic_back_button_24"
|
||||||
|
android:text="Back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageButton
|
<TextView
|
||||||
android:id="@+id/routeBackButton"
|
android:id="@+id/routeTitle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/ic_back_button_24"
|
android:layout_margin="9dp"
|
||||||
android:backgroundTint="@color/buttonColour"
|
android:text="titel"
|
||||||
android:text="Back"
|
android:textSize="20sp"
|
||||||
android:layout_margin="10dp"
|
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/routeTitle"
|
android:id="@+id/routeRecyclerView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:text="titel"
|
android:background="@color/primaryColour"
|
||||||
android:textSize="20sp"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_margin="9dp"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toBottomOf="@+id/routeBackButton" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/routeListRV"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:background="@color/primaryColour"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/routeBackButton" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
@@ -1,14 +1,81 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout 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"
|
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"
|
||||||
tools:context=".fragments.RouteDetailFragment">
|
tools:context=".fragments.RouteDetailFragment">
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<ImageButton
|
||||||
<TextView
|
android:id="@+id/routeDetailBackButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hello_blank_fragment" />
|
android:layout_marginEnd="100dp"
|
||||||
|
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_constraintTop_toTopOf="@id/routeTitle" />
|
||||||
|
|
||||||
</FrameLayout>
|
<TextView
|
||||||
|
android:id="@+id/routeTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="titel"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/routeDetailImage"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
android:layout_margin="40dp"
|
||||||
|
android:id="@+id/routeDetailImage"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/routeDetailBackButton"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/routeDetailText"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/routeDetailText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:layout_marginBottom="100dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/startRouteText"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/routeDetailImage" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/startRouteButton"
|
||||||
|
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_height="wrap_content"
|
||||||
|
android:layout_margin="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/routeDetailText" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -7,16 +7,6 @@
|
|||||||
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"
|
||||||
@@ -211,6 +201,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/couponAmount"
|
||||||
android:text="GETAL"
|
android:text="GETAL"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
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:id="@+id/route_name"
|
||||||
android:text="test text"
|
android:text="test text"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="20dp"
|
android:textSize="20dp"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
|||||||
@@ -16,4 +16,5 @@
|
|||||||
<string name="totale_tijd">Totale tijd:</string>
|
<string name="totale_tijd">Totale tijd:</string>
|
||||||
<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>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/primaryColour</item>
|
<item name="colorPrimary">@color/primaryColour</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
|
|||||||
Reference in New Issue
Block a user