Compare commits
24 Commits
display-ro
...
RecyclerVi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0f87af42b | ||
|
|
192f1a4c64 | ||
|
|
391792a5e2 | ||
|
|
1f53890a4b | ||
|
|
09ced99654 | ||
|
|
86bc0f0c19 | ||
|
|
deb599db25 | ||
|
|
9be5ba27ab | ||
|
|
926a984c71 | ||
|
|
f5da1c8a83 | ||
|
|
0e63bff0f1 | ||
|
|
5e76ced998 | ||
|
|
f6af7ae80b | ||
|
|
d4cfa17fda | ||
|
|
abc58d3606 | ||
|
|
1877a693d0 | ||
|
|
738a733b72 | ||
|
|
faa79b5553 | ||
|
|
1834aec01b | ||
|
|
360198e784 | ||
|
|
2e5f57aa23 | ||
|
|
fbf8cbe1c5 | ||
|
|
aae67f53ec | ||
|
|
bc8b83e4f6 |
@@ -15,21 +15,14 @@ public class Route implements Parcelable {
|
||||
|
||||
@NonNull
|
||||
private String name;
|
||||
|
||||
|
||||
private String description;
|
||||
private List<Location> locations;
|
||||
|
||||
|
||||
private float totalDistance;
|
||||
|
||||
|
||||
private int totalTime;
|
||||
|
||||
public Route(@NotNull String name) {
|
||||
|
||||
this.name = name;
|
||||
this.locations = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
protected Route(Parcel in) {
|
||||
@@ -103,4 +96,12 @@ public class Route implements Parcelable {
|
||||
parcel.writeFloat(totalDistance);
|
||||
parcel.writeInt(totalTime);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
69
app/src/main/java/com/a1/nextlocation/data/RouteHandler.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.a1.nextlocation.data;
|
||||
|
||||
import org.osmdroid.views.overlay.Polyline;
|
||||
|
||||
/**
|
||||
* singleton to track the current route that is being followed
|
||||
*/
|
||||
public enum RouteHandler {
|
||||
INSTANCE;
|
||||
|
||||
private boolean isFollowingRoute = false;
|
||||
private Route currentRoute;
|
||||
private int stepCount = 0;
|
||||
private RouteFinishedListener routeFinishedListener;
|
||||
|
||||
private Polyline currentRouteLine;
|
||||
|
||||
public void setCurrentRouteLine(Polyline currentRouteLine) {
|
||||
this.currentRouteLine = currentRouteLine;
|
||||
}
|
||||
|
||||
public Polyline getCurrentRouteLine() {
|
||||
return currentRouteLine;
|
||||
}
|
||||
|
||||
public void setRouteFinishedListener(RouteFinishedListener routeFinishedListener) {
|
||||
this.routeFinishedListener = routeFinishedListener;
|
||||
}
|
||||
|
||||
public int getStepCount() {
|
||||
return stepCount;
|
||||
}
|
||||
|
||||
public void addStep() {
|
||||
stepCount++;
|
||||
}
|
||||
|
||||
public void finishRoute() {
|
||||
stepCount = 0;
|
||||
isFollowingRoute = false;
|
||||
currentRoute = null;
|
||||
currentRouteLine = null;
|
||||
}
|
||||
|
||||
public void followRoute(Route route) {
|
||||
this.currentRoute = route;
|
||||
setFollowingRoute(true);
|
||||
}
|
||||
|
||||
public boolean isFollowingRoute(Route route) {
|
||||
return isFollowingRoute && route.equals(currentRoute);
|
||||
}
|
||||
public void setFollowingRoute(boolean followingRoute) {
|
||||
isFollowingRoute = followingRoute;
|
||||
}
|
||||
|
||||
public boolean isFollowingRoute() {
|
||||
return isFollowingRoute;
|
||||
}
|
||||
|
||||
public Route getCurrentRoute() {
|
||||
return currentRoute;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface RouteFinishedListener {
|
||||
void onRouteFinish();
|
||||
}
|
||||
}
|
||||
@@ -34,14 +34,6 @@ public enum StaticData {
|
||||
return locationsVisited;
|
||||
}
|
||||
|
||||
private Polyline currentRoute;
|
||||
|
||||
public void setCurrentRoute(Polyline currentRoute) {
|
||||
this.currentRoute = currentRoute;
|
||||
}
|
||||
|
||||
public Polyline getCurrentRoute() {
|
||||
return currentRoute;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,18 +41,18 @@ public class CouponFragment extends Fragment {
|
||||
this.couponRecyclerView.setHasFixedSize(true);
|
||||
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||
|
||||
this.imageButton = view.findViewById(R.id.coupon_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
StatisticFragment statisticFragment = new StatisticFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
CouponListManager.INSTANCE.setContext(this.getContext());
|
||||
CouponListManager.INSTANCE.load();
|
||||
this.couponList = CouponListManager.INSTANCE.getCouponList();
|
||||
|
||||
this.couponAdapter = new CouponAdapter(this.getContext(), this.couponList, clickedPosition -> showPopup(this.couponList.get(clickedPosition)));
|
||||
|
||||
this.imageButton = view.findViewById(R.id.coupon_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
StatisticFragment statisticFragment = new StatisticFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
this.couponRecyclerView.setLayoutManager(this.layoutManager);
|
||||
this.couponRecyclerView.setAdapter(this.couponAdapter);
|
||||
return view;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.a1.nextlocation.fragments;
|
||||
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -25,6 +24,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.RouteHandler;
|
||||
import com.a1.nextlocation.data.StaticData;
|
||||
import com.a1.nextlocation.json.DirectionsResult;
|
||||
import com.a1.nextlocation.network.ApiHandler;
|
||||
@@ -46,17 +46,19 @@ import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeFragment extends Fragment implements LocationListener{
|
||||
public class HomeFragment extends Fragment implements LocationListener {
|
||||
private final String userAgent = "com.ai.nextlocation.fragments";
|
||||
public final static String MAPQUEST_API_KEY = "vuyXjqnAADpjeL9QwtgWGleIk95e36My";
|
||||
private ImageButton imageButton;
|
||||
private ImageButton stopButton;
|
||||
private MapView mapView;
|
||||
private final int REQUEST_PERMISSIONS_REQUEST_CODE = 1;
|
||||
private final String TAG = HomeFragment.class.getCanonicalName();
|
||||
// private RoadManager roadManager;
|
||||
// private RoadManager roadManager;
|
||||
private Polyline roadOverlay;
|
||||
private int color;
|
||||
private Location currentLocation;
|
||||
private Overlay allLocationsOverlay;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -66,8 +68,6 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
// WRITE_EXTERNAL_STORAGE is required in order to show the map
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
// roadManager = new MapQuestRoadManager(MAPQUEST_API_KEY);
|
||||
// roadManager.addRequestOption("routeType=foot-walking");
|
||||
|
||||
color = requireContext().getColor(R.color.red);
|
||||
}
|
||||
@@ -78,32 +78,48 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||
|
||||
// set up the location list button
|
||||
this.imageButton = view.findViewById(R.id.location_list_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
LocationFragment locationFragment = new LocationFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
// set up the route stop button
|
||||
stopButton = view.findViewById(R.id.home_stop_route_button);
|
||||
stopButton.setOnClickListener(v -> {
|
||||
RouteHandler.INSTANCE.finishRoute();
|
||||
stopButton.setVisibility(View.GONE);
|
||||
Toast.makeText(requireContext(),getResources().getString(R.string.route_stop_toast),Toast.LENGTH_SHORT).show();
|
||||
mapView.getOverlays().remove(roadOverlay);
|
||||
mapView.getOverlays().remove(allLocationsOverlay);
|
||||
addLocations();
|
||||
mapView.invalidate();
|
||||
roadOverlay = null;
|
||||
});
|
||||
|
||||
if (RouteHandler.INSTANCE.isFollowingRoute()) {
|
||||
stopButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
stopButton.setVisibility(View.GONE);
|
||||
}
|
||||
ApiHandler.INSTANCE.addListener(this::onDirectionsAvailable);
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* callback method that gets called when there are new directions available in the form of a {@link DirectionsResult} object.
|
||||
* @param directionsResult the directions received from the api
|
||||
*/
|
||||
private void onDirectionsAvailable(DirectionsResult directionsResult) {
|
||||
Log.d(TAG, "onDirectionsAvailable: got result! " + directionsResult);
|
||||
ArrayList<GeoPoint> geoPoints = directionsResult.getGeoPoints();
|
||||
roadOverlay = new Polyline();
|
||||
roadOverlay.setPoints(geoPoints);
|
||||
|
||||
// this is for mapquest, but it gives a "no value for guidancelinkcollection" error and google has never heard of that
|
||||
// GeoPoint[] gp = directionsResult.getStartAndEndPoint();
|
||||
// ArrayList<GeoPoint> arrayList = new ArrayList<>(Arrays.asList(gp));
|
||||
// Road road = roadManager.getRoad(arrayList);
|
||||
// roadOverlay = RoadManager.buildRoadOverlay(road);
|
||||
|
||||
roadOverlay.setColor(color);
|
||||
|
||||
|
||||
StaticData.INSTANCE.setCurrentRoute(roadOverlay);
|
||||
RouteHandler.INSTANCE.setCurrentRouteLine(roadOverlay);
|
||||
Log.d(TAG, "onDirectionsAvailable: successfully added road!");
|
||||
|
||||
}
|
||||
@@ -117,6 +133,7 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
|
||||
/**
|
||||
* This method initializes the map and all the things it needs
|
||||
*
|
||||
* @param view the view the map is on
|
||||
*/
|
||||
private void initMap(@NonNull View view) {
|
||||
@@ -133,7 +150,7 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(this.requireContext());
|
||||
|
||||
// add the compass overlay
|
||||
CompassOverlay compassOverlay = new CompassOverlay(requireContext(),new InternalCompassOrientationProvider(requireContext()),mapView);
|
||||
CompassOverlay compassOverlay = new CompassOverlay(requireContext(), new InternalCompassOrientationProvider(requireContext()), mapView);
|
||||
compassOverlay.enableCompass();
|
||||
mapView.getOverlays().add(compassOverlay);
|
||||
|
||||
@@ -153,19 +170,17 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
LocationManager locationManager = (LocationManager) requireActivity().getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this);
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0,this);
|
||||
// request location updates for the distance checking
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
|
||||
|
||||
// get the current location and set it as center
|
||||
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
if (currentLocation == null) {
|
||||
currentLocation = location;
|
||||
}
|
||||
if (currentLocation == null) currentLocation = location;
|
||||
|
||||
if( location != null ) {
|
||||
if (location != null) {
|
||||
GeoPoint start = new GeoPoint(location.getLatitude(), location.getLongitude());
|
||||
mapController.setCenter(start);
|
||||
}
|
||||
@@ -186,59 +201,94 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* displays the route that is currently being followed as a red line
|
||||
*/
|
||||
private void displayRoute() {
|
||||
|
||||
if (roadOverlay == null) {
|
||||
if (StaticData.INSTANCE.getCurrentRoute() != null) {
|
||||
roadOverlay = StaticData.INSTANCE.getCurrentRoute();
|
||||
if (RouteHandler.INSTANCE.isFollowingRoute()) {
|
||||
if (roadOverlay == null) {
|
||||
if (RouteHandler.INSTANCE.getCurrentRouteLine() != null) {
|
||||
roadOverlay = RouteHandler.INSTANCE.getCurrentRouteLine();
|
||||
mapView.getOverlays().add(roadOverlay);
|
||||
mapView.invalidate();
|
||||
Log.d(TAG, "initMap: successfully added road!");
|
||||
}
|
||||
} else {
|
||||
mapView.getOverlays().add(roadOverlay);
|
||||
mapView.invalidate();
|
||||
Log.d(TAG, "initMap: successfully added road!");
|
||||
}
|
||||
} else {
|
||||
mapView.getOverlays().add(roadOverlay);
|
||||
mapView.invalidate();
|
||||
Log.d(TAG, "initMap: successfully added road!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds the locations of the current route to the map. If there is no current route, show all locations
|
||||
*/
|
||||
private void addLocations() {
|
||||
List<com.a1.nextlocation.data.Location> locations = LocationListManager.INSTANCE.getLocationList();
|
||||
// get the locations of the current route or all locations
|
||||
List<com.a1.nextlocation.data.Location> locations = RouteHandler.INSTANCE.isFollowingRoute() ? RouteHandler.INSTANCE.getCurrentRoute().getLocations() : LocationListManager.INSTANCE.getLocationList();
|
||||
final ArrayList<OverlayItem> items = new ArrayList<>(locations.size());
|
||||
Drawable marker = ContextCompat.getDrawable(requireContext(),R.drawable.ic_baseline_location_on_24);
|
||||
// marker icon
|
||||
Drawable marker = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24);
|
||||
marker.setAlpha(255);
|
||||
marker.setTint(getResources().getColor(R.color.primaryColour));
|
||||
|
||||
// add all locations to the overlay itemss
|
||||
for (com.a1.nextlocation.data.Location location : locations) {
|
||||
OverlayItem item = new OverlayItem(location.getName(),location.getDescription(),location.convertToGeoPoint());
|
||||
OverlayItem item = new OverlayItem(location.getName(), location.getDescription(), location.convertToGeoPoint());
|
||||
item.setMarker(marker);
|
||||
items.add(item);
|
||||
}
|
||||
Overlay allLocationsOverlay = new ItemizedIconOverlay<OverlayItem>(items,
|
||||
|
||||
// create the overlay that will hold all locations and add listeners
|
||||
allLocationsOverlay = new ItemizedIconOverlay<OverlayItem>(items,
|
||||
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
|
||||
/**
|
||||
* on sinlge click, navigate to that location's detail fragment
|
||||
* @param index the index in the location list
|
||||
* @param item the item that was clicked
|
||||
* @return true
|
||||
*/
|
||||
@Override
|
||||
public boolean onItemSingleTapUp(int index, OverlayItem item) {
|
||||
com.a1.nextlocation.data.Location clicked = locations.get(index);
|
||||
requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new LocationDetailFragment(clicked)).commit();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* on item long press, show that location's name in a toast message
|
||||
* @param index the index in the location list
|
||||
* @param item the item that was clicked
|
||||
* @return true
|
||||
*/
|
||||
@Override
|
||||
public boolean onItemLongPress(int index, OverlayItem item) {
|
||||
com.a1.nextlocation.data.Location clicked = locations.get(index);
|
||||
Toast.makeText(requireContext(), clicked.getName(),Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), clicked.getName(), Toast.LENGTH_SHORT).show();
|
||||
|
||||
// create a route to the clicked location, didn't work and didn't have enough time to make it work ¯\_(ツ)_/¯
|
||||
|
||||
// Route route = new Route("Route to " + clicked.getName());
|
||||
// route.addLocation(new com.a1.nextlocation.data.Location("Current location",currentLocation.getLatitude(),currentLocation.getLongitude(),"your location",null));
|
||||
// route.addLocation(clicked);
|
||||
// ApiHandler.INSTANCE.getDirections(route);
|
||||
return true;
|
||||
}
|
||||
},requireContext());
|
||||
}, requireContext());
|
||||
|
||||
// add the overlay to the map
|
||||
mapView.getOverlays().add(allLocationsOverlay);
|
||||
Log.d(TAG, "addLocations: successfully added locations");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Ricky
|
||||
* request the permissions needed for location and network, made by Ricky
|
||||
* @param permissions tbe permissions we want to ask
|
||||
*/
|
||||
private void requestPermissionsIfNecessary(String... permissions) {
|
||||
ArrayList<String> permissionsToRequest = new ArrayList<>();
|
||||
if (this.getContext() != null)
|
||||
@@ -257,16 +307,21 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* location callback that gets called each time the location is updated. It is used for updating the distance walked and checking if there are locations you have visited
|
||||
* @param location the new location
|
||||
*/
|
||||
@Override
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
// calculate the distance walked
|
||||
double distance = currentLocation.distanceTo(location); // in meters
|
||||
StaticData.INSTANCE.addDistance(distance);
|
||||
currentLocation = location;
|
||||
|
||||
//new thread because we don't want the main thread to hang
|
||||
//new thread because we don't want the main thread to hang, this method gets called a lot
|
||||
Thread t = new Thread(() -> {
|
||||
for (com.a1.nextlocation.data.Location l : LocationListManager.INSTANCE.getLocationList()) {
|
||||
if (com.a1.nextlocation.data.Location.getDistance(currentLocation.getLatitude(),currentLocation.getLongitude(),l.getLat(),l.getLong()) < 10) {
|
||||
if (com.a1.nextlocation.data.Location.getDistance(currentLocation.getLatitude(), currentLocation.getLongitude(), l.getLat(), l.getLong()) < 10) {
|
||||
StaticData.INSTANCE.visitLocation(l);
|
||||
}
|
||||
}
|
||||
@@ -275,6 +330,8 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
t.start();
|
||||
}
|
||||
|
||||
// empty override methods for the LocationListener
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
|
||||
@@ -289,4 +346,22 @@ public class HomeFragment extends Fragment implements LocationListener{
|
||||
public void onProviderDisabled(@NonNull String provider) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* method that gets called when the app gets paused
|
||||
*/
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* method that gets called when the app gets resumed
|
||||
*/
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.a1.nextlocation.fragments;
|
||||
|
||||
import android.media.Image;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -52,8 +53,10 @@ public class LocationFragment extends Fragment {
|
||||
|
||||
this.locationAdapter = new LocationAdapter(this.getContext(), this.locationList, clickedPosition -> {
|
||||
LocationDetailFragment locationDetailFragment = new LocationDetailFragment();
|
||||
locationDetailFragment.setLocation(this.locationList.get(clickedPosition));
|
||||
Bundle locationBundle = new Bundle();
|
||||
locationBundle.putParcelable("location", this.locationList.get(clickedPosition));
|
||||
locationDetailFragment.setLocation(this.locationList.get(clickedPosition));
|
||||
locationDetailFragment.setArguments(locationBundle);
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationDetailFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
@@ -8,18 +8,18 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Route;
|
||||
import com.a1.nextlocation.network.ApiHandler;
|
||||
|
||||
public class RouteDetailFragment extends Fragment {
|
||||
|
||||
private Route route;
|
||||
private TextView routeDetailText;
|
||||
private TextView routeName;
|
||||
private ImageButton imageButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -34,19 +34,19 @@ public class RouteDetailFragment extends Fragment {
|
||||
this.route = getArguments().getParcelable("route");
|
||||
}
|
||||
|
||||
this.routeDetailText = view.findViewById(R.id.routeDetailText);
|
||||
this.routeDetailText.setText(this.route.getName());
|
||||
Button startButton = view.findViewById(R.id.start_route_button);
|
||||
startButton.setOnClickListener(this::startRoute);
|
||||
this.routeName = view.findViewById(R.id.route_title);
|
||||
this.routeName.setText(this.route.getName());
|
||||
|
||||
this.routeDetailText = view.findViewById(R.id.reoute_detail_tekst);
|
||||
this.routeDetailText.setText(this.route.getDescription());
|
||||
|
||||
this.imageButton = view.findViewById(R.id.route_detail_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
RouteFragment routeFragment = new RouteFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void startRoute(View view) {
|
||||
ApiHandler.INSTANCE.getDirections(route);
|
||||
Toast.makeText(requireContext(),"Route started!",Toast.LENGTH_SHORT).show();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new HomeFragment()).addToBackStack(null).commit();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Route;
|
||||
@@ -33,6 +34,7 @@ public class RouteFragment extends Fragment {
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private List<Route> routeList;
|
||||
private RouteAdapter routeAdapter;
|
||||
private ImageButton imageButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -60,6 +62,12 @@ public class RouteFragment extends Fragment {
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeDetailFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
this.imageButton = view.findViewById(R.id.route_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
this.routeRecyclerView.setLayoutManager(this.layoutManager);
|
||||
this.routeRecyclerView.setAdapter(this.routeAdapter);
|
||||
return view;
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package com.a1.nextlocation.fragments;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.a1.nextlocation.MainActivity;
|
||||
@@ -17,6 +21,10 @@ import com.a1.nextlocation.R;
|
||||
|
||||
public class SettingsFragment extends Fragment {
|
||||
|
||||
private ImageView imageButton;
|
||||
|
||||
SwitchCompat fontChanger;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -36,6 +44,41 @@ public class SettingsFragment extends Fragment {
|
||||
// Inflate the layout for this fragment
|
||||
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
||||
|
||||
this.imageButton = view.findViewById(R.id.settings_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
|
||||
fontChanger = view.findViewById(R.id.BigFont);
|
||||
|
||||
SharedPreferences sharedPreferences = requireActivity().getSharedPreferences("com.a1.nextlocation",0);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
fontChanger.setChecked(sharedPreferences.getBoolean("switch", false));
|
||||
|
||||
if (fontChanger.isChecked()){
|
||||
requireActivity().setTheme(R.style.Theme_NextLocationBig);
|
||||
}else if (!fontChanger.isChecked()){
|
||||
requireActivity().setTheme(R.style.Theme_NextLocation);
|
||||
}
|
||||
|
||||
fontChanger.setOnClickListener(view1 -> {
|
||||
if(fontChanger.isChecked())
|
||||
{
|
||||
requireActivity().setTheme(R.style.Theme_NextLocationBig);
|
||||
editor.putBoolean("switch",true);
|
||||
editor.apply();
|
||||
}
|
||||
if(!fontChanger.isChecked())
|
||||
{
|
||||
requireActivity().setTheme(R.style.Theme_NextLocation);
|
||||
editor.putBoolean("switch",false);
|
||||
editor.apply();
|
||||
}
|
||||
editor.commit();
|
||||
});
|
||||
|
||||
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
|
||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ public class StatisticFragment extends Fragment {
|
||||
|
||||
private List<Coupon> couponList;
|
||||
private ImageView imageButton;
|
||||
private ImageView couponButton;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -50,6 +51,18 @@ public class StatisticFragment extends Fragment {
|
||||
couponNumber.setText(String.valueOf(adapter.getItemCount()));
|
||||
|
||||
|
||||
this.imageButton = view.findViewById(R.id.statistics_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
this.couponButton = view.findViewById(R.id.coupon_button);
|
||||
this.couponButton.setOnClickListener(v -> {
|
||||
CouponFragment couponFragment = new CouponFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
ConstraintLayout constraintLayout = view.findViewById(R.id.Box4);
|
||||
constraintLayout.setOnClickListener(v -> {
|
||||
CouponFragment couponFragment = new CouponFragment();
|
||||
|
||||
@@ -127,6 +127,7 @@ public enum ApiHandler {
|
||||
} catch (IOException e) {
|
||||
Log.d(TAG, "getDirections: caught exception: " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
t.start();
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -27,10 +28,12 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
||||
class LocationViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
|
||||
private TextView locationName;
|
||||
private ImageView locationImage;
|
||||
|
||||
public LocationViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
this.locationName = itemView.findViewById(R.id.location_name);
|
||||
this.locationImage = itemView.findViewById(R.id.location_image);
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@@ -43,6 +46,13 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
||||
this.locationName = itemView.findViewById(R.id.location_name);
|
||||
locationName.setText(text);
|
||||
}
|
||||
|
||||
public void setImageViewImage(String text){
|
||||
this.locationImage = itemView.findViewById(R.id.location_image);
|
||||
Context context = locationImage.getContext();
|
||||
int id = context.getResources().getIdentifier(text, "drawable", context.getPackageName());
|
||||
locationImage.setImageResource(id);
|
||||
}
|
||||
}
|
||||
|
||||
public LocationAdapter(Context context, List<Location> location, OnItemClickListener listener){
|
||||
@@ -62,6 +72,7 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
||||
public void onBindViewHolder(@NonNull LocationAdapter.LocationViewHolder holder, int position) {
|
||||
Location location = locationList.get(position);
|
||||
holder.setTextViewText(location.getName());
|
||||
holder.setImageViewImage(location.getImageUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
12
app/src/main/res/drawable-anydpi/ic_stop_icon.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#333333"
|
||||
android:alpha="0.6">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M8,16h8V8H8V16zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2L12,2z"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable-hdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 318 B |
BIN
app/src/main/res/drawable-mdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 213 B |
BIN
app/src/main/res/drawable-xhdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 416 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_stop_icon.png
Normal file
|
After Width: | Height: | Size: 552 B |
BIN
app/src/main/res/drawable/beach_and_lounge_club.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
app/src/main/res/drawable/belcrum_beach.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
app/src/main/res/drawable/belcrum_watertoren.png
Normal file
|
After Width: | Height: | Size: 780 KiB |
BIN
app/src/main/res/drawable/coffee_and_lunch.png
Normal file
|
After Width: | Height: | Size: 981 KiB |
BIN
app/src/main/res/drawable/de_boter_hal.png
Normal file
|
After Width: | Height: | Size: 3.8 MiB |
BIN
app/src/main/res/drawable/de_koepel_future_events.png
Normal file
|
After Width: | Height: | Size: 1.9 MiB |
BIN
app/src/main/res/drawable/escaping_room.png
Normal file
|
After Width: | Height: | Size: 619 KiB |
BIN
app/src/main/res/drawable/gauchos.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
app/src/main/res/drawable/hercules_park_valkenburg.png
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
app/src/main/res/drawable/het_klooster_breda.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
app/src/main/res/drawable/kees_kroket.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
app/src/main/res/drawable/koningin_wilhelimna_paviljoen.png
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
app/src/main/res/drawable/mc_donalds.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
app/src/main/res/drawable/mezz_breda.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
app/src/main/res/drawable/nassau_baroniemonument.png
Normal file
|
After Width: | Height: | Size: 432 KiB |
BIN
app/src/main/res/drawable/prison_escape_room.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
app/src/main/res/drawable/station_breda.png
Normal file
|
After Width: | Height: | Size: 502 KiB |
BIN
app/src/main/res/drawable/stop_icon.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable/subway.png
Normal file
|
After Width: | Height: | Size: 648 KiB |
BIN
app/src/main/res/drawable/t_zusje_breda.png
Normal file
|
After Width: | Height: | Size: 3.4 MiB |
BIN
app/src/main/res/drawable/the_tosti_club.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
app/src/main/res/drawable/vr_world.png
Normal file
|
After Width: | Height: | Size: 324 KiB |
BIN
app/src/main/res/drawable/wok_to_go.png
Normal file
|
After Width: | Height: | Size: 264 KiB |
@@ -12,7 +12,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Locatie detail"
|
||||
android:text="@string/locatie_detail"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -35,7 +35,7 @@
|
||||
android:layout_height="283dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@color/secondaryColour"
|
||||
android:text="Detail tekst"
|
||||
android:text="@string/locatie_detail_tekst"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_name" />
|
||||
|
||||
@@ -7,6 +7,19 @@
|
||||
android:background="@color/primaryColour"
|
||||
tools:context=".fragments.RouteDetailFragment">
|
||||
|
||||
<Button
|
||||
android:id="@+id/start_route_button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/secondaryColour"
|
||||
android:text="@string/start_route"
|
||||
android:textColor="@color/buttonColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/reoute_detail_tekst"
|
||||
app:layout_constraintStart_toStartOf="@+id/reoute_detail_tekst"
|
||||
app:layout_constraintTop_toBottomOf="@+id/reoute_detail_tekst"
|
||||
app:layout_constraintVertical_bias="0.873" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/routeDetailBackButton"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -25,14 +38,15 @@
|
||||
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"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/route_detail_image"
|
||||
app:layout_constraintEnd_toStartOf="@+id/reoute_detail_tekst"
|
||||
app:layout_constraintStart_toEndOf="@id/routeDetailBackButton"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/routeDetailImage"
|
||||
android:id="@+id/route_detail_image"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginEnd="350dp"
|
||||
@@ -42,7 +56,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/routeDetailText"
|
||||
android:id="@+id/reoute_detail_tekst"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="50dp"
|
||||
@@ -51,33 +65,7 @@
|
||||
android:text=""
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/routeDetailImage"
|
||||
app:layout_constraintStart_toEndOf="@id/route_detail_image"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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>
|
||||
@@ -58,7 +58,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/secondaryColour"
|
||||
android:textSize="25dp"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/top_bar"
|
||||
app:layout_constraintStart_toEndOf="@id/info_button"
|
||||
app:layout_constraintTop_toTopOf="@id/top_bar" />
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="Naam"
|
||||
android:text="@string/naam"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="9dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Statistics"
|
||||
android:text="@string/statistieken"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/coupon_back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -26,7 +26,7 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
android:text="Back"
|
||||
android:text="@string/terug"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -27,6 +27,17 @@
|
||||
android:src="@drawable/ic_baseline_outlined_flag_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/home_stop_route_button"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/location_list_button"
|
||||
android:backgroundTint="@color/secondaryColour"
|
||||
android:src="@drawable/ic_stop_icon"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="9dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Locations"
|
||||
android:text="@string/locaties"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/location_back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -26,7 +26,7 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
android:text="Back"
|
||||
android:text="@string/terug"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_location_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Locatie detail"
|
||||
android:text="@string/locatie_detail"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -29,16 +30,24 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_name"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_location_text"
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_margin="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/secondaryColour"
|
||||
android:text="Detail tekst"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_image" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_location_image">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_location_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/secondaryColour"
|
||||
android:text="@string/locatie_detail_tekst"
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/detail_location_back_button"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:text="Back"
|
||||
android:text="@string/terug"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="9dp"
|
||||
android:text="titel"
|
||||
android:text="@string/titel"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/route_back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
tools:context=".fragments.RouteDetailFragment">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/routeDetailBackButton"
|
||||
android:id="@+id/route_detail_back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/route_title"
|
||||
app:layout_constraintEnd_toStartOf="@id/route_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/route_title" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/route_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="titel"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/routeDetailImage"
|
||||
android:text="@string/titel"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/route_detail_image"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -33,16 +33,16 @@
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_margin="40dp"
|
||||
android:id="@+id/routeDetailImage"
|
||||
app:layout_constraintTop_toBottomOf="@id/routeDetailBackButton"
|
||||
android:id="@+id/route_detail_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/route_detail_back_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/routeDetailText"
|
||||
app:layout_constraintBottom_toTopOf="@id/reoute_detail_tekst"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/routeDetailText"
|
||||
android:id="@+id/reoute_detail_tekst"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
@@ -50,20 +50,20 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.6"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/routeDetailImage" />
|
||||
app:layout_constraintTop_toBottomOf="@id/route_detail_image" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/start_route_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start Route"
|
||||
android:text="@string/start_route"
|
||||
android:backgroundTint="@color/secondaryColour"
|
||||
android:textColor="@color/buttonColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.498"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/routeDetailText"
|
||||
app:layout_constraintTop_toBottomOf="@+id/reoute_detail_tekst"
|
||||
app:layout_constraintVertical_bias="0.671" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,21 +8,22 @@
|
||||
tools:context=".fragments.SettingsFragment">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/settings_back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
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" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/settings"
|
||||
android:text="@string/instellingen"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -159,6 +160,7 @@
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/BigFont"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/Balk3"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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"
|
||||
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.StatisticFragment">
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
android:id="@+id/name_box"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:background="@color/secondaryColour"
|
||||
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"
|
||||
|
||||
>
|
||||
|
||||
@@ -51,14 +51,13 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/statistics_km"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" km"
|
||||
android:text="@string/km"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -107,7 +106,7 @@
|
||||
android:id="@+id/statistics_locations_visited"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="GETAL"
|
||||
android:text="@string/getal"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -127,8 +126,7 @@
|
||||
app:layout_constraintBottom_toTopOf="@id/Box4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/Box2"
|
||||
>
|
||||
app:layout_constraintTop_toBottomOf="@id/Box2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -154,7 +152,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" minuten"
|
||||
android:text="@string/minuten"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -169,14 +167,14 @@
|
||||
android:id="@+id/Box4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.85"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/Box3"
|
||||
android:background="@color/secondaryColour"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
|
||||
>
|
||||
app:layout_constraintTop_toBottomOf="@id/Box3">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -197,14 +195,13 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/couponAmount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/couponAmount"
|
||||
android:text="GETAL"
|
||||
android:text="@string/getal"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -212,6 +209,31 @@
|
||||
app:layout_constraintStart_toStartOf="@id/Balk4"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/coupon_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:scaleX="-1"
|
||||
android:text="@string/terug"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/couponAmount"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/couponAmount" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/statistics_back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
android:src="@drawable/ic_back_button_24"
|
||||
android:text="@string/terug"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?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="50dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -7,20 +8,26 @@
|
||||
android:layout_margin="20dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/location_image"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/location_image"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
app:layout_constraintEnd_toStartOf="@id/location_name"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/location_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="location"
|
||||
android:textSize="20dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/route_Image" />
|
||||
android:layout_width="321dp"
|
||||
android:layout_height="47dp"
|
||||
android:gravity="left"
|
||||
android:text="@string/locaties"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?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="50dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -15,13 +16,14 @@
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/route_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/route_name"
|
||||
android:text="test text"
|
||||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
android:text="@string/titel"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/route_Image"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/locations"
|
||||
android:title="@string/locations"
|
||||
android:title="@string/locaties"
|
||||
android:icon="@drawable/ic_baseline_outlined_flag_24"
|
||||
/>
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/statistics"
|
||||
android:title="@string/statistics"
|
||||
android:title="@string/statistieken"
|
||||
android:icon="@drawable/ic_baseline_graphic_eq_24"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings"
|
||||
android:title="@string/instellingen"
|
||||
android:icon="@drawable/ic_baseline_settings_24"
|
||||
/>
|
||||
|
||||
|
||||
@@ -17,4 +17,5 @@
|
||||
<string name="coupons_gespaard">Coupons gespaard:</string>
|
||||
<string name="coupons">Coupons</string>
|
||||
<string name="start_route">Start Route</string>
|
||||
<string name="route_stop_toast">Route stopped!</string>
|
||||
</resources>
|
||||
@@ -7,5 +7,16 @@
|
||||
<item name="colorSecondary">@color/secondaryColour</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.NextLocationBig" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/primaryColour</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/secondaryColour</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
</resources>
|
||||