34 Commits

Author SHA1 Message Date
Robin Koedood
1db6d03da7 [ADD] Extra route and locations description 2021-01-06 14:07:19 +01:00
Robin Koedood
8a758f1d8d [ADD] Start Route button from other branch 2021-01-06 13:55:20 +01:00
Robin Koedood
ca8d291262 [CHANGED] String values 2021-01-06 13:44:17 +01:00
Robin Koedood
f0ef9512a0 Merge remote-tracking branch 'origin/RecyclerView' into Tests 2021-01-06 13:32:22 +01:00
Robin Koedood
21c479076d Merge remote-tracking branch 'origin/follow-route' into Tests 2021-01-06 12:10:05 +01:00
Robin Koedood
0ed16ee069 [CHANGED] String values 2021-01-06 12:08:25 +01:00
Robin Koedood
525d4b776d Merge remote-tracking branch 'origin/develop' into Tests 2021-01-06 11:14:19 +01:00
Robin Koedood
da2a9e43bc Merge remote-tracking branch 'origin/Tests' into Tests 2021-01-06 10:50:18 +01:00
Robin Koedood
3d1cfd244b [ADD] Main Activity Test 2021-01-06 10:50:14 +01:00
Bart
40e3ca3d51 Merge branch 'languages' into develop 2021-01-06 10:49:35 +01:00
Bart
6dd2f5de40 default strings.xml is now English, added more string resources 2021-01-06 10:48:23 +01:00
Bipin
399652c2ce Merge branch 'Tests' of https://github.com/SemvdH/Next-Location into Tests 2021-01-06 10:41:10 +01:00
Bipin
d9a6e1eff0 GeometryStart 2021-01-06 10:41:07 +01:00
Bart
00d306631b Finished language functionality 2021-01-05 17:19:09 +01:00
Robin Koedood
20c09c3458 [TRIED] MainActivity Test 2021-01-05 16:52:48 +01:00
Bart
f7a2a79d00 Language can be changed, doesn't refresh automatically yet 2021-01-05 16:20:43 +01:00
Robin Koedood
e71c195573 [ADD] DirectionResultTest 2021-01-05 16:11:19 +01:00
Robin Koedood
d4d452e723 Merge remote-tracking branch 'origin/Tests' into Tests 2021-01-05 16:04:32 +01:00
Robin Koedood
f381a29274 [ADD] DirectionsStep test 2021-01-05 16:04:25 +01:00
Bart
fe5a5b6dfd Added functionality to the dropdown in settings. Language preference is stored in the sharedPreferences 2021-01-05 13:38:21 +01:00
Bipin
7e0b888974 Merge branch 'Tests' of https://github.com/SemvdH/Next-Location into Tests 2021-01-05 13:36:43 +01:00
Bipin
804bdddbef Remove detail 2021-01-05 13:36:14 +01:00
Robin Koedood
e1636c6bec Merge remote-tracking branch 'origin/Tests' into Tests 2021-01-05 13:32:50 +01:00
Robin Koedood
77a6226c1d [ADD] Comments 2021-01-05 13:32:44 +01:00
Bipin
c6b33f2663 fixie 2021-01-05 13:29:33 +01:00
Bipin
ba83d69c9f Merge branch 'Tests' of https://github.com/SemvdH/Next-Location into Tests
# Conflicts:
#	app/src/main/res/layout/fragment_settings.xml
2021-01-05 13:27:46 +01:00
Bipin
08902472a3 Added Settings and Statistics, started detail 2021-01-05 13:27:25 +01:00
Robin Koedood
e36e853875 [ADD] Route Fragment test 2021-01-05 13:19:27 +01:00
Robin Koedood
356ee55375 Merge remote-tracking branch 'origin/RecyclerView' into Tests 2021-01-05 13:16:30 +01:00
Robin Koedood
3b363b3f33 [ADD] Location Detail Fragment Test 2021-01-05 12:07:15 +01:00
Robin Koedood
89902a5962 Merge remote-tracking branch 'origin/RecyclerView' into Tests 2021-01-05 12:03:36 +01:00
Robin Koedood
a0d35caeb5 [ADD] Coupon test 2021-01-05 11:44:25 +01:00
Robin Koedood
d3cab8c70d [ADD] Location Tests + ID at every XML file 2021-01-05 10:58:33 +01:00
Bart
f236067706 Added English string.xml 2021-01-05 10:45:32 +01:00
36 changed files with 816 additions and 132 deletions

View File

@@ -53,7 +53,14 @@ dependencies {
//osm bonus pack
implementation 'com.github.MKergall:osmbonuspack:6.6.0'
//BeforeEach
testImplementation(platform('org.junit:junit-bom:5.7.0'))
testImplementation 'org.junit.jupiter:junit-jupiter'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
testImplementation 'org.mockito:mockito-core:2.7.22'
androidTestImplementation 'com.21buttons:fragment-test-rule:2.0.1'
androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0-alpha02'
}

View File

@@ -0,0 +1,50 @@
package com.a1.nextlocation;
import androidx.test.espresso.Root;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.espresso.matcher.RootMatchers;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.CouponFragment;
import com.a1.nextlocation.fragments.LocationFragment;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isChecked;
import static androidx.test.espresso.matcher.ViewMatchers.isClickable;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
public class CouponFragmentTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void clickBackButton() throws Exception{
//Here we click the back button and then we check if the statisticsFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit();
onView(withId(R.id.coupon_back_button)).perform(click());
onView(withId(R.id.statisticsFragment)).check(matches(isDisplayed()));
}
@Test
public void clickDetailButton() throws Exception{
//Here we click a coupon and then a popup dialog shows, we press the "activeren" button in it and if the next dialog with the code and with
//the button "Klaar" is shown then the test works
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new CouponFragment()).commit();
onView(withId(R.id.coupon_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
onView(withText("activeren")).inRoot(RootMatchers.isDialog()).perform(click());
onView(withText("Klaar")).inRoot(RootMatchers.isDialog()).check(matches(isDisplayed()));
}
}

View File

@@ -0,0 +1,27 @@
package com.a1.nextlocation;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.CouponFragment;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
public class LocationDetailFragment {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void clickBackButton() throws Exception{
//Here we click the back button and then we check if the locationFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new com.a1.nextlocation.fragments.LocationDetailFragment()).commit();
onView(withId(R.id.detail_location_back_button)).perform(click());
onView(withId(R.id.locationFragment)).check(matches(isDisplayed()));
}
}

View File

@@ -0,0 +1,42 @@
package com.a1.nextlocation;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.LocationFragment;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import static androidx.test.espresso.Espresso.*;
import static androidx.test.espresso.action.ViewActions.*;
import static androidx.test.espresso.assertion.ViewAssertions.*;
import static androidx.test.espresso.matcher.ViewMatchers.*;
public class LocationFragmentTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void clickBackButton() throws Exception{
//Here we click the back button and then we check if the homeFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit();
onView(withId(R.id.location_back_button)).perform(click());
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
}
@Test
public void clickDetailButton() throws Exception{
//Here we click an item in the recyclerview and then check if the routeDetailFragment is called
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new LocationFragment()).commit();
onView(withId(R.id.location_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
onView(withId(R.id.locationDetailFragment)).check(matches(isDisplayed()));
}
}

View File

@@ -0,0 +1,64 @@
package com.a1.nextlocation;
import android.app.LauncherActivity;
import android.widget.Button;
import androidx.test.espresso.contrib.NavigationViewActions;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.espresso.matcher.RootMatchers;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.CouponFragment;
import com.google.android.material.bottomnavigation.BottomNavigationItemView;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void clickLocationsNavBar() throws Exception{
//Here we click the back button and then we check if the statisticsFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().commit();
onView(withId(R.id.locations)).perform(click());
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
}
@Test
public void clickRouteNavBar() throws Exception{
//Here we click the back button and then we check if the statisticsFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().commit();
onView(withId(R.id.routes)).perform((click()));
onView(withId(R.id.routeFragment)).check(matches(isDisplayed()));
}
@Test
public void clickStatisticsNavBar() throws Exception{
//Here we click the back button and then we check if the statisticsFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().commit();
onView(withId(R.id.statistics)).perform(click());
onView(withId(R.id.statisticsFragment)).check(matches(isDisplayed()));
}
@Test
public void clickSettingNavBar() throws Exception{
//Here we click the back button and then we check if the statisticsFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().commit();
onView(withId(R.id.settings)).perform(click());
onView(withId(R.id.settingFragment)).check(matches(isDisplayed()));
}
}

View File

@@ -0,0 +1,39 @@
package com.a1.nextlocation;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.LocationFragment;
import com.a1.nextlocation.fragments.RouteFragment;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
public class RouteFragmentTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void clickBackButton() throws Exception{
//Here we click the back button and then we check if the homeFragment is shown
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new RouteFragment()).commit();
onView(withId(R.id.route_back_button)).perform(click());
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
}
@Test
public void clickDetailButton() throws Exception{
//Here we click an item in the recyclerview and then check if the routeDetailFragment is called
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new RouteFragment()).commit();
onView(withId(R.id.route_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
onView(withId(R.id.routeDetailFragment)).check(matches(isDisplayed()));
}
}

View File

@@ -0,0 +1,70 @@
package com.a1.nextlocation;
import androidx.test.espresso.action.ViewActions;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.espresso.matcher.RootMatchers;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.LocationFragment;
import com.a1.nextlocation.fragments.SettingsFragment;
import com.a1.nextlocation.fragments.StatisticFragment;
import org.hamcrest.core.AllOf;
import org.hamcrest.core.Is;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import static androidx.test.espresso.Espresso.*;
import static androidx.test.espresso.action.ViewActions.*;
import static androidx.test.espresso.assertion.ViewAssertions.*;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static androidx.test.espresso.matcher.ViewMatchers.*;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.is;
public class SettingsFragmentTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
//Tests if the back button sends you back home
@Test
public void clickBackButton() throws Exception{
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new SettingsFragment()).commit();
onView(withId(R.id.settings_back_button)).perform(click());
onView(withId(R.id.homeFragment)).check(matches(isDisplayed()));
}
//Checks if the dropdown is clickable, and checks if it has children
@Test
public void dropdownTest(){
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new SettingsFragment()).commit();
onView(withId(R.id.dropdown_menu_Settings)).check(matches(isClickable()));
onView(withId(R.id.dropdown_menu_Settings)).check(matches(hasMinimumChildCount(1)));
}
//Tests if all buttons are clickable, and if they get checked after being clicked.
@Test
public void buttonTest(){
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new SettingsFragment()).commit();
onView(withId(R.id.settingsImperialButton)).check(matches(isClickable()));
onView(withId(R.id.settingsOldButton)).check(matches(isClickable()));
onView(withId(R.id.settingsEyesButton)).check(matches(isClickable()));
onView(withId(R.id.settingsImperialButton)).perform(click());
onView(withId(R.id.settingsImperialButton)).check(matches(isChecked()));
onView(withId(R.id.settingsOldButton)).perform(click());
onView(withId(R.id.settingsOldButton)).check(matches(isChecked()));
onView(withId(R.id.settingsEyesButton)).perform(click());
onView(withId(R.id.settingsEyesButton)).check(matches(isChecked()));
}
}

View File

@@ -0,0 +1,38 @@
package com.a1.nextlocation;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.rule.ActivityTestRule;
import com.a1.nextlocation.fragments.LocationFragment;
import com.a1.nextlocation.fragments.StatisticFragment;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import static androidx.test.espresso.Espresso.*;
import static androidx.test.espresso.action.ViewActions.*;
import static androidx.test.espresso.assertion.ViewAssertions.*;
import static androidx.test.espresso.matcher.ViewMatchers.*;
public class StatisticFragmentTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
//Tests to see if all boxes get created
@Test
public void checkText() throws Exception{
mActivityTestRule.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.mainActivity, new StatisticFragment()).commit();
onView(withId(R.id.textView)).check(matches(isDisplayed()));
onView(withId(R.id.name_box)).check(matches(isDisplayed()));
onView(withId(R.id.Box2)).check(matches(isDisplayed()));
onView(withId(R.id.Box3)).check(matches(isDisplayed()));
onView(withId(R.id.Box4)).check(matches(isDisplayed()));
}
}

View File

@@ -2,134 +2,134 @@
{
"name":"McDonald's Breda Karnemelkstraat",
"coordinates":"51.58596318905295,4.77586651481887",
"description":"McDonald's restaurant",
"imageUrl":"NULL"
"description":"Wist je dat McDonalds de grootste restaurantketen ter wereld is? Hierdoor hebben we een indrukwekkende geschiedenis. Maar wij kijken liever naar onze toekomst. Nieuwe restaurants, betere producten en duurzaam ondernemen. Wil je meer weten over McDonalds? Lees verder op: https://www.mcdonalds.com/nl/nl-nl/over-ons.html!",
"imageUrl":"mc_donalds"
},
{
"name":"Subway Karnemelkstraat 10 A, 1",
"coordinates":"51.58632782568612,4.775219531501114",
"description":"4811 KJ Breda",
"imageUrl":"NULL"
"description":"Subway is een Amerikaanse multinationale fastfoodketen die voornamelijk sandwiches verkoopt. Het bedrijf onderscheidt zich van veel andere broodjeszaken doordat de klant zelf de sandwich kan laten samenstellen. Subway werkt met franchisenemers. Het bedrijf heeft bijna 45.000 vestigingen in alle werelddelen.",
"imageUrl":"subway"
},
{
"name":"Wok To Go Halstraat 40",
"coordinates":"51.58650312572897,4.777467069592386",
"description":"4811HX Breda",
"imageUrl":"NULL"
"description":"Bij Wok To Go houden we van snelle, gezonde en smaakvolle maaltijden. Sinds 2003 ontwikkelen onze chef-koks de lekkerste wokgerechten met verse ingrediënten. We doen dit vól overgave onder het motto “Making people happy through food”. Door het roerbakken met een kleine hoeveelheid olie op grote hitte, blijven de smaak en gezonde voedingsstoffen bewaard. We kiezen voor gezonde en unieke ingrediënten en bereiden uitgebalanceerde gerechten in een Wokki box voor een gezonde levensstijl.",
"imageUrl":"wok_to_go"
},
{
"name":"De Boterhal Grote Markt 19",
"coordinates":"51.588069667604756,4.7762685632180695",
"description":"4811XL Breda",
"imageUrl":"NULL"
"description":"De Boterhal in Breda is een internationaal tapasrestaurant, speciaalbiercafé en wijnbar. Men kan gezellig bij ons lunchen, borrelen en dineren. Wij hebben een uitgebreide menukaart met een hele hoop bieren, wijnen, zowel per glas als per fles te verkrijgen, lunch en tapasgerechtjes. Naast het eten wat wij serveren hebben we ook een hoop bieren en wijnen. Naast de bieren op de kaart hebben wij wisselende bieren; vijf ketelbieren en vijf seizoensbieren.",
"imageUrl":"de_boter_hal"
},
{
"name":"Gauchos Grote Markt 33",
"coordinates":"51.58859328857082,4.77601349563689",
"description":"4811XP Breda",
"imageUrl":"NULL"
"description":"De middeleeuwse Grote Markt is een historische plek in het Bourgondische hart van Breda, ooit in handen van de Spaanse bezetter. Gauchos Grill-Restaurant combineert daar Brabantse gemoedelijkheid met professionele gastvrijheid. In onze Latijnse keuken bereiden wij op uw aanwijzing een malse Argentijnse steak of een smakelijk visgerecht van de grill.",
"imageUrl":"gauchos"
},
{
"name":"The Tosti Club Breda A4, Vlaszak 2",
"coordinates":"51.58905632735254,4.780729463841719",
"description":"4811GR Breda",
"imageUrl":"NULL"
"description":"Je kunt bij al onze vestigingen de hele dag terecht, want bij The Tosti Club eet je het klokje rond. Dus kom gezellig ontbijten, lunchen of voor een snelle hap aan het einde van de dag (wat dacht je van onze The Tosti Slice, onze variant op pizza!). Even geen zin in brood? Dan kunnen we je ook verblijden met onder andere acaï smoothiebowls, pancakes, granolas / yoghurt of gewoon een lekkere warme drank met gebak. Mogen we je de Red Velvet fudge cake aanraden?",
"imageUrl":"the_tosti_club"
},
{
"name":"Coffee & Lunch 4 you Oude Vest 31",
"coordinates":"51.58741730235298,4.779832967540571",
"description":"4811HS Breda",
"imageUrl":"NULL"
"description":"Welkom bij Coffee & Lunch 4 you! Onze sfeervolle lunchroom is gelegen in het centrum van Breda, in de directe nabijheid van de parkeergarage en de fietsenstalling.",
"imageUrl":"coffee_and_lunch"
},
{
"name":"t Zusje Breda Vismarktstraat 28",
"coordinates":"51.590133292554434,4.773911506170458",
"description":"4811WE Breda",
"imageUrl":"NULL"
"description":"Dat is een avond bij t Zusje. Gezellig samenzijn in een huiselijke sfeer en genieten van onze kleine gerechtjes, die je de hele avond kunt bestellen. Bij t Zusje ben je thuis: jij bepaalt zelf de invulling van de avond.\nWe horen graag wat je wensen zijn, vinden het leuk je te verrassen met bijzondere gerechtjes en zetten graag die extra stap. We bieden je een avond uit, zoals wij die zelf ook graag zien. Avondvullend Bourgondisch genieten? In het prachtige pand van ons Zusje in Breda beleef je een gezellige avond met avondvullend tapas eten voor 31,80.\nBel snel en reserveer!",
"imageUrl":"t_zusje_breda"
},
{
"name":"VR-World Nassaustraat 2",
"coordinates":"51.5913566342086,4.786256804321071",
"description":"4811DD Breda",
"imageUrl":"NULL"
"description":"Virtual Reality is hét uitje van dit moment. Zombies verslaan, vuurballen schieten of met laserzwaarden vechten, met Virtual Reality is niks te gek. Bij VR World zijn we elke dag opzoek naar de nieuwste experiences voor jullie.\n\nWat dacht je bijvoorbeeld van een Escape Room, maar dan in Virtual Reality? Bij VR World bieden wij de nieuwste Escapes aan op het gebied van Virtual Reality. Ontsnap bijvoorbeeld uit een Piramide of ontmantel een raket. Durf jij deze uitdaging aan?\n\nVR World is gelegen op een unieke locatie, namelijk de koepelgevangenis van Breda. Deze gevangenis was tot 2016 nog in werking en daarna hebben bedrijven er hun intrek genomen, zo ook VR World.",
"imageUrl":"vr_world"
},
{
"name":"Kees Kroket Houtmarkt 9",
"coordinates":"51.58647180329833,4.77741809637617",
"description":"KEEEEES KROKET!",
"imageUrl":"NULL"
"description":"KEEEEES KROKET! Al meer dan tien jaar is Kees Kroket in het centrum van Breda gevestigd, vlakbij het winkelend publiek. Eerst in de welbekende Houtmarktpassage en sinds april 2019 zijn we gevestigd op onze nieuwe locatie aan de Houtmarkt 9. U proeft de kwaliteit bij onze verse frites. Deze, uit de Agria aardappel gesneden frites, wordt in zonnebloemolie voorgebakken en in een mix van plantaardige oliën afgebakken. Dit zorgt niet alleen voor de heerlijke smaak maar ook dat onze frites relatief weinig verzadigde vetten en transvetzuren bevat, waardoor we van het beeldmerk Verantwoord Frituren gebruik mogen maken.",
"imageUrl":"kees_kroket"
},
{
"name":"Prison Escape Kloosterlaan 168",
"coordinates":"51.59073795635181,4.784917104321059",
"description":"4811EE Breda",
"imageUrl":"NULL"
"description":"Prison Escape duurt in het totaal 3 uur en je hebt als doel om te ontsnappen uit de zwaarbewaakte gevangenis. Een cast van 25 acteurs brengt de ervaring tot leven en het is aan jou om een weg naar buiten te vinden. In de gevangenis zijn verschillende objecten verstopt die het wellicht makkelijker zouden kunnen maken om de weg naar buiten te realiseren.\n\nWees op je hoede, kijk goed om je heen, vertrouw (bijna) niemand en stap op mensen af..\nDe klok tikt en jij hebt 1 doel: de weg naar de vrijheid vinden.",
"imageUrl":"prison_escape_room"
},
{
"name":"De Koepel - FutureDome Events Nassausingel 26",
"coordinates":"51.590431588532105,4.786756741648511",
"description":"4811HP Breda",
"imageUrl":"NULL"
"description":"n groepen word je onder begeleiding van een van onze gidsen rondgeleid langs de meest unieke en mooiste monumentale plekken in en rondom de Koepel!\n\u200B\n\nDe gids zal hierbij op de verschillende locaties toelichting geven over het roemruchte verleden. De rondleiding over het gevangenisterrein brengt u onder andere langs de koepel, de authentieke kapel, vrouwengevangenis, verschillende luchtplaatsen en het oude gerechtsgebouw.",
"imageUrl":"de_koepel_future_events"
},
{
"name":"Escaping Breda: Escape Room Games Boschstraat 114",
"coordinates":" 51.59110835530862,4.784147222780912",
"description":"4811GK Breda",
"imageUrl":"NULL"
"description":"Escaping Breda is een nieuwe moderne locatie en heeft op dit moment 2 avontuurlijke escape rooms. Daarnaast komen er volgend jaar nog 2 extra escape rooms bij. \n\nOntsnap uit de spannende escape room Lets Rob The Bank, een kamer geschikt voor volwassenen én kinderen. Ontsnap je liever uit een escape room met een hoger spannings- en spelniveau? Kies dan voor Patient X.\n\nOp onze locatie in Breda hebben we ook een gezellig boardgame café. Combineer je ontsnapping met een drankje, hapje en alle gratis boardgames.\n\nEscaping Breda is de perfecte plek voor een uitje met je familie, vrienden of collegas.",
"imageUrl":"escaping_room"
},
{
"name":"MEZZ Breda Keizerstraat 101",
"coordinates":"51.58394697737321,4.779757901349616",
"description":"4811HL Breda",
"description":"MEZZ is een open club, betrokken, nieuwsgierig en onderzoekend. MEZZ heeft humor, is gevat, soms provocatief en verrassend. Beleving en plezier staan centraal waarbij wij bottom up denken. Wij zijn er voor jou, jouw MEZZ. Heb je ideeën of wil je meer weten, neem contact op. Wij reageren altijd.",
"imageUrl":"mezz_breda"
},
{
"name":"Het Klooster Breda Schorsmolenstraat 13",
"coordinates":"51.58775443759389,4.765568874365066",
"description":"4811VN Breda",
"imageUrl":"NULL"
"description":"In dit oude Kapucijnenklooster wordt een woon- en werkgemeenschap gevestigd onder de naam\n”Het Klooster Breda”. \nMet de inkomsten uit bedrijvigheid wordt 12 mensen die dakloos zijn onderdak geboden, van waaruit zij zich weer een plek in de samenleving kunnen verwerven.",
"imageUrl":"het_klooster_breda"
},
{
"name":"Beach & Lounge club Spider “rooftop bar” Nieuwe Prinsenkade",
"coordinates":"51.59212977605884,4.774043765582372",
"description":"4811VC Breda",
"imageUrl":"NULL"
"description":"Beach & Lounge Club Spider staat bekent om zijn immens populaire locatie in Bergen op Zoom. Sinds 2020 heeft deze hoog segment lounge club een tweede locatie geopend in Breda genaamd Beach & Lounge Club Spider Rooftop Bar.",
"imageUrl":"beach_and_lounge_club"
},
{
"name":"Koningin Wilhelmina Paviljoen Kraanstraat 4b",
"coordinates":"51.590645369292396,4.776045124415531",
"description":"4811XV Breda",
"imageUrl":"NULL"
"description":"Koningin Wilhelmina Paviljoen is een bouwwerk in Breda Centrum in Breda. Het behoort tot de Koninklijke Militaire Academie (KMA) en bezit de status van rijksmonument. Het staat aan het Kasteelplein 15, vlak voor het Kasteel van Breda. Het ligt met de voorgevel aan de westkant van de oprijlaan van het kasteel, met de lange rechterzijgevel aan de kasteelgracht en de lange linkerzijgevel aan de Cingelstraat.",
"imageUrl":"koningin_wilhelimna_paviljoen"
},
{
"name":"Hercules en de Nemeïsche leeuw",
"coordinates":"51.59130522182325,4.778161739135078",
"description":"4811XJ Breda",
"imageUrl":"NULL"
"description":"Het beeld toont Hercules met de huid van de Nemeïsche leeuw. Herakles of Hercules is een figuur uit de Griekse mythologie. Hij was een Griekse heros en werd beroemd om de 12 moeilijke werken die hij uitvoerde in opdracht van koning Eurystheus. Het beeld maakt onderdeel uit van 17 anderen zandstenen beelden die Willem III tussen 1670 en 1686 kocht. De beelden stonden verdeeld over grasperken in het Valkenberg park.\nHercules is het enige originele beeld dat overgebleven is.",
"imageUrl":"hercules_park_valkenburg"
},
{
"name":"Nassau-Baroniemonument - 1905 - Pierre Cuypers Delpratsingel 1",
"coordinates":"51.592530636759136,4.780278353833301",
"description":"4811AM Breda",
"imageUrl":"NULL"
"description":"Het Baroniemonument of Nassau-Baroniemonument is een beeld van de Nederlandse architect Pierre Cuypers. Het staat in het Park Valkenberg in Breda. Het monument werd geplaatst ter herinnering aan de 500-jarige band (1904) tussen Breda en het huis Oranje-Nassau. In 1404 werd Engelbrecht I van Nassau-Siegen gehuldigd als heer van Breda.",
"imageUrl":"nassau_baroniemonument"
},
{
"name":"Station Breda Gravinnen van Nassauboulevard 43",
"coordinates":"51.59569850758307,4.780295549958155",
"description":"4815CA Breda",
"imageUrl":"NULL"
"description":"Station Breda is het centrale spoorwegstation van de Nederlandse stad Breda. Het bevindt zich ten noorden van het centrum van de stad. Omliggende wijken zijn Stationskwartier en Drie Hoefijzers aan de zuidkant, en aan de noordzijde Belcrum, Doornbos-Linie en Havenkwartier.\n\nHet eerste station in Breda werd geopend op 1 mei 1855, toen de Spoorlijn Roosendaal - Breda werd geopend. Dit station werd in 1863 door een nieuw gebouw vervangen, toen de lijn naar Tilburg werd geopend. Omdat Breda toen nog een vesting was en het station onder de beperkingen van de Vestingwet viel, was het zodanig uitgevoerd dat het in tijden van oorlog snel gesloopt zou kunnen worden.",
"imageUrl":"station_breda"
},
{
"name":"Belcrum Beach Veilingkade 12a",
"coordinates":"51.599434239284726,4.76632797992092",
"description":"4815HC Breda",
"imageUrl":"NULL"
"description":"Belcrum Beach is HET stadsstrand van Breda, gelegen op het Haveneiland in de wijk Belcrum. Wij zijn begonnen in 2013 op deze unieke lokatie in Breda. Een plek om te relaxen met een drankje en een hapje, genietend van de zon, gezellig kletsen met je vrienden, luisterend naar muziek van een band of DJ, soms in een festival setting. Kinderen die kunnen spelen in het zand of mee kunnen doen aan speciale kinderactiviteiten.",
"imageUrl":"belcrum_beach"
},
{
"name":"De Belcrum Watertoren (1935) Speelhuislaan 158",
"coordinates":"51.60135351009892,4.7705765989322755",
"description":"4815CJ Breda",
"imageUrl":"NULL"
"imageUrl":"belcrum_watertoren"
}
]

View File

@@ -3,38 +3,76 @@
"name": "rondje stad",
"locations": [
{
"name":"Prison Escape Kloosterlaan 168",
"coordinates":"51.59073795635181,4.784917104321059",
"description":"4811EE Breda",
"imageUrl":"NULL"
"name": "Prison Escape Kloosterlaan 168",
"coordinates": "51.59073795635181,4.784917104321059",
"description": "4811EE Breda",
"imageUrl": "NULL"
},
{
"name":"De Koepel - FutureDome Events Nassausingel 26",
"coordinates":"51.590431588532105,4.786756741648511",
"description":"4811HP Breda",
"imageUrl":"NULL"
},
{
"name":"Escaping Breda: Escape Room Games Boschstraat 114",
"coordinates":" 51.59110835530862,4.784147222780912",
"description":"4811GK Breda",
"imageUrl":"NULL"
"name": "De Koepel - FutureDome Events Nassausingel 26",
"coordinates": "51.590431588532105,4.786756741648511",
"description": "4811HP Breda",
"imageUrl": "NULL"
},
{
"name":"MEZZ Breda Keizerstraat 101",
"coordinates":"51.58394697737321,4.779757901349616",
"description":"4811HL Breda",
"imageUrl":"NULL"
"name": "Escaping Breda: Escape Room Games Boschstraat 114",
"coordinates": " 51.59110835530862,4.784147222780912",
"description": "4811GK Breda",
"imageUrl": "NULL"
},
{
"name":"Het Klooster Breda Schorsmolenstraat 13",
"coordinates":"51.58775443759389,4.765568874365066",
"description":"4811VN Breda",
"imageUrl":"NULL"
"name": "MEZZ Breda Keizerstraat 101",
"coordinates": "51.58394697737321,4.779757901349616",
"description": "4811HL Breda",
"imageUrl": "NULL"
},
{
"name": "Het Klooster Breda Schorsmolenstraat 13",
"coordinates": "51.58775443759389,4.765568874365066",
"description": "4811VN Breda",
"imageUrl": "NULL"
}
],
"totalDistance": 2.3434,
"totalTime": 342342
},
{
"name": "Obesi Route",
"locations": [
{
"name": "KesCrOkÊt breeda",
"coordinates": "2.4654645,6.2342323",
"description": "lekkere patatjes"
},
{
"name": "McDonald's Breda Karnemelkstraat",
"coordinates": "51.58596318905295,4.77586651481887",
"description": "Wist je dat McDonalds de grootste restaurantketen ter wereld is? Hierdoor hebben we een indrukwekkende geschiedenis. Maar wij kijken liever naar onze toekomst. Nieuwe restaurants, betere producten en duurzaam ondernemen. Wil je meer weten over McDonalds? Lees verder op: https://www.mcdonalds.com/nl/nl-nl/over-ons.html!"
},
{
"name": "Wok To Go Halstraat 40",
"coordinates": "51.58650312572897,4.777467069592386",
"description": "Bij Wok To Go houden we van snelle, gezonde en smaakvolle maaltijden. Sinds 2003 ontwikkelen onze chef-koks de lekkerste wokgerechten met verse ingrediënten. We doen dit vól overgave onder het motto “Making people happy through food”. Door het roerbakken met een kleine hoeveelheid olie op grote hitte, blijven de smaak en gezonde voedingsstoffen bewaard. We kiezen voor gezonde en unieke ingrediënten en bereiden uitgebalanceerde gerechten in een Wokki box voor een gezonde levensstijl."
},
{
"name": "De Boterhal Grote Markt 19",
"coordinates": "51.588069667604756,4.7762685632180695",
"description": "De Boterhal in Breda is een internationaal tapasrestaurant, speciaalbiercafé en wijnbar. Men kan gezellig bij ons lunchen, borrelen en dineren. Wij hebben een uitgebreide menukaart met een hele hoop bieren, wijnen, zowel per glas als per fles te verkrijgen, lunch en tapasgerechtjes. Naast het eten wat wij serveren hebben we ook een hoop bieren en wijnen. Naast de bieren op de kaart hebben wij wisselende bieren; vijf ketelbieren en vijf seizoensbieren."
},
{
"name": "Gauchos Grote Markt 33",
"coordinates": "51.58859328857082,4.77601349563689",
"description": "De middeleeuwse Grote Markt is een historische plek in het Bourgondische hart van Breda, ooit in handen van de Spaanse bezetter. Gauchos Grill-Restaurant combineert daar Brabantse gemoedelijkheid met professionele gastvrijheid. In onze Latijnse keuken bereiden wij op uw aanwijzing een malse Argentijnse steak of een smakelijk visgerecht van de grill."
},
{
"name": "The Tosti Club Breda A4, Vlaszak 2",
"coordinates": "51.58905632735254,4.780729463841719",
"description": "Je kunt bij al onze vestigingen de hele dag terecht, want bij The Tosti Club eet je het klokje rond. Dus kom gezellig ontbijten, lunchen of voor een snelle hap aan het einde van de dag (wat dacht je van onze The Tosti Slice, onze variant op pizza!). Even geen zin in brood? Dan kunnen we je ook verblijden met onder andere acaï smoothiebowls, pancakes, granolas / yoghurt of gewoon een lekkere warme drank met gebak. Mogen we je de Red Velvet fudge cake aanraden?"
}
],
"totalDistance": 2.3434,
"totalTime": 342342
}
]
]

View File

@@ -3,6 +3,9 @@ package com.a1.nextlocation;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
@@ -23,6 +26,7 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import java.io.File;
import java.util.Arrays;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getName();
@@ -52,9 +56,33 @@ public class MainActivity extends AppCompatActivity {
RouteListManager.INSTANCE.setContext(this);
RouteListManager.INSTANCE.load();
// initialize saved language from sharedPreferences
setLocale(loadLocale());
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new HomeFragment()).commit();
}
/**
* loads the saved language from SharedPreferences
* @return the language as string
*/
private String loadLocale(){
SharedPreferences sharedPreferences = getSharedPreferences("Settings", Activity.MODE_PRIVATE);
return sharedPreferences.getString("Language", "nl");
}
/**
* sets the language of the application to the desired one
* @param language the desired language
*/
private void setLocale(String language){
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration configuration = new Configuration();
configuration.setLocale(locale);
getBaseContext().getResources().updateConfiguration(configuration, getBaseContext().getResources().getDisplayMetrics());
}
private BottomNavigationView.OnNavigationItemSelectedListener navListener = item -> {
Fragment selectedFragment = null;

View File

@@ -61,22 +61,18 @@ public class CouponFragment extends Fragment {
private void showPopup(Coupon coupon) {
AlertDialog.Builder activateBuilder = new AlertDialog.Builder(getContext());
AlertDialog.Builder couponCodeBuilder = new AlertDialog.Builder(getContext());
// TODO: use string resources instead of hardcoded strings
activateBuilder.setMessage("Weet je zeker dat je deze coupon wilt activeren?");
activateBuilder.setMessage(getResources().getString(R.string.activate_question));
activateBuilder.setCancelable(true);
// TODO: use string resources instead of hardcoded strings
activateBuilder.setPositiveButton("activeren", (dialog, which) -> {
// TODO: use string resources instead of hardcoded strings
activateBuilder.setPositiveButton(R.string.activate, (dialog, which) -> {
dialog.cancel();
couponCodeBuilder.setMessage("Code: " + coupon.getCode());
couponCodeBuilder.setPositiveButton("Klaar", (dialog1, which1) -> {
couponCodeBuilder.setPositiveButton(R.string.done, (dialog1, which1) -> {
dialog.cancel();
});
AlertDialog couponCodePopup = couponCodeBuilder.create();
couponCodePopup.show();
});
// TODO: use string resources instead of hardcoded strings
activateBuilder.setNegativeButton("annuleren", (dialog, which) -> dialog.cancel());
activateBuilder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.cancel());
AlertDialog couponPopup = activateBuilder.create();
couponPopup.show();

View File

@@ -28,6 +28,7 @@ import com.a1.nextlocation.data.RouteHandler;
import com.a1.nextlocation.data.StaticData;
import com.a1.nextlocation.json.DirectionsResult;
import com.a1.nextlocation.network.ApiHandler;
import com.a1.nextlocation.network.DirectionsListener;
import com.a1.nextlocation.recyclerview.LocationListManager;
import org.osmdroid.api.IMapController;

View File

@@ -49,4 +49,8 @@ public class LocationDetailFragment extends Fragment {
}
return view;
}
public void setLocation(Location location) {
this.location = location;
}
}

View File

@@ -9,10 +9,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.data.RouteHandler;
import com.a1.nextlocation.network.ApiHandler;
public class RouteDetailFragment extends Fragment {
@@ -46,7 +50,18 @@ public class RouteDetailFragment extends Fragment {
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeFragment).addToBackStack(null).commit();
});
Button startButton = view.findViewById(R.id.start_route_button);
startButton.setOnClickListener(this::startRoute);
return view;
}
public void startRoute(View view) {
ApiHandler.INSTANCE.getDirections(route);
RouteHandler.INSTANCE.followRoute(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();
}
}

View File

@@ -1,6 +1,8 @@
package com.a1.nextlocation.fragments;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.annotation.NonNull;
@@ -8,10 +10,12 @@ import androidx.annotation.Nullable;
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.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
@@ -19,8 +23,12 @@ import android.widget.Spinner;
import com.a1.nextlocation.MainActivity;
import com.a1.nextlocation.R;
import java.util.Locale;
public class SettingsFragment extends Fragment {
private SharedPreferences.Editor editor;
private ImageView imageButton;
SwitchCompat fontChanger;
@@ -28,21 +36,16 @@ public class SettingsFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
editor = getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).edit();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_settings, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_settings, container, false);
// Inflate the layout for this fragment
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
initializeLanguageDropdown(view);
this.imageButton = view.findViewById(R.id.settings_back_button);
this.imageButton.setOnClickListener(v -> {
@@ -79,9 +82,95 @@ public class SettingsFragment extends Fragment {
editor.commit();
});
return view;
}
private void initializeLanguageDropdown(View view) {
Spinner languageDropdown = view.findViewById(R.id.dropdown_menu_Settings);
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
languageDropdown.setAdapter(arrayAdapter);
dropdown.setAdapter(arrayAdapter);
// set the language dropdown on the currently selected language stored in the sharedPreferences
languageDropdown.setSelection(languageToDropdownPosition(getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).getString("Language", "")));
long previousID = languageDropdown.getSelectedItemId();
languageDropdown.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
setLocale(dropdownPositionToLanguage(id));
if (id != previousID) {
Fragment currentFragment = getActivity().getSupportFragmentManager().findFragmentById(R.id.fragment_layout);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.detach(currentFragment);
fragmentTransaction.attach(currentFragment);
fragmentTransaction.commit();
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
/**
* converts the languageDropdown position to the belonging language
*
* @param id desired position to convert
* @return the language belonging to the position of the languageDropdown
*/
private String dropdownPositionToLanguage(long id) {
switch ((int) id) {
case 0:
return "nl";
case 1:
return "en";
default:
return "";
}
}
/**
* converts language to the languageDropdown position
*
* @param language desired language to convert
* @return the position of the language in the languageDropdown
*/
private int languageToDropdownPosition(String language) {
switch (language) {
case "nl":
return 0;
case "en":
return 1;
default:
return 1;
}
}
/**
* reloads the fragment
*/
private void refresh() {
Fragment currentFragment = getActivity().getSupportFragmentManager().findFragmentById(R.id.fragment_layout);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.detach(currentFragment);
fragmentTransaction.attach(currentFragment);
fragmentTransaction.commit();
}
/**
* changes the current language to the desired language and saves this setting in SharedPreferences
*
* @param language the desired language to translate to
*/
private void setLocale(String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.setLocale(locale);
getContext().getResources().updateConfiguration(config, getContext().getResources().getDisplayMetrics());
editor.putString("Language", language);
editor.apply();
}
}

View File

@@ -52,7 +52,7 @@ public enum ApiHandler {
if (response.body() != null) {
String responseString = Objects.requireNonNull(response.body()).string();
Log.d(TAG, "getDirections: got response: " + responseString);
System.out.println(responseString);
DirectionsResult result = new DirectionsResult();
result.parse(responseString);
Log.d(TAG, "getDirections: " + result.getSteps().size());

View File

@@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/locatie_detail"
android:text=""
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="@string/locatie_detail_tekst"
android:text=""
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detail_location_name" />

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainActivity"
tools:context=".MainActivity">
<FrameLayout

View File

@@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/couponItem"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -24,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="@string/naam"
android:text=""
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primaryColour"
android:id="@+id/couponFragment"
tools:context=".fragments.LocationFragment">
<TextView
@@ -13,7 +14,7 @@
android:layout_height="wrap_content"
android:layout_margin="9dp"
android:layout_marginTop="20dp"
android:text="@string/statistieken"
android:text="@string/statistics"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@id/coupon_back_button"
app:layout_constraintTop_toTopOf="parent" />
@@ -26,7 +27,6 @@
android:layout_marginTop="12dp"
android:background="@drawable/ic_back_button_24"
android:backgroundTint="@color/buttonColour"
android:text="@string/terug"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/homeFragment"
tools:context=".fragments.HomeFragment">
<org.osmdroid.views.MapView

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primaryColour"
android:id="@+id/locationFragment"
tools:context=".fragments.LocationFragment">
<TextView
@@ -13,7 +14,7 @@
android:layout_height="wrap_content"
android:layout_margin="9dp"
android:layout_marginTop="20dp"
android:text="@string/locaties"
android:text="@string/locations"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@id/location_back_button"
app:layout_constraintTop_toTopOf="parent" />
@@ -26,7 +27,6 @@
android:layout_marginTop="12dp"
android:background="@drawable/ic_back_button_24"
android:backgroundTint="@color/buttonColour"
android:text="@string/terug"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primaryColour"
android:id="@+id/locationDetailFragment"
tools:context=".fragments.LocationDetailFragment">
<TextView
@@ -12,7 +13,7 @@
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/locatie_detail"
android:text=""
android:textColor="@color/white"
android:textSize="30sp"
android:gravity="center"
@@ -34,6 +35,8 @@
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="20dp"
android:background="@color/secondaryColour"
android:text=""
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detail_location_image">
@@ -43,7 +46,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/secondaryColour"
android:text="@string/locatie_detail_tekst"
android:text=""
/>
</ScrollView>

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primaryColour"
android:id="@+id/routeFragment"
tools:context=".fragments.RouteFragment">
<ImageButton
@@ -13,7 +14,6 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/ic_back_button_24"
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="@string/titel"
android:text="@string/routes"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@id/route_back_button"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -5,6 +5,7 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/primaryColour"
android:id="@+id/routeDetailFragment"
tools:context=".fragments.RouteDetailFragment">
<ImageButton
@@ -21,10 +22,10 @@
android:id="@+id/route_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/titel"
android:textColor="@color/white"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="@+id/route_detail_image"
android:text=""
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -5,6 +5,7 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/primaryColour"
android:id="@+id/settingFragment"
tools:context=".fragments.SettingsFragment">
<androidx.appcompat.widget.AppCompatImageButton
@@ -23,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/instellingen"
android:text="@string/settings"
android:textColor="@color/white"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
@@ -46,7 +47,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/taal"
android:text="@string/language"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -94,7 +95,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/imperiaal_systeem"
android:text="@string/imperial_system"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -114,6 +115,7 @@
app:layout_constraintVertical_bias="0.0" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/settingsImperialButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
@@ -139,7 +141,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_65_stand"
android:text="@string/_65_mode"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -185,7 +187,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/kleurenblind"
android:text="@string/colorblind"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -205,6 +207,7 @@
/>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/settingsEyesButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primaryColour"
android:id="@+id/statisticsFragment"
tools:context=".fragments.StatisticFragment">
<TextView
@@ -12,7 +13,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/statistieken"
android:text="@string/statistics"
android:textColor="@color/white"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
@@ -35,7 +36,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/totale_afstand"
android:text="@string/total_distance"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -57,7 +58,7 @@
android:id="@+id/statistics_km"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/km"
android:text=""
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -84,7 +85,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bezochte_locaties"
android:text="@string/visited_locations"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -106,7 +107,7 @@
android:id="@+id/statistics_locations_visited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/getal"
android:text=""
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -131,7 +132,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/totale_tijd"
android:text="@string/total_time"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -152,7 +153,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/minuten"
android:text=""
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -179,7 +180,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/coupons_gespaard"
android:text="@string/coupons_collected"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -201,7 +202,7 @@
android:id="@+id/couponAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/getal"
android:text=""
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -216,7 +217,6 @@
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" />
@@ -232,7 +232,6 @@
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" />

View File

@@ -5,6 +5,7 @@
android:layout_height="50dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/secondaryColour"
android:id="@+id/locationItem"
android:layout_margin="20dp">
<ImageView
@@ -21,7 +22,7 @@
android:layout_width="321dp"
android:layout_height="47dp"
android:gravity="left"
android:text="@string/locaties"
android:text=""
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -5,6 +5,7 @@
android:layout_height="50dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/secondaryColour"
android:id="@+id/routeItem"
android:layout_margin="20dp">
<ImageView
@@ -20,7 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/titel"
android:text=""
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_Image"

View File

@@ -3,7 +3,7 @@
<item
android:id="@+id/locations"
android:title="@string/locaties"
android:title="@string/locations"
android:icon="@drawable/ic_baseline_outlined_flag_24"
/>
@@ -15,13 +15,13 @@
<item
android:id="@+id/statistics"
android:title="@string/statistieken"
android:title="@string/statistics"
android:icon="@drawable/ic_baseline_graphic_eq_24"
/>
<item
android:id="@+id/settings"
android:title="@string/instellingen"
android:title="@string/settings"
android:icon="@drawable/ic_baseline_settings_24"
/>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Next Location</string>
<string name="locations">Locaties</string>
<string name="routes">Routes</string>
<string name="statistics">Statistieken</string>
<string name="settings">Instellingen</string>
<string name="language">Taal</string>
<string name="imperial_system">Imperiaal systeem</string>
<string name="_65_mode">65+ stand</string>
<string name="colorblind">Kleurenblind</string>
<string name="total_distance">Totale afstand:</string>
<string name="visited_locations">Bezochte locaties:</string>
<string name="total_time">Totale tijd:</string>
<string name="coupons_collected">Coupons gespaard:</string>
<string name="coupons">Coupons</string>
<string name="start_route">Start Route</string>
<string name="activate_question">Weet je zeker dat je deze coupon wilt activeren?</string>
<string name="activate">activeren</string>
<string name="done">Klaar</string>
<string name="cancel">annuleren</string>
</resources>

View File

@@ -1,21 +1,22 @@
<resources>
<string name="app_name">Next Location</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="locations">Locaties</string>
<string name="app_name" translatable="false">Next Location</string>
<string name="locations">Location</string>
<string name="routes">Routes</string>
<string name="statistics">Statistieken</string>
<string name="settings">Instellingen</string>
<string name="taal">Taal</string>
<string name="imperiaal_systeem">Imperiaal systeem</string>
<string name="_65_stand">65+ stand</string>
<string name="kleurenblind">Kleurenblind</string>
<string name="statistieken">Statistieken</string>
<string name="totale_afstand">Totale afstand:</string>
<string name="bezochte_locaties">Bezochte locaties:</string>
<string name="totale_tijd">Totale tijd:</string>
<string name="coupons_gespaard">Coupons gespaard:</string>
<string name="statistics">Statistics</string>
<string name="settings">Settings</string>
<string name="language">Language</string>
<string name="imperial_system">Imperial system</string>
<string name="_65_mode">65+ mode</string>
<string name="colorblind">Colorblind</string>
<string name="total_distance">Total distance:</string>
<string name="visited_locations">Visited locations:</string>
<string name="total_time">Total time:</string>
<string name="coupons_collected">Coupons collected:</string>
<string name="coupons">Coupons</string>
<string name="start_route">Start Route</string>
<string name="activate_question">Are you sure you want to activate this coupon?</string>
<string name="activate">activate</string>
<string name="done">Done</string>
<string name="cancel">cancel</string>
<string name="route_stop_toast">Route stopped!</string>
</resources>

View File

@@ -0,0 +1,50 @@
package com.a1.nextlocation;
import com.a1.nextlocation.json.DirectionsResult;
import com.a1.nextlocation.json.DirectionsStep;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class DirectionsResultTest {
private DirectionsResult directionsResult;
@Before
public void init(){
directionsResult = new DirectionsResult();
}
@Test
public void testDistance(){
directionsResult.setDistance(45.32);
double expected = 45.32;
assertEquals(expected, directionsResult.getDistance(), 0.01);
}
@Test
public void testDuration(){
directionsResult.setDuration(95.123);
double expected = 95.123;
assertEquals(expected, directionsResult.getDuration(), 0.01);
}
@Test
public void testSteps(){
List<DirectionsStep> expected = new ArrayList<>();
directionsResult.addStep(new DirectionsStep());
directionsResult.addStep(new DirectionsStep());
directionsResult.addStep(new DirectionsStep());
directionsResult.setSteps(expected);
assertEquals(expected, directionsResult.getSteps());
}
}

View File

@@ -0,0 +1,69 @@
package com.a1.nextlocation;
import com.a1.nextlocation.json.DirectionsStep;
import org.junit.Before;
import org.junit.Test;
import org.osmdroid.util.GeoPoint;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class DirectionsStepTest {
private DirectionsStep directionsStep;
@Before
public void init(){
directionsStep = new DirectionsStep();
}
@Test
public void testDistance(){
directionsStep.setDistance(432.56);
double expected = 432.56;
assertEquals(expected, directionsStep.getDistance(), 0.01);
}
@Test
public void testDuration(){
directionsStep.setDuration(531.89);
double expected = 531.89;
assertEquals(expected, directionsStep.getDuration(), 0.01);
}
@Test
public void testInstuction(){
directionsStep.setInstruction("TESTINGINSTUCTION");
String expected = "TESTINGINSTUCTION";
assertEquals(expected, directionsStep.getInstruction());
}
@Test
public void testName(){
directionsStep.setName("TESTINGNAME");
String expected = "TESTINGNAME";
assertEquals(expected, directionsStep.getName());
}
@Test
public void testWay_Points(){
ArrayList<Integer> expected = new ArrayList<>();
expected.add(56);
expected.add(1123);
expected.add(23);
expected.add(73);
directionsStep.setWay_points(expected);
assertEquals(expected, directionsStep.getWay_points());
}
@Test
public void testWayPoints(){
GeoPoint[] expected = {new GeoPoint(5.1658, 4.163), new GeoPoint(2.0896, 7.158),
new GeoPoint(4.0168, 6.1450), new GeoPoint(7.1498, 9.1586), };
directionsStep.setWaypoints(expected);
assertEquals(expected, directionsStep.getWaypoints());
}
}

View File

@@ -0,0 +1,22 @@
package com.a1.nextlocation;
import com.a1.nextlocation.json.GeometryDecoder;
import com.google.gson.JsonArray;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class GeometryDecoderTest {
@Test
public void geometryDecoderTest(){
String encodedGeometryTest = "";
JsonArray expected = new JsonArray();
assertEquals(expected, GeometryDecoder.decodeGeometry(encodedGeometryTest, true));
}
}