Compare commits
25 Commits
data
...
LocationCr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
@@ -1,13 +1,21 @@
|
||||
package com.a1.nextlocation;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
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.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* onCreate method that creates the main activity
|
||||
* @param savedInstanceState the saved instance state of the app
|
||||
@@ -16,5 +24,33 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
BottomNavigationView bottomNav = findViewById(R.id.navbar);
|
||||
bottomNav.setOnNavigationItemSelectedListener(navListener);
|
||||
|
||||
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,6 +1,8 @@
|
||||
package com.a1.nextlocation.data;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@@ -13,13 +15,26 @@ public class Location {
|
||||
@NonNull
|
||||
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 description;
|
||||
|
||||
public Location(@NotNull String name, String coordinates, String description) {
|
||||
@ColumnInfo(name = "image_url")
|
||||
@Nullable
|
||||
private String imageUrl;
|
||||
|
||||
public Location(@NotNull String name, String coordinates, String description, @Nullable String imageUrl) {
|
||||
this.name = name;
|
||||
this.coordinates = coordinates;
|
||||
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);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -46,4 +61,34 @@ public class Location {
|
||||
public void setDescription(String 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public abstract class Database extends RoomDatabase {
|
||||
super.onCreate(db);
|
||||
|
||||
databaseWriterExecutor.execute(() -> {
|
||||
|
||||
// TODO populate our database here
|
||||
});
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ public interface CouponDao {
|
||||
@Query("SELECT * FROM coupon")
|
||||
LiveData<List<Coupon>> selectAll();
|
||||
|
||||
@Update
|
||||
public void update(Coupon coupon);
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,9 @@ public interface DataDao {
|
||||
@Query("SELECT * FROM userdata LIMIT 1")
|
||||
Data getData();
|
||||
|
||||
@Query("SELECT * FROM userdata WHERE distance_traveled = :distance LIMIT 1")
|
||||
Data getDataByDistance(float distance);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,14 @@ public class CouponRepository {
|
||||
mAllCoupons = mCouponDao.selectAll();
|
||||
}
|
||||
|
||||
public void insert(Coupon... coupons) {
|
||||
mCouponDao.insertAll(coupons);
|
||||
}
|
||||
|
||||
public void update(Coupon coupon) {
|
||||
mCouponDao.update(coupon);
|
||||
}
|
||||
|
||||
public LiveData<List<Coupon>> getAllCoupons() {
|
||||
return mAllCoupons;
|
||||
}
|
||||
@@ -27,4 +35,8 @@ public class CouponRepository {
|
||||
public Coupon getCoupon(String code) {
|
||||
return mCouponDao.selectCouponByCode(code);
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
mCouponDao.deleteAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,21 @@ public class DataRepository {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Data getDataByDistance(float distance) {
|
||||
return mDataDao.getDataByDistance(distance);
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
mDataDao.delete();
|
||||
}
|
||||
|
||||
public void update(Data data) {
|
||||
mDataDao.update(data);
|
||||
}
|
||||
|
||||
public void insertAll(Data... datas) {
|
||||
mDataDao.insertAll(datas);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,4 +27,12 @@ public class LocationRepository {
|
||||
public Location getLocationByName(String name) {
|
||||
return mLocationDao.getLocationByName(name);
|
||||
}
|
||||
|
||||
public void insertAll(Location... locations) {
|
||||
mLocationDao.insertAll(locations);
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
mLocationDao.deleteAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,8 @@ public class RouteRepository {
|
||||
public Route getRouteByName(String name) {
|
||||
return mRouteDao.getRouteByName(name);
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
mRouteDao.deleteAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.a1.nextlocation.fragments;
|
||||
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -13,11 +19,6 @@ import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
|
||||
import org.osmdroid.api.IMapController;
|
||||
@@ -69,7 +70,7 @@ public class HomeFragment extends Fragment {
|
||||
Configuration.getInstance().setUserAgentValue(userAgent);
|
||||
|
||||
// create the map view
|
||||
mapView = (MapView) view.findViewById(R.id.mapView);
|
||||
mapView = view.findViewById(R.id.mapView);
|
||||
mapView.setDestroyMode(false);
|
||||
mapView.setTag("mapView");
|
||||
mapView.setMultiTouchControls(true);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.a1.nextlocation.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
@@ -23,15 +25,20 @@ public class SettingsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
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
|
||||
View view = getView();
|
||||
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
||||
|
||||
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
|
||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
|
||||
|
||||
dropdown.setAdapter(arrayAdapter);
|
||||
|
||||
return inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
}
|
||||
}
|
||||
@@ -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,61 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class CouponAdapter {
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
class CouponViewHolder {
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
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 {
|
||||
|
||||
public CouponViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
clickListener.onItemClick(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
public CouponAdapter(Context context, List<Coupon> coupon, OnItemClickListener listener){
|
||||
appContext = context;
|
||||
couponList = coupon;
|
||||
clickListener = listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CouponViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CouponViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return couponList.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
import com.a1.nextlocation.data.Coupon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CouponListManager {
|
||||
|
||||
private List<Coupon> coupon;
|
||||
|
||||
public CouponListManager(){
|
||||
|
||||
}
|
||||
|
||||
public List<Coupon> getCoupon() {
|
||||
return coupon;
|
||||
}
|
||||
|
||||
public void setCoupon(List<Coupon> location) {
|
||||
this.coupon = coupon;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class CouponLoader {
|
||||
public class CouponLoader implements Loader{
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public interface Loader {
|
||||
void load();
|
||||
}
|
||||
@@ -1,8 +1,70 @@
|
||||
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 CouponAdapter.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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
clickListener.onItemClick(getAdapterPosition());
|
||||
}
|
||||
|
||||
public void setTextViewText(String text){
|
||||
locationName.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
public LocationAdapter(Context context, List<Location> location, CouponAdapter.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.fragment_location, parent, false);
|
||||
LocationViewHolder viewHolder = new LocationViewHolder(itemView);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@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,22 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
import com.a1.nextlocation.data.Location;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LocationListManager {
|
||||
|
||||
private List<Location> location;
|
||||
|
||||
public LocationListManager(){
|
||||
|
||||
}
|
||||
|
||||
public List<Location> getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(List<Location> location) {
|
||||
this.location = location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class LocationLoader {
|
||||
public class LocationLoader implements Loader{
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,57 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class RouteAdapter {
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
class RouteViewHolder {
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
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 {
|
||||
|
||||
public RouteViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
clickListener.onItemClick(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RouteAdapter.RouteViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return routeList.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class RouteListManager {
|
||||
import com.a1.nextlocation.data.Route;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RouteListManager implements Loader{
|
||||
|
||||
List<Route> routes;
|
||||
|
||||
public RouteListManager(){
|
||||
|
||||
}
|
||||
|
||||
public List<Route> getRoutes() {
|
||||
return routes;
|
||||
}
|
||||
|
||||
public void setRoutes(List<Route> routes) {
|
||||
this.routes = routes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class RouteLoader {
|
||||
public class RouteLoader implements Loader {
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
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>
|
||||
@@ -6,7 +6,7 @@
|
||||
tools:context=".fragments.HomeFragment">
|
||||
|
||||
|
||||
<com.google.android.gms.maps.MapView
|
||||
<org.osmdroid.views.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
@@ -31,16 +31,14 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_location_text"
|
||||
android:layout_width="378dp"
|
||||
android:layout_height="379dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/secondaryColour"
|
||||
android:text="Detail tekst"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.484"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_image"
|
||||
app:layout_constraintVertical_bias="0.446" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_image" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/detail_location_back_button"
|
||||
|
||||
@@ -1,48 +1,40 @@
|
||||
<?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"
|
||||
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.RouteFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageButton
|
||||
android:id="@+id/routeBackButton"
|
||||
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
|
||||
android:id="@+id/routeBackButton"
|
||||
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_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/routeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="9dp"
|
||||
android:text="titel"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/routeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="titel"
|
||||
android:textSize="20sp"
|
||||
android:layout_margin="9dp"
|
||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
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.recyclerview.widget.RecyclerView
|
||||
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>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,14 +1,81 @@
|
||||
<?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"
|
||||
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">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/hello_blank_fragment" />
|
||||
<ImageButton
|
||||
android:id="@+id/routeDetailBackButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
@@ -16,4 +16,5 @@
|
||||
<string name="totale_tijd">Totale tijd:</string>
|
||||
<string name="coupons_gespaard">Coupons gespaard:</string>
|
||||
<string name="coupons">Coupons</string>
|
||||
<string name="start_route">Start Route</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user