From c3d317baeae124fdb4a17089a9576436425aecca Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Wed, 6 Jan 2021 19:29:00 +0100 Subject: [PATCH 1/2] Added even more comments --- .../a1/nextlocation/recyclerview/CouponListManager.java | 2 +- .../a1/nextlocation/recyclerview/LocationListManager.java | 7 +++---- .../com/a1/nextlocation/recyclerview/LocationLoader.java | 4 ++++ .../com/a1/nextlocation/recyclerview/RouteAdapter.java | 4 ++++ .../a1/nextlocation/recyclerview/RouteListManager.java | 8 +++----- .../com/a1/nextlocation/recyclerview/RouteLoader.java | 4 ++++ 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/CouponListManager.java b/app/src/main/java/com/a1/nextlocation/recyclerview/CouponListManager.java index eba6b40..5bef09f 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/CouponListManager.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/CouponListManager.java @@ -23,7 +23,7 @@ public enum CouponListManager { } /** - * Prepares the list for loading + * prepares the list for the adapter */ public void load(){ CouponLoader couponLoader = new CouponLoader(this.context); diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/LocationListManager.java b/app/src/main/java/com/a1/nextlocation/recyclerview/LocationListManager.java index 84e2eb9..32e2a67 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/LocationListManager.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/LocationListManager.java @@ -24,10 +24,9 @@ public enum LocationListManager { return locationList; } - public Location getLocation(int place) { - return locationList.get(place); - } - + /** + * prepares the array list for the adapter + */ public void load() { LocationLoader locationLoader = new LocationLoader(this.context); this.locationList = locationLoader.load(); diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/LocationLoader.java b/app/src/main/java/com/a1/nextlocation/recyclerview/LocationLoader.java index 313c151..ae17206 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/LocationLoader.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/LocationLoader.java @@ -17,6 +17,10 @@ public class LocationLoader implements Loader> { this.context = context; } + /** + * loads the array list from a JSON file + * @return array list with locations + */ @Override public ArrayList load() { FileIO> fileIO = new FileIO<>(); diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/RouteAdapter.java b/app/src/main/java/com/a1/nextlocation/recyclerview/RouteAdapter.java index dffb982..1c5ea9a 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/RouteAdapter.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/RouteAdapter.java @@ -41,6 +41,10 @@ public class RouteAdapter extends RecyclerView.Adapter(); } - public List getRouteList() { return routeList; } - public Route getRoute(int place) { - return routeList.get(place); - } - + /** + * prepares the array list for the adapter + */ public void load() { RouteLoader routeLoader = new RouteLoader(this.context); this.routeList = routeLoader.load(); diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/RouteLoader.java b/app/src/main/java/com/a1/nextlocation/recyclerview/RouteLoader.java index df65664..0317961 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/RouteLoader.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/RouteLoader.java @@ -18,6 +18,10 @@ public class RouteLoader implements Loader> { this.context = context; } + /** + * loads an array list from a JSON + * @return an array list with routes + */ @Override public ArrayList load() { From 615401c0d3bee99bdf0887998f4802b1c0fac0e5 Mon Sep 17 00:00:00 2001 From: sebas Date: Wed, 6 Jan 2021 19:31:01 +0100 Subject: [PATCH 2/2] Commented settingsFragment --- .../java/com/a1/nextlocation/fragments/SettingsFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java index 4db58f4..3549a40 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java @@ -59,18 +59,22 @@ public class SettingsFragment extends Fragment { ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit(); }); + //Initialises 65+ switchCompat this.fontChanger = view.findViewById(R.id.BigFont); + //Initialises sharedpreference to save state of 65+ mode SharedPreferences sharedPreferences = requireActivity().getSharedPreferences("com.a1.nextlocation",0); SharedPreferences.Editor editor = sharedPreferences.edit(); fontChanger.setChecked(sharedPreferences.getBoolean("switch", false)); + //Initial check to see what setting was last chosen if (fontChanger.isChecked()){ requireActivity().setTheme(R.style.Theme_NextLocationBig); }else if (!fontChanger.isChecked()){ requireActivity().setTheme(R.style.Theme_NextLocation); } + //Changes the font settings depending on the state of the toggle fontChanger.setOnClickListener(view1 -> { if(fontChanger.isChecked()) {