Merge branch 'develop' into imperial-system

This commit is contained in:
SemvdH
2021-01-06 23:20:13 +01:00
committed by GitHub
27 changed files with 140 additions and 157 deletions

View File

@@ -1,18 +1,17 @@
package com.a1.nextlocation; package com.a1.nextlocation;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.a1.nextlocation.fragments.HelpPopup; import com.a1.nextlocation.fragments.HelpPopup;
import com.a1.nextlocation.fragments.HomeFragment; import com.a1.nextlocation.fragments.HomeFragment;
import com.a1.nextlocation.fragments.Refreshable; import com.a1.nextlocation.fragments.Refreshable;
@@ -33,6 +32,7 @@ public class MainActivity extends AppCompatActivity implements Refreshable {
/** /**
* onCreate method that creates the main activity * onCreate method that creates the main activity
*
* @param savedInstanceState the saved instance state of the app * @param savedInstanceState the saved instance state of the app
*/ */
@Override @Override
@@ -67,18 +67,20 @@ public class MainActivity extends AppCompatActivity implements Refreshable {
/** /**
* loads the saved language from SharedPreferences * loads the saved language from SharedPreferences
*
* @return the language as string * @return the language as string
*/ */
private String loadLocale(){ private String loadLocale() {
SharedPreferences sharedPreferences = getSharedPreferences("Settings", Activity.MODE_PRIVATE); SharedPreferences sharedPreferences = getSharedPreferences("Settings", Activity.MODE_PRIVATE);
return sharedPreferences.getString("Language", "nl"); return sharedPreferences.getString("Language", "nl");
} }
/** /**
* sets the language of the application to the desired one * sets the language of the application to the desired one
*
* @param language the desired language * @param language the desired language
*/ */
private void setLocale(String language){ private void setLocale(String language) {
Locale locale = new Locale(language); Locale locale = new Locale(language);
Locale.setDefault(locale); Locale.setDefault(locale);
Configuration configuration = new Configuration(); Configuration configuration = new Configuration();
@@ -87,7 +89,7 @@ public class MainActivity extends AppCompatActivity implements Refreshable {
} }
private BottomNavigationView.OnNavigationItemSelectedListener navListener = item -> { private final BottomNavigationView.OnNavigationItemSelectedListener navListener = item -> {
Fragment selectedFragment = null; Fragment selectedFragment = null;
switch (item.getItemId()) { switch (item.getItemId()) {
@@ -119,7 +121,7 @@ public class MainActivity extends AppCompatActivity implements Refreshable {
bottomNav.setSelectedItemId(id); bottomNav.setSelectedItemId(id);
} }
private View.OnClickListener onInfoClickListener = new View.OnClickListener() { private final View.OnClickListener onInfoClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@@ -20,7 +20,7 @@ public enum Data {
this.zoom = zoom; this.zoom = zoom;
} }
private ArrayList<String> visitedNames = new ArrayList<>(); private final ArrayList<String> visitedNames = new ArrayList<>();
public void addDistance(double d) { public void addDistance(double d) {
distanceTraveled += d; distanceTraveled += d;
@@ -51,5 +51,4 @@ public enum Data {
} }
} }

View File

@@ -2,28 +2,15 @@ package com.a1.nextlocation.data;
import android.content.Context; import android.content.Context;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.os.Environment;
import android.util.Log; import android.util.Log;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.json.JSONArray;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays; import java.util.Arrays;
public class FileIO<T> { public class FileIO<T> {
@@ -46,13 +33,13 @@ public class FileIO<T> {
InputStreamReader inputStreamReader = new InputStreamReader(is); InputStreamReader inputStreamReader = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(inputStreamReader); BufferedReader reader = new BufferedReader(inputStreamReader);
String line; String line;
while ((line = reader.readLine())!= null) { while ((line = reader.readLine()) != null) {
sb.append(line); sb.append(line);
} }
Log.d(TAG, "readFileData: got string: " + sb.toString()); Log.d(TAG, "readFileData: got string: " + sb.toString());
res = gson.fromJson(sb.toString(),typeOf); res = gson.fromJson(sb.toString(), typeOf);
Log.d(TAG, "readFileData: got object: " + res); Log.d(TAG, "readFileData: got object: " + res);
reader.close(); reader.close();

View File

@@ -33,11 +33,11 @@ public class Location implements Parcelable {
} }
public Location(@NotNull String name, double latCoord, double longCoord, String description, @Nullable String imageUrl) { public Location(@NotNull String name, double latCoord, double longCoord, String description, @Nullable String imageUrl) {
this(name,getStringFromCoordinates(latCoord,longCoord),description,imageUrl); this(name, getStringFromCoordinates(latCoord, longCoord), description, imageUrl);
} }
public Location(String name, android.location.Location loc, String description, String imageUrl) { public Location(String name, android.location.Location loc, String description, String imageUrl) {
this(name,getStringFromCoordinates(loc.getLatitude(),loc.getLongitude()),description,imageUrl); this(name, getStringFromCoordinates(loc.getLatitude(), loc.getLongitude()), description, imageUrl);
} }
protected Location(Parcel in) { protected Location(Parcel in) {
@@ -89,7 +89,7 @@ public class Location implements Parcelable {
return imageUrl; return imageUrl;
} }
public String getIconUrl(){ public String getIconUrl() {
return iconUrl; return iconUrl;
} }
@@ -119,6 +119,7 @@ public class Location implements Parcelable {
/** /**
* calculates the distance between two coordinates * calculates the distance between two coordinates
*
* @param lat1 the first latitude * @param lat1 the first latitude
* @param lon1 the first longitude * @param lon1 the first longitude
* @param lat2 the second latitude * @param lat2 the second latitude
@@ -135,27 +136,27 @@ public class Location implements Parcelable {
double dlat = lat2 - lat1; double dlat = lat2 - lat1;
double a = Math.pow(Math.sin(dlat / 2), 2) double a = Math.pow(Math.sin(dlat / 2), 2)
+ Math.cos(lat1) * Math.cos(lat2) + Math.cos(lat1) * Math.cos(lat2)
* Math.pow(Math.sin(dlon / 2),2); * Math.pow(Math.sin(dlon / 2), 2);
double c = 2 * Math.asin(Math.sqrt(a)); double c = 2 * Math.asin(Math.sqrt(a));
double distance;
// Radius of earth in kilometers. Use 3956 // Radius of earth in kilometers. Use 3956
// for miles // for miles
// if(miles) { // if(miles) {
// double r = 3956; // double r = 3956;
// distance = c * r;
// } // }
// else { // else {
double r = 6371; double r = 6371;
// } distance = c * r;
// calculate the result
double distance = c * r;
distance *= 1000; distance *= 1000;
// }
return Math.floor(distance); return Math.floor(distance);
} }
public GeoPoint convertToGeoPoint() { public GeoPoint convertToGeoPoint() {
return new GeoPoint(this.getLat(),this.getLong()); return new GeoPoint(this.getLat(), this.getLong());
} }
@Override @Override

View File

@@ -70,7 +70,7 @@ public class Route implements Parcelable {
return totalDistance; return totalDistance;
} }
public String getImageURL(){ public String getImageURL() {
return this.imageURL; return this.imageURL;
} }

View File

@@ -45,13 +45,13 @@ public enum RouteHandler {
isFollowingRoute = false; isFollowingRoute = false;
currentRoute = null; currentRoute = null;
currentRouteLine = null; currentRouteLine = null;
Data.INSTANCE.addTimeWalked(System.currentTimeMillis()-startedTime); Data.INSTANCE.addTimeWalked(System.currentTimeMillis() - startedTime);
startedTime = 0; startedTime = 0;
} }
public void followRoute(Route route) { public void followRoute(Route route) {
if (isFollowingRoute) { if (isFollowingRoute) {
Data.INSTANCE.addTimeWalked(System.currentTimeMillis()-startedTime); Data.INSTANCE.addTimeWalked(System.currentTimeMillis() - startedTime);
} }
this.currentRoute = route; this.currentRoute = route;
setFollowingRoute(true); setFollowingRoute(true);
@@ -61,6 +61,7 @@ public enum RouteHandler {
public boolean isFollowingRoute(Route route) { public boolean isFollowingRoute(Route route) {
return isFollowingRoute && route.equals(currentRoute); return isFollowingRoute && route.equals(currentRoute);
} }
public void setFollowingRoute(boolean followingRoute) { public void setFollowingRoute(boolean followingRoute) {
isFollowingRoute = followingRoute; isFollowingRoute = followingRoute;
} }

View File

@@ -2,17 +2,16 @@ package com.a1.nextlocation.fragments;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
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.R;
import com.a1.nextlocation.data.Coupon; import com.a1.nextlocation.data.Coupon;
import com.a1.nextlocation.recyclerview.CouponAdapter; import com.a1.nextlocation.recyclerview.CouponAdapter;
@@ -64,6 +63,7 @@ public class CouponFragment extends Fragment {
/** /**
* shows the popup of a coupon * shows the popup of a coupon
*
* @param coupon the coupon that will be displayed * @param coupon the coupon that will be displayed
*/ */
private void showPopup(Coupon coupon) { private void showPopup(Coupon coupon) {

View File

@@ -2,7 +2,6 @@ package com.a1.nextlocation.fragments;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@@ -12,7 +11,6 @@ import android.location.LocationManager;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageButton; import android.widget.ImageButton;
@@ -26,17 +24,15 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import com.a1.nextlocation.R; import com.a1.nextlocation.R;
import com.a1.nextlocation.data.RouteHandler;
import com.a1.nextlocation.data.Data; import com.a1.nextlocation.data.Data;
import com.a1.nextlocation.data.RouteHandler;
import com.a1.nextlocation.json.DirectionsResult; import com.a1.nextlocation.json.DirectionsResult;
import com.a1.nextlocation.network.ApiHandler; import com.a1.nextlocation.network.ApiHandler;
import com.a1.nextlocation.network.DirectionsListener;
import com.a1.nextlocation.recyclerview.LocationListManager; import com.a1.nextlocation.recyclerview.LocationListManager;
import org.osmdroid.api.IMapController; import org.osmdroid.api.IMapController;
import org.osmdroid.config.Configuration; import org.osmdroid.config.Configuration;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.CustomZoomButtonsController;
import org.osmdroid.views.MapView; import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ItemizedIconOverlay; import org.osmdroid.views.overlay.ItemizedIconOverlay;
import org.osmdroid.views.overlay.Overlay; import org.osmdroid.views.overlay.Overlay;
@@ -112,7 +108,7 @@ public class HomeFragment extends Fragment implements LocationListener {
* stops the current route * stops the current route
*/ */
private void stopRoute() { private void stopRoute() {
Log.d(TAG, "stopRoute: STOPPING ROUTE" ); Log.d(TAG, "stopRoute: STOPPING ROUTE");
RouteHandler.INSTANCE.finishRoute(); RouteHandler.INSTANCE.finishRoute();
stopButton.setVisibility(View.GONE); stopButton.setVisibility(View.GONE);
Toast.makeText(requireContext(), getResources().getString(R.string.route_stop_toast), Toast.LENGTH_SHORT).show(); Toast.makeText(requireContext(), getResources().getString(R.string.route_stop_toast), Toast.LENGTH_SHORT).show();
@@ -351,7 +347,7 @@ public class HomeFragment extends Fragment implements LocationListener {
com.a1.nextlocation.data.Location last = null; com.a1.nextlocation.data.Location last = null;
if (RouteHandler.INSTANCE.isFollowingRoute()) { if (RouteHandler.INSTANCE.isFollowingRoute()) {
List<com.a1.nextlocation.data.Location> locs = RouteHandler.INSTANCE.getCurrentRoute().getLocations(); List<com.a1.nextlocation.data.Location> locs = RouteHandler.INSTANCE.getCurrentRoute().getLocations();
last = locs.get(locs.size()-1); last = locs.get(locs.size() - 1);
} }
for (com.a1.nextlocation.data.Location l : LocationListManager.INSTANCE.getLocationList()) { for (com.a1.nextlocation.data.Location l : LocationListManager.INSTANCE.getLocationList()) {

View File

@@ -1,11 +1,6 @@
package com.a1.nextlocation.fragments; package com.a1.nextlocation.fragments;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -14,6 +9,9 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.a1.nextlocation.R; import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Location; import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.recyclerview.LocationListManager; import com.a1.nextlocation.recyclerview.LocationListManager;

View File

@@ -1,17 +1,16 @@
package com.a1.nextlocation.fragments; package com.a1.nextlocation.fragments;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
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.R;
import com.a1.nextlocation.data.Location; import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.recyclerview.LocationAdapter; import com.a1.nextlocation.recyclerview.LocationAdapter;

View File

@@ -3,19 +3,18 @@ package com.a1.nextlocation.fragments;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.a1.nextlocation.R; import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Location; import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.data.Route; import com.a1.nextlocation.data.Route;
@@ -36,8 +35,9 @@ public class RouteDetailFragment extends Fragment {
public void onAttach(@NotNull Context context) { public void onAttach(@NotNull Context context) {
super.onAttach(context); super.onAttach(context);
if (context instanceof Refreshable) if (context instanceof Refreshable)
this.refreshable = (Refreshable) context; this.refreshable = (Refreshable) context;
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@@ -48,7 +48,7 @@ public class RouteDetailFragment extends Fragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_route_detail, container, false); View view = inflater.inflate(R.layout.fragment_route_detail, container, false);
if(getArguments().getParcelable("route") != null) { if (getArguments().getParcelable("route") != null) {
this.route = getArguments().getParcelable("route"); this.route = getArguments().getParcelable("route");
} }
@@ -83,32 +83,34 @@ public class RouteDetailFragment extends Fragment {
/** /**
* Button onclick method that starts the route that is being viewed. * Button onclick method that starts the route that is being viewed.
*
* @param view the button * @param view the button
*/ */
public void startRoute(View view) { public void startRoute(View view) {
ApiHandler.INSTANCE.getDirections(route); ApiHandler.INSTANCE.getDirections(route);
RouteHandler.INSTANCE.followRoute(route); RouteHandler.INSTANCE.followRoute(route);
Toast.makeText(requireContext(),"Route started!",Toast.LENGTH_SHORT).show(); Toast.makeText(requireContext(), "Route started!", Toast.LENGTH_SHORT).show();
// navigates to the HomeFragment and refreshes the BottomNavigation // navigates to the HomeFragment and refreshes the BottomNavigation
refreshable.refreshAndNavigateTo(R.id.locations); refreshable.refreshAndNavigateTo(R.id.locations);
} }
/** /**
* Calculates the distance between points * Calculates the distance between points
*
* @param route the route that is calculated * @param route the route that is calculated
* @return the total distance of a route * @return the total distance of a route
*/ */
public double calculateRoute(List<Location> route){ public double calculateRoute(List<Location> route) {
ArrayList<Location> routeArraylist = new ArrayList<>(route); ArrayList<Location> routeArraylist = new ArrayList<>(route);
double totalDistance = 0; double totalDistance = 0;
Location firstLocation; Location firstLocation;
Location secondLocation; Location secondLocation;
System.out.println("Total locations: " + routeArraylist.size()); System.out.println("Total locations: " + routeArraylist.size());
//Cycles through the arraylist //Cycles through the arraylist
for(int i = 0; i < routeArraylist.size() - 1; i++) { for (int i = 0; i < routeArraylist.size() - 1; i++) {
firstLocation = routeArraylist.get(i); firstLocation = routeArraylist.get(i);
secondLocation = routeArraylist.get(i+1); secondLocation = routeArraylist.get(i + 1);
System.out.println("locations distance calculated: " + (i+1) + " and " + (i+2) + "\nThe added distance is: " + Location.getDistance(firstLocation.getLat(), firstLocation.getLong(), secondLocation.getLat(), secondLocation.getLong())); System.out.println("locations distance calculated: " + (i + 1) + " and " + (i + 2) + "\nThe added distance is: " + Location.getDistance(firstLocation.getLat(), firstLocation.getLong(), secondLocation.getLat(), secondLocation.getLong()));
//Calculates the distance between points //Calculates the distance between points
totalDistance += Location.getDistance(firstLocation.getLat(), firstLocation.getLong(), secondLocation.getLat(), secondLocation.getLong()); totalDistance += Location.getDistance(firstLocation.getLat(), firstLocation.getLong(), secondLocation.getLat(), secondLocation.getLong());
} }

View File

@@ -1,6 +1,10 @@
package com.a1.nextlocation.fragments; package com.a1.nextlocation.fragments;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -9,23 +13,12 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
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.R;
import com.a1.nextlocation.data.Route; import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.recyclerview.RouteAdapter; import com.a1.nextlocation.recyclerview.RouteAdapter;
import com.a1.nextlocation.recyclerview.RouteListManager; import com.a1.nextlocation.recyclerview.RouteListManager;
import java.util.List; import java.util.List;
import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.json.DirectionsResult;
import com.a1.nextlocation.network.ApiHandler;
import com.a1.nextlocation.network.DirectionsListener;
public class RouteFragment extends Fragment { public class RouteFragment extends Fragment {
private static final String TAG = RouteFragment.class.getCanonicalName(); private static final String TAG = RouteFragment.class.getCanonicalName();

View File

@@ -5,12 +5,6 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -19,6 +13,11 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Spinner; import android.widget.Spinner;
import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;
import com.a1.nextlocation.R; import com.a1.nextlocation.R;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -90,6 +89,7 @@ public class SettingsFragment extends Fragment {
} }
//Changes the font settings depending on the state of the toggle //Changes the font settings depending on the state of the toggle
fontSwitch.setOnClickListener(view1 -> { fontSwitch.setOnClickListener(view1 -> {
if(fontSwitch.isChecked()) if(fontSwitch.isChecked())
{ {
@@ -126,6 +126,7 @@ public class SettingsFragment extends Fragment {
refresh(); refresh();
} }
} }
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
} }

View File

@@ -3,17 +3,16 @@ package com.a1.nextlocation.fragments;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.a1.nextlocation.R; import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Coupon; import com.a1.nextlocation.data.Coupon;
import com.a1.nextlocation.data.Data; import com.a1.nextlocation.data.Data;
@@ -37,14 +36,17 @@ public class StatisticFragment extends Fragment {
initializeDistanceTextView(view); initializeDistanceTextView(view);
TextView locs = view.findViewById(R.id.statistics_locations_visited); TextView locs = view.findViewById(R.id.statistics_locations_visited);
TextView timeText = view.findViewById(R.id.statistics_time_value); TextView timeText = view.findViewById(R.id.statistics_time_value);
double dist = Data.INSTANCE.getDistanceTraveled() / 1000;
distance.setText("" + String.format("%.1f", dist) + " km");
locs.setText("" + Data.INSTANCE.getLocationsVisited()); locs.setText("" + Data.INSTANCE.getLocationsVisited());
long seconds = Data.INSTANCE.getTotalTime() / 1000; long seconds = Data.INSTANCE.getTotalTime() / 1000;
long p1 = seconds % 60; long p1 = seconds % 60;
long p2 = seconds / 60; long p2 = seconds / 60;
long p3 = p2 % 60; long p3 = p2 % 60;
p2 = p2 / 60; p2 = p2 / 60;
timeText.setText(p2 + ":" + p3 + ":" + p1); timeText.setText(p2 + "u, " + p3 + "m, " + p1 + "s");
//loads the couponList //loads the couponList

View File

@@ -10,10 +10,8 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive; import com.google.gson.JsonPrimitive;
import org.json.JSONArray;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
import java.lang.reflect.Array;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -24,7 +22,7 @@ public class DirectionsResult {
private double distance; private double distance;
private double duration; private double duration;
private double[][] wayPointCoordinates; private double[][] wayPointCoordinates;
private GeoPoint[] startAndEndPoint = new GeoPoint[2]; private final GeoPoint[] startAndEndPoint = new GeoPoint[2];
public List<DirectionsStep> getSteps() { public List<DirectionsStep> getSteps() {
return steps; return steps;
@@ -60,6 +58,7 @@ public class DirectionsResult {
/** /**
* converts all the geopoints in all the steps into an arraylist to display it on the map * converts all the geopoints in all the steps into an arraylist to display it on the map
*
* @return the list of geopoints * @return the list of geopoints
*/ */
public ArrayList<GeoPoint> getGeoPoints() { public ArrayList<GeoPoint> getGeoPoints() {
@@ -101,15 +100,16 @@ public class DirectionsResult {
JsonArray segments = properties.getAsJsonArray("segments"); JsonArray segments = properties.getAsJsonArray("segments");
parseSegments(segments,gson); parseSegments(segments, gson);
startAndEndPoint[0] = this.getSteps().get(0).getWaypoints()[0]; startAndEndPoint[0] = this.getSteps().get(0).getWaypoints()[0];
startAndEndPoint[1] = this.getSteps().get(this.getSteps().size()-1).getWaypoints()[1]; startAndEndPoint[1] = this.getSteps().get(this.getSteps().size() - 1).getWaypoints()[1];
} }
/** /**
* parses the given json string into this object. This method is used for when you have requested directions from the API for a {@link com.a1.nextlocation.data.Route route object} * parses the given json string into this object. This method is used for when you have requested directions from the API for a {@link com.a1.nextlocation.data.Route route object}
*
* @param json the json string * @param json the json string
*/ */
public void parseRoute(String json) { public void parseRoute(String json) {
@@ -138,7 +138,7 @@ public class DirectionsResult {
JsonArray segments = route.getAsJsonArray("segments"); JsonArray segments = route.getAsJsonArray("segments");
parseSegments(segments,gson); parseSegments(segments, gson);
} }
@@ -147,8 +147,9 @@ public class DirectionsResult {
/** /**
* parses different segments, and the steps in it using {@link DirectionsResult#parseSteps(JsonArray, Gson) the method for parsing steps} * parses different segments, and the steps in it using {@link DirectionsResult#parseSteps(JsonArray, Gson) the method for parsing steps}
*
* @param segments the segments to parse * @param segments the segments to parse
* @param gson the gson object to use * @param gson the gson object to use
*/ */
private void parseSegments(JsonArray segments, Gson gson) { private void parseSegments(JsonArray segments, Gson gson) {
//unfold the individual segments //unfold the individual segments
@@ -160,14 +161,15 @@ public class DirectionsResult {
JsonArray steps = segment.getAsJsonArray("steps"); JsonArray steps = segment.getAsJsonArray("steps");
parseSteps(steps,gson); parseSteps(steps, gson);
} }
} }
/** /**
* parses the given steps into this object, transforms them into a {@link DirectionsStep} object. * parses the given steps into this object, transforms them into a {@link DirectionsStep} object.
*
* @param steps the steps to parse * @param steps the steps to parse
* @param gson the gson object to use * @param gson the gson object to use
*/ */
private void parseSteps(JsonArray steps, Gson gson) { private void parseSteps(JsonArray steps, Gson gson) {
for (JsonElement j : steps) { for (JsonElement j : steps) {

View File

@@ -2,9 +2,6 @@ package com.a1.nextlocation.json;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import org.json.JSONArray;
import org.json.JSONException;
/** /**
* source: https://github.com/GIScience/openrouteservice-docs#geometry-decoding * source: https://github.com/GIScience/openrouteservice-docs#geometry-decoding
*/ */
@@ -39,7 +36,7 @@ public class GeometryDecoder {
lng += (result & 1) != 0 ? ~(result >> 1) : (result >> 1); lng += (result & 1) != 0 ? ~(result >> 1) : (result >> 1);
if(inclElevation){ if (inclElevation) {
result = 1; result = 1;
shift = 0; shift = 0;
do { do {
@@ -53,7 +50,7 @@ public class GeometryDecoder {
JsonArray location = new JsonArray(); JsonArray location = new JsonArray();
location.add(lat / 1E5); location.add(lat / 1E5);
location.add(lng / 1E5); location.add(lng / 1E5);
if(inclElevation){ if (inclElevation) {
location.add((float) (ele / 100)); location.add((float) (ele / 100));
} }
geometry.add(location); geometry.add(location);

View File

@@ -6,13 +6,11 @@ import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.data.Route; import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.json.DirectionsResult; import com.a1.nextlocation.json.DirectionsResult;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
@@ -27,32 +25,34 @@ public enum ApiHandler {
INSTANCE; INSTANCE;
private static String TAG = ApiHandler.class.getCanonicalName(); private static final String TAG = ApiHandler.class.getCanonicalName();
public static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); 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 BASE_URL = "https://api.openrouteservice.org/v2/directions/";
private final String API_KEY = "5b3ce3597851110001cf6248d4eee2099f724255918adc71cc502b2a"; private final String API_KEY = "5b3ce3597851110001cf6248d4eee2099f724255918adc71cc502b2a";
private final String DIRECTIONS_MODE = "foot-walking"; private final String DIRECTIONS_MODE = "foot-walking";
private List<DirectionsListener> listeners = new ArrayList<>(); private final List<DirectionsListener> listeners = new ArrayList<>();
private OkHttpClient client = new OkHttpClient(); private final OkHttpClient client = new OkHttpClient();
/** /**
* gets directions from the start location to the end location * gets directions from the start location to the end location
*
* @param startLocation the start location * @param startLocation the start location
* @param endLocation the end location * @param endLocation the end location
*/ */
public void getDirections(Location startLocation, Location endLocation) { public void getDirections(Location startLocation, Location endLocation) {
getDirections(startLocation.getCoordinates(),endLocation.getCoordinates()); getDirections(startLocation.getCoordinates(), endLocation.getCoordinates());
} }
/** /**
* gets directions from the start location latitude and longitude and the end location latitude and longitude * gets directions from the start location latitude and longitude and the end location latitude and longitude
* @param startLat the start latitude *
* @param startLat the start latitude
* @param startLong the start longitude * @param startLong the start longitude
* @param endLat the end latitude * @param endLat the end latitude
* @param endLong the end longitude * @param endLong the end longitude
*/ */
public void getDirections(double startLat, double startLong, double endLat, double endLong) { public void getDirections(double startLat, double startLong, double endLat, double endLong) {
getDirections(startLong + "," + startLat, endLong + "," + endLat); getDirections(startLong + "," + startLat, endLong + "," + endLat);
@@ -60,13 +60,14 @@ public enum ApiHandler {
/** /**
* Gets the directions from the start location to the end location. An example location would be "3.543543,5.7675765" * Gets the directions from the start location to the end location. An example location would be "3.543543,5.7675765"
*
* @param startLocation the start location represented as <i>startlat,startlong</i> * @param startLocation the start location represented as <i>startlat,startlong</i>
* @param endLocation the end location represented as <i>endlat,endlong</i> * @param endLocation the end location represented as <i>endlat,endlong</i>
*/ */
public void getDirections(String startLocation, String endLocation) { public void getDirections(String startLocation, String endLocation) {
// build the url // build the url
String requestUrl = BASE_URL + DIRECTIONS_MODE + "?api_key=" + API_KEY + "&start=" +startLocation + "&end=" + endLocation; String requestUrl = BASE_URL + DIRECTIONS_MODE + "?api_key=" + API_KEY + "&start=" + startLocation + "&end=" + endLocation;
// start a new thread to do the request, because we don't want to be networking on our main thread // start a new thread to do the request, because we don't want to be networking on our main thread
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
@@ -108,6 +109,7 @@ public enum ApiHandler {
/** /**
* adds a listener for when a result of an api call is available * adds a listener for when a result of an api call is available
*
* @param listener the new listener * @param listener the new listener
*/ */
public void addListener(DirectionsListener listener) { public void addListener(DirectionsListener listener) {
@@ -116,6 +118,7 @@ public enum ApiHandler {
/** /**
* gets directions for the given {@link Route} * gets directions for the given {@link Route}
*
* @param route the route to get directions for * @param route the route to get directions for
*/ */
public void getDirections(Route route) { public void getDirections(Route route) {
@@ -135,7 +138,7 @@ public enum ApiHandler {
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
// add the body to the request // add the body to the request
RequestBody requestBody = RequestBody.create(body,JSON); RequestBody requestBody = RequestBody.create(body, JSON);
Request request = new Request.Builder() Request request = new Request.Builder()
.url(requestUrl) .url(requestUrl)
.post(requestBody) .post(requestBody)
@@ -182,6 +185,4 @@ public enum ApiHandler {
} }
} }

View File

@@ -1,6 +1,5 @@
package com.a1.nextlocation.network; package com.a1.nextlocation.network;
import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.json.DirectionsResult; import com.a1.nextlocation.json.DirectionsResult;
public interface DirectionsListener { public interface DirectionsListener {

View File

@@ -1,9 +1,9 @@
package com.a1.nextlocation.recyclerview; package com.a1.nextlocation.recyclerview;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@@ -16,8 +16,8 @@ import java.util.List;
public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponViewHolder> { public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponViewHolder> {
private Context appContext; private final Context appContext;
private List<Coupon> couponList; private final List<Coupon> couponList;
private OnItemClickListener clickListener; private OnItemClickListener clickListener;
public interface OnItemClickListener { public interface OnItemClickListener {
@@ -35,9 +35,10 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
/** /**
* Sets the text of the coupon * Sets the text of the coupon
*
* @param text the text that will be set * @param text the text that will be set
*/ */
public void setTextViewName(String text){ public void setTextViewName(String text) {
TextView couponReward = itemView.findViewById(R.id.coupon_name); TextView couponReward = itemView.findViewById(R.id.coupon_name);
couponReward.setText(text); couponReward.setText(text);
} }
@@ -48,7 +49,7 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
} }
} }
public CouponAdapter(Context context, List<Coupon> coupon, OnItemClickListener listener){ public CouponAdapter(Context context, List<Coupon> coupon, OnItemClickListener listener) {
this.appContext = context; this.appContext = context;
this.couponList = coupon; this.couponList = coupon;
this.clickListener = listener; this.clickListener = listener;

View File

@@ -25,7 +25,7 @@ public enum CouponListManager {
/** /**
* prepares the list for the adapter * prepares the list for the adapter
*/ */
public void load(){ public void load() {
CouponLoader couponLoader = new CouponLoader(this.context); CouponLoader couponLoader = new CouponLoader(this.context);
this.couponList = couponLoader.load(); this.couponList = couponLoader.load();
} }

View File

@@ -20,6 +20,7 @@ public class CouponLoader implements Loader<List<Coupon>> {
/** /**
* Loads the Arraylist of coupons out of the JSON * Loads the Arraylist of coupons out of the JSON
*
* @return Arraylist of coupons * @return Arraylist of coupons
*/ */
@Override @Override
@@ -32,7 +33,8 @@ public class CouponLoader implements Loader<List<Coupon>> {
if (!selectedLanguage.equals("en")) { if (!selectedLanguage.equals("en")) {
fileName += "-" + selectedLanguage; fileName += "-" + selectedLanguage;
} }
ArrayList<Coupon> res = fileIO.readFileData(context, fileName + ".json", new TypeToken<ArrayList<Coupon>>(){}.getType()); ArrayList<Coupon> res = fileIO.readFileData(context, fileName + ".json", new TypeToken<ArrayList<Coupon>>() {
}.getType());
Log.d(TAG, "load: " + res); Log.d(TAG, "load: " + res);
return res == null ? new ArrayList<>() : res; return res == null ? new ArrayList<>() : res;

View File

@@ -17,9 +17,9 @@ import java.util.List;
public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.LocationViewHolder> { public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.LocationViewHolder> {
private Context appContext; private final Context appContext;
private List<Location> locationList; private final List<Location> locationList;
private OnItemClickListener clickListener; private final OnItemClickListener clickListener;
public interface OnItemClickListener { public interface OnItemClickListener {
void onItemClick(int clickedPosition); void onItemClick(int clickedPosition);
@@ -44,18 +44,20 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
/** /**
* Sets the text of the location name * Sets the text of the location name
*
* @param text the text that will be set * @param text the text that will be set
*/ */
public void setTextViewText(String text){ public void setTextViewText(String text) {
this.locationName = itemView.findViewById(R.id.location_name); this.locationName = itemView.findViewById(R.id.location_name);
this.locationName.setText(text); this.locationName.setText(text);
} }
/** /**
* Sets the image of the locatoin * Sets the image of the locatoin
*
* @param text the text of the image filename * @param text the text of the image filename
*/ */
public void setImageViewImage(String text){ public void setImageViewImage(String text) {
this.locationImage = itemView.findViewById(R.id.location_image); this.locationImage = itemView.findViewById(R.id.location_image);
Context context = locationImage.getContext(); Context context = locationImage.getContext();
int id = context.getResources().getIdentifier(text, "drawable", context.getPackageName()); int id = context.getResources().getIdentifier(text, "drawable", context.getPackageName());
@@ -63,7 +65,7 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
} }
} }
public LocationAdapter(Context context, List<Location> location, OnItemClickListener listener){ public LocationAdapter(Context context, List<Location> location, OnItemClickListener listener) {
this.appContext = context; this.appContext = context;
this.locationList = location; this.locationList = location;
this.clickListener = listener; this.clickListener = listener;

View File

@@ -4,8 +4,6 @@ import android.content.Context;
import com.a1.nextlocation.data.Location; import com.a1.nextlocation.data.Location;
import org.osmdroid.util.GeoPoint;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@@ -7,7 +7,6 @@ import com.a1.nextlocation.data.Location;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class LocationLoader implements Loader<List<Location>> { public class LocationLoader implements Loader<List<Location>> {
@@ -19,6 +18,7 @@ public class LocationLoader implements Loader<List<Location>> {
/** /**
* loads the array list from a JSON file * loads the array list from a JSON file
*
* @return array list with locations * @return array list with locations
*/ */
@Override @Override
@@ -32,7 +32,8 @@ public class LocationLoader implements Loader<List<Location>> {
fileName += "-" + selectedLanguage; fileName += "-" + selectedLanguage;
} }
ArrayList<Location> res = fileIO.readFileData(context,fileName + ".json",new TypeToken<ArrayList<Location>>(){}.getType()); ArrayList<Location> res = fileIO.readFileData(context, fileName + ".json", new TypeToken<ArrayList<Location>>() {
}.getType());
return res == null ? new ArrayList<>() : res; return res == null ? new ArrayList<>() : res;
} }

View File

@@ -1,7 +1,6 @@
package com.a1.nextlocation.recyclerview; package com.a1.nextlocation.recyclerview;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -11,16 +10,15 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.a1.nextlocation.R; import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.data.Route; import com.a1.nextlocation.data.Route;
import java.util.List; import java.util.List;
public class RouteAdapter extends RecyclerView.Adapter<RouteAdapter.RouteViewHolder>{ public class RouteAdapter extends RecyclerView.Adapter<RouteAdapter.RouteViewHolder> {
private Context appContext; private final Context appContext;
private List<Route> routeList; private final List<Route> routeList;
private CouponAdapter.OnItemClickListener clickListener; private final CouponAdapter.OnItemClickListener clickListener;
public interface OnItemClickListener { public interface OnItemClickListener {
void onItemClick(int clickedPosition); void onItemClick(int clickedPosition);
@@ -43,15 +41,16 @@ public class RouteAdapter extends RecyclerView.Adapter<RouteAdapter.RouteViewHol
/** /**
* sets the text of the route name * sets the text of the route name
*
* @param text the text that will be set * @param text the text that will be set
*/ */
public void setTextViewText(String text){ public void setTextViewText(String text) {
this.routeName = itemView.findViewById(R.id.route_name); this.routeName = itemView.findViewById(R.id.route_name);
this.routeName.setText(text); this.routeName.setText(text);
} }
} }
public RouteAdapter(Context context, List<Route> route, CouponAdapter.OnItemClickListener listener){ public RouteAdapter(Context context, List<Route> route, CouponAdapter.OnItemClickListener listener) {
appContext = context; appContext = context;
routeList = route; routeList = route;
clickListener = listener; clickListener = listener;

View File

@@ -7,7 +7,7 @@ import com.a1.nextlocation.data.Route;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public enum RouteListManager{ public enum RouteListManager {
INSTANCE; INSTANCE;
private List<Route> routeList; private List<Route> routeList;

View File

@@ -3,12 +3,10 @@ package com.a1.nextlocation.recyclerview;
import android.content.Context; import android.content.Context;
import com.a1.nextlocation.data.FileIO; import com.a1.nextlocation.data.FileIO;
import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.data.Route; import com.a1.nextlocation.data.Route;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class RouteLoader implements Loader<List<Route>> { public class RouteLoader implements Loader<List<Route>> {
@@ -20,6 +18,7 @@ public class RouteLoader implements Loader<List<Route>> {
/** /**
* loads an array list from a JSON * loads an array list from a JSON
*
* @return an array list with routes * @return an array list with routes
*/ */
@Override @Override
@@ -34,7 +33,8 @@ public class RouteLoader implements Loader<List<Route>> {
fileName += "-" + selectedLanguage; fileName += "-" + selectedLanguage;
} }
ArrayList<Route> res = fileIO.readFileData(context, fileName + ".json",new TypeToken<ArrayList<Route>>(){}.getType()); ArrayList<Route> res = fileIO.readFileData(context, fileName + ".json", new TypeToken<ArrayList<Route>>() {
}.getType());
return res == null ? new ArrayList<>() : res; return res == null ? new ArrayList<>() : res;
} }