20 Commits

Author SHA1 Message Date
Bart
8a453f298a Fixed file locating problem 2021-01-06 19:34:03 +01:00
Bart
7089524be6 Added support for different language routes and coupons 2021-01-06 17:41:57 +01:00
Bart
5844445555 Updated English location.json 2021-01-06 16:53:17 +01:00
Bart
0ea7ee6c31 locations.json is now English 2021-01-06 16:21:01 +01:00
Bart
98a1ad799c Location loader now loads the correct location.json according to the selected language 2021-01-06 16:03:59 +01:00
Bart
dabe3cfb99 moved Refreshable to package Fragment 2021-01-06 14:35:54 +01:00
Sem van der Hoeven
f806015963 Merge branch 'follow-route' of https://github.com/SemvdH/Next-Location into follow-route 2021-01-06 14:33:38 +01:00
Sem van der Hoeven
fcec6e1ecd stuffff 2021-01-06 14:33:25 +01:00
Bart
7284b66c13 Merge branch 'languages' into follow-route 2021-01-06 14:26:39 +01:00
Sem van der Hoeven
6266705c3e fix clusterfuck? 2021-01-06 14:18:37 +01:00
Sem van der Hoeven
e90582b539 stuff merge iewl 2021-01-06 14:12:59 +01:00
Sem van der Hoeven
68f2855a66 added locations back 2021-01-06 14:07:19 +01:00
Bart
d018b83490 added strings 2021-01-06 14:04:37 +01:00
Sem van der Hoeven
1aee93cd0c mergeeee 2021-01-06 13:59:59 +01:00
Sem van der Hoeven
216f48cc0f fixed distance 2021-01-06 13:57:00 +01:00
Sem van der Hoeven
bd623a3f1d stuff 2021-01-06 13:54:30 +01:00
Sem van der Hoeven
1760f510c6 comment location 2021-01-06 13:46:08 +01:00
Sem van der Hoeven
ba9569b5a8 Merge branch 'follow-route' of https://github.com/SemvdH/Next-Location into follow-route 2021-01-06 13:45:53 +01:00
Sem van der Hoeven
98eeba4de1 comments 2021-01-06 13:42:26 +01:00
Bart
1cf973da9b bottom navigation sets locale on startup and language change. Fixed a bug where the selected fragment changes when rotated. 2021-01-06 12:21:31 +01:00
24 changed files with 427 additions and 105 deletions

View File

@@ -15,7 +15,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.NextLocation">
android:theme="@style/Theme.NextLocation"
android:hardwareAccelerated="false">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -0,0 +1,10 @@
[
{
"code": "KROKET10",
"reward": "Gratis 2e kroket bij Kees Kroket™"
},
{
"code": "654",
"reward": ",juygly"
}
]

View File

@@ -0,0 +1,135 @@
[
{
"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.",
"imageUrl":"mc_donalds"
},
{
"name":"Subway Karnemelkstraat 10 A, 1",
"coordinates":"51.58632782568612,4.775219531501114",
"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":"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":"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":"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":"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":"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":"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":"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! 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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"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. Het strand werkt met drie beheerders en een groot aantal vrijwilligers voor bar, onderhoud, programmering, sponsoring en tuin. 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. Belcrum Beach is ook een unieke lokatie voor een feestje of om je verjaardag te vieren, trouwen op het strand of een trouwfeest behoren ook tot de mogelijkheden.",
"imageUrl":"belcrum_beach"
},
{
"name":"De Belcrum Watertoren (1935) Speelhuislaan 158",
"coordinates":"51.60135351009892,4.7705765989322755",
"description":"De watertoren in de Belcrum in Breda is een industrieel monument uit het interbellum. De toren is de thuisbasis voor SOAB adviseurs voor woning en leefomgeving en onderstreept de missie van ons bureau. De toren hoort bij de Belcrum. Als landmark en als onderdak voor activiteiten. Zo vierden de Belcrummers hun 400 jaar bestaan in de toren en worden lunches met rondleiding op hoog niveau georganiseerd. Kijken en proeven.",
"imageUrl":"belcrum_watertoren"
}
]

View File

@@ -2,134 +2,134 @@
{
"name":"McDonald's Breda Karnemelkstraat",
"coordinates":"51.58596318905295,4.77586651481887",
"description":"McDonald's restaurant",
"imageUrl":"NULL"
"description":"Did you know McDonald's is the largest restaurant chain in the world? This gives us an impressive history. But we prefer to look at our future. New restaurants, better products, and sustainable entrepreneurship.",
"imageUrl":"mc_donalds"
},
{
"name":"Subway Karnemelkstraat 10 A, 1",
"coordinates":"51.58632782568612,4.775219531501114",
"description":"4811 KJ Breda",
"imageUrl":"NULL"
"description":"Subway is an American multinational fast-food chain that mainly sells sandwiches. The company distinguishes itself from many other sandwich shops because the customer can have the sandwich put together themselves. Subway works with franchises. The company has nearly 45,000 offices on all continents.",
"imageUrl":"subway"
},
{
"name":"Wok To Go Halstraat 40",
"coordinates":"51.58650312572897,4.777467069592386",
"description":"4811HX Breda",
"imageUrl":"NULL"
"description":"At Wok To Go we love fast, healthy and tasty meals. Since 2003 our chefs have been developing the most delicious wok dishes with fresh ingredients. We do this with complete dedication under the motto “ Making people happy through food ”. By stir-frying - with a small amount of oil - on high heat, the taste and healthy nutrients are preserved. We choose healthy and different ingredients and prepare balanced courses in a 'Wokki box' for a healthy lifestyle. ",
"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 an international tapas restaurant, specialty beer café, and wine bar. You can enjoy lunch, drinks, and dinner with us. We have an extensive menu with a lot of beers, wines, both per glass and per bottle, lunch, and tapas dishes. In addition to the food we serve, we also have a lot of beers and wines. In addition to the beers on the menu, we have varying beers: five kettle beers and five seasonal beers. ",
"imageUrl":"de_boter_hal"
},
{
"name":"Gauchos Grote Markt 33",
"coordinates":"51.58859328857082,4.77601349563689",
"description":"4811XP Breda",
"imageUrl":"NULL"
"description":"The medieval Grote Markt is a historic place in the Burgundian heart of Breda, once in the hands of the Spanish occupier. Gauchos Grill-Restaurant combines Brabant conviviality with professional hospitality. In our Latin kitchen, we prepare a tender Argentinian steak or a tasty fish dish from the grill. ",
"imageUrl":"gauchos"
},
{
"name":"The Tosti Club Breda A4, Vlaszak 2",
"coordinates":"51.58905632735254,4.780729463841719",
"description":"4811GR Breda",
"imageUrl":"NULL"
"description":"You can go to all our branches all day because at The Tosti Club you eat around the clock. So come for breakfast, lunch, or a quick bite at the end of the day (how about our The Tosti Slice, our variant on pizza!). If you don't feel like bread, then we can also delight you with acai smoothie bowls, pancakes, granolas/yogurt, or just a nice hot drink with cake. Can we recommend the Red Velvet fudge cake?",
"imageUrl":"the_tosti_club"
},
{
"name":"Coffee & Lunch 4 you Oude Vest 31",
"coordinates":"51.58741730235298,4.779832967540571",
"description":"4811HS Breda",
"imageUrl":"NULL"
"description":"Welcome to Coffee & Lunch 4 you! Our atmospheric lunchroom is located in the center of Breda, near the parking garage and the bicycle shed.",
"imageUrl":"coffee_and_lunch"
},
{
"name":"t Zusje Breda Vismarktstraat 28",
"coordinates":"51.590133292554434,4.773911506170458",
"description":"4811WE Breda",
"imageUrl":"NULL"
"description":"That is an evening at 't Zusje. Cozy get-together in a homely atmosphere and enjoy our small dishes, which you can order all evening. At' t Zusje you are at home: you determine the content of the evening yourself. \nWe would like to hear what your wishes are, would like to surprise you with special dishes, and would like to go the extra mile. We offer you an evening out, as we would like to see in ourselves. Enjoy a full evening of Burgundian? In the beautiful building of our Zusje in Breda, you will experience a pleasant evening with full evening tapas food for 31.80. \nCall quickly and book!",
"imageUrl":"t_zusje_breda"
},
{
"name":"VR-World Nassaustraat 2",
"coordinates":"51.5913566342086,4.786256804321071",
"description":"4811DD Breda",
"imageUrl":"NULL"
"description":"Virtual Reality is the outing of the moment. Beating zombies, shooting fireballs, or fighting with laser swords, nothing is too crazy with Virtual Reality. At VR World we are looking every day for the newest experiences for you. \n\nWhat about for an example of an Escape Room, but in Virtual Reality? At VR World we offer the latest Escapes in Virtual Reality. Escape from a Pyramid or dismantle a rocket, for example. Do you dare to take on this challenge? \n\nVR World is located at a unique location, namely the dome prison of Breda. This prison was still in operation until 2016 and then companies moved in, including VR World.",
"imageUrl":"vr_world"
},
{
"name":"Kees Kroket Houtmarkt 9",
"coordinates":"51.58647180329833,4.77741809637617",
"description":"KEEEEES KROKET!",
"imageUrl":"NULL"
"description":"KEEEEES KROKET! For more than ten years, Kees Kroket has been located in the center of Breda, close to shoppers. First in the well-known Houtmarktpassage and since April 2019, we have been located at our new location at Houtmarkt 9. You can taste the quality of our fresh fries. These fries, cut from the Agria potato, are pre-fried in sunflower oil and finished in a mix of vegetable oils. This not only ensures the delicious taste, but also that our fries contain relatively little saturated fats and trans-fatty acids, so may use the logo 'Responsible Frying'.",
"imageUrl":"kees_kroket"
},
{
"name":"Prison Escape Kloosterlaan 168",
"coordinates":"51.59073795635181,4.784917104321059",
"description":"4811EE Breda",
"imageUrl":"NULL"
"description":"Prison Escape lasts a total of 3 hours and your goal is to escape the maximum-security prison. A cast of 25 actors brings the experience to life and it's up to you to find your way out. Hidden objects that might make it easier to realize the way out. \n\nBe careful, look around you, trust (almost) nobody, and approach people .. \nThe clock is ticking and you have 1 goal: to find the way to freedom.",
"imageUrl":"prison_escape_room"
},
{
"name":"De Koepel - FutureDome Events Nassausingel 26",
"coordinates":"51.590431588532105,4.786756741648511",
"description":"4811HP Breda",
"imageUrl":"NULL"
"description":"In groups, you will be guided by one of our guides across the most unique and beautiful monumental places in and around the Dome! \n\n The guide will explain the illustrious past at the various locations. tour of the prison grounds will take you past the dome, the authentic chapel, women's prison, various air places, and the old court building.",
"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 a new modern location and currently has 2 adventurous escape rooms. Besides, 2 extra escape rooms will be added next year. \n\nEscape from the exciting escape room Let's Rob The Bank, a room suitable for adults and children. If you prefer to escape from an escape room with a higher level of excitement and play, then choose Patient X. \n\nOt our location in Breda we also have a cozy board game café. Combine your escape with a drink, snack, and all free board games. \n\nEscaping Breda is the perfect place for an outing with your family, friends, or colleagues.",
"imageUrl":"escaping_room"
},
{
"name":"MEZZ Breda Keizerstraat 101",
"coordinates":"51.58394697737321,4.779757901349616",
"description":"4811HL Breda",
"description":"MEZZ is an open club, involved, curious and inquisitive. MEZZ has humor, is witty, sometimes provocative, and surprising. Experience and fun are central where we think bottom-up. We are there for you, your MEZZ. Do you have ideas or will you want to know more, contact us. We always respond.",
"imageUrl":"mezz_breda"
},
{
"name":"Het Klooster Breda Schorsmolenstraat 13",
"coordinates":"51.58775443759389,4.765568874365066",
"description":"4811VN Breda",
"imageUrl":"NULL"
"description":"In this old Capuchin monastery a living and working community will be established under the name\" Het Klooster Breda \". \nWith the income from activities, 12 people who are homeless are offered shelter, from which they can regain a place in society .",
"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 is known for its immensely popular location in Bergen op Zoom. Since 2020, this high segment lounge club has opened a second location in Breda called 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":"Queen Wilhelmina Pavilion is a building in Breda Center in Breda. It belongs to the Royal Military Academy (KMA) and has the status of a national monument. It is located at Kasteelplein 15, just in front of Breda Castle. the west side of the driveway of the castle, with the long right side wall on the castle moat and the long left side wall on the Cingelstraat. ",
"imageUrl":"koningin_wilhelimna_paviljoen"
},
{
"name":"Hercules en de Nemeïsche leeuw",
"coordinates":"51.59130522182325,4.778161739135078",
"description":"4811XJ Breda",
"imageUrl":"NULL"
"description":"The statue shows Hercules with the skin of the Nemean lion. Heracles or Hercules is a figure from Greek mythology. He was a Greek hero and became famous for the 12 difficult works he performed at the behest of King Eurystheus. The statue is part of the 17 other sandstone statues that Willem III bought between 1670 and 1686. The statues were spread over lawns in the Valkenberg park.\nHercules is the only original statue that remains.",
"imageUrl":"hercules_park_valkenburg"
},
{
"name":"Nassau-Baroniemonument - 1905 - Pierre Cuypers Delpratsingel 1",
"coordinates":"51.592530636759136,4.780278353833301",
"description":"4811AM Breda",
"imageUrl":"NULL"
"description":"The Baroniemonument or Nassau-Baroniemonument is a statue of the Dutch architect Pierre Cuypers. It is located in Park Valkenberg in Breda. The monument was placed in memorial of the 500-year bond (1904) between Breda and the Oranje-Nassau house. In 1404 Engelbrecht I of Nassau-Siegen was honored as lord of Breda. ",
"imageUrl":"nassau_baroniemonument"
},
{
"name":"Station Breda Gravinnen van Nassauboulevard 43",
"coordinates":"51.59569850758307,4.780295549958155",
"description":"4815CA Breda",
"imageUrl":"NULL"
"description":"Breda Station is the central railway station of the Dutch city of Breda. It is located north of the city center. Surrounding neighborhoods are Stationskwartier and Drie Hoefijzers on the south side, and Belcrum, Doornbos-Linie, and Havenkwartier on the north side. \n\nThe first station in Breda was opened on May 1, 1855, when the Roosendaal - Breda Railway was opened. This station was replaced by a new building in 1863, when the line to Tilburg was opened, because Breda was still a fortress at the time and it station fell under the restrictions of the Fortress Act, it was constructed in such a way that it could be quickly demolished in times of war. ",
"imageUrl":"station_breda"
},
{
"name":"Belcrum Beach Veilingkade 12a",
"coordinates":"51.599434239284726,4.76632797992092",
"description":"4815HC Breda",
"imageUrl":"NULL"
"description":"Belcrum Beach is THE city beach of Breda, located on the Haveneiland in the Belcrum district. We started in 2013 at this unique location in Breda. The beach works with three managers and a large number of volunteers for the bar, maintenance, programming, sponsoring, and garden. A place to relax with a drink and a snack, enjoying the sun, chatting with your friends, listening to music from a band or DJ, sometimes in a festival setting. Children who can play in the sand or join do special children's activities. Belcrum Beach is also a unique location for a party or to celebrate your birthday, getting married on the beach or a wedding are also possible. ",
"imageUrl":"belcrum_beach"
},
{
"name":"De Belcrum Watertoren (1935) Speelhuislaan 158",
"coordinates":"51.60135351009892,4.7705765989322755",
"description":"4815CJ Breda",
"imageUrl":"NULL"
"description":"The water tower in the Belcrum in Breda is an industrial monument from the interwar period. The tower is the home base for SOAB advisers for housing and living environments and underlines the mission of our office. The tower is part of the Belcrum. As a landmark and as a shelter for activities. For example, the Belcrummers celebrated their 400th anniversary in the tower, and lunches with a guided tour are organized at a high level. Watch and taste. ",
"imageUrl":"belcrum_watertoren"
}
]
]

View File

@@ -0,0 +1,40 @@
[
{
"name": "rondje stad",
"locations": [
{
"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":"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
}
]

View File

@@ -7,29 +7,22 @@ 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;
import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Coupon;
import com.a1.nextlocation.data.FileIO;
import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.fragments.HomeFragment;
import com.a1.nextlocation.fragments.Refreshable;
import com.a1.nextlocation.fragments.RouteFragment;
import com.a1.nextlocation.fragments.SettingsFragment;
import com.a1.nextlocation.fragments.StatisticFragment;
import com.a1.nextlocation.network.ApiHandler;
import com.a1.nextlocation.recyclerview.CouponListManager;
import com.a1.nextlocation.recyclerview.LocationListManager;
import com.a1.nextlocation.recyclerview.RouteListManager;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import java.io.File;
import java.util.Arrays;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity implements Refreshable {
private static final String TAG = MainActivity.class.getName();
private BottomNavigationView bottomNav;
/**
* onCreate method that creates the main activity
@@ -38,12 +31,14 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// initialize saved language from sharedPreferences
setLocale(loadLocale());
setContentView(R.layout.activity_main);
BottomNavigationView bottomNav = findViewById(R.id.navigation_bar);
bottomNav = findViewById(R.id.navigation_bar);
bottomNav.setOnNavigationItemSelectedListener(navListener);
/*System.out.println(Arrays.toString(getFilesDir().listFiles()));
FileIO<Route> fileIO = new FileIO<>();
fileIO.writeFileData(new Route("TERSTSET"), getApplicationContext());
@@ -56,10 +51,9 @@ 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();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new HomeFragment()).commit();
}
}
/**
@@ -105,4 +99,14 @@ public class MainActivity extends AppCompatActivity {
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, selectedFragment).commit();
return true;
};
/**
* refreshes bottom navigation
*/
@Override
public void refresh() {
bottomNav.getMenu().clear();
bottomNav.inflateMenu(R.menu.navmenu);
bottomNav.setSelectedItemId(R.id.settings);
}
}

View File

@@ -24,6 +24,7 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
public class FileIO<T> {
private final String TAG = FileIO.class.getCanonicalName();
@@ -34,8 +35,14 @@ public class FileIO<T> {
AssetManager am = context.getAssets();
T res = null;
StringBuilder sb = new StringBuilder();
InputStream is = null;
try {
InputStream is = am.open(fileName);
if (Arrays.asList(context.getResources().getAssets().list("")).contains(fileName)) {
is = am.open(fileName);
Log.d(TAG, "Opening file: " + fileName);
} else {
is = am.open(fileName.substring(0, fileName.length() - 8) + ".json");
}
InputStreamReader inputStreamReader = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(inputStreamReader);
String line;

View File

@@ -112,25 +112,23 @@ public class Location implements Parcelable {
return long1 + "," + lat1;
}
/**
* calculates the distance to the other location.
* @param other the other location
* @return the distance between the locations in meters
*/
public double getDistance(Location other) {
double dlon = other.getLong() - getLong();
double dlat = other.getLat() - getLong();
double a = Math.pow(Math.sin(dlat / 2), 2)
+ Math.cos(getLat()) * Math.cos(other.getLong())
* Math.pow(Math.sin(dlon / 2),2);
double c = 2 * Math.asin(Math.sqrt(a));
// Radius of earth in kilometers. Use 3956
// for miles
double r = 6371;
// calculate the result
double distance = c * r;
return Math.floor(distance);
return getDistance(this.getLat(),this.getLong(),other.getLat(),other.getLong());
}
/**
* calculates the distance between two coordinates
* @param lat1 the first latitude
* @param lon1 the first longitude
* @param lat2 the second latitude
* @param lon2 the second longitude
* @return the distance between the coordinates in meters
*/
public static double getDistance(double lat1, double lon1, double lat2, double lon2) {
double dlon = lon2 - lon1;
double dlat = lat2 - lat1;

View File

@@ -12,6 +12,7 @@ public enum RouteHandler {
private Route currentRoute;
private int stepCount = 0;
private RouteFinishedListener routeFinishedListener;
private long startedTime;
private Polyline currentRouteLine;
@@ -40,11 +41,14 @@ public enum RouteHandler {
isFollowingRoute = false;
currentRoute = null;
currentRouteLine = null;
StaticData.INSTANCE.addTimeWalked(System.currentTimeMillis()-startedTime);
startedTime = 0;
}
public void followRoute(Route route) {
this.currentRoute = route;
setFollowingRoute(true);
startedTime = System.currentTimeMillis();
}
public boolean isFollowingRoute(Route route) {

View File

@@ -11,6 +11,7 @@ public enum StaticData {
INSTANCE;
private double distanceTraveled = 0;
private int locationsVisited = 0;
private long timeWalkedRoute = 0;
private ArrayList<String> visitedNames = new ArrayList<>();
@@ -18,6 +19,14 @@ public enum StaticData {
distanceTraveled += d;
}
public long getTimeWalkedRoute() {
return timeWalkedRoute;
}
public void addTimeWalked(long time) {
timeWalkedRoute += time;
}
public double getDistanceTraveled() {
return distanceTraveled;

View File

@@ -91,7 +91,7 @@ public class HomeFragment extends Fragment implements LocationListener {
stopButton.setOnClickListener(v -> {
RouteHandler.INSTANCE.finishRoute();
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();
mapView.getOverlays().remove(roadOverlay);
mapView.getOverlays().remove(allLocationsOverlay);
addLocations();
@@ -110,6 +110,7 @@ public class HomeFragment extends Fragment implements LocationListener {
/**
* callback method that gets called when there are new directions available in the form of a {@link DirectionsResult} object.
*
* @param directionsResult the directions received from the api
*/
private void onDirectionsAvailable(DirectionsResult directionsResult) {
@@ -208,6 +209,7 @@ public class HomeFragment extends Fragment implements LocationListener {
private void displayRoute() {
if (RouteHandler.INSTANCE.isFollowingRoute()) {
Log.d(TAG, "displayRoute: WE ARE FOLLOWING A ROUTE");
if (roadOverlay == null) {
if (RouteHandler.INSTANCE.getCurrentRouteLine() != null) {
roadOverlay = RouteHandler.INSTANCE.getCurrentRouteLine();
@@ -286,9 +288,9 @@ public class HomeFragment extends Fragment implements LocationListener {
}
/**
* @param permissions tbe permissions we want to ask
* @author Ricky
* request the permissions needed for location and network, made by Ricky
* @param permissions tbe permissions we want to ask
*/
private void requestPermissionsIfNecessary(String... permissions) {
ArrayList<String> permissionsToRequest = new ArrayList<>();
@@ -310,15 +312,22 @@ public class HomeFragment extends Fragment implements LocationListener {
/**
* location callback that gets called each time the location is updated. It is used for updating the distance walked and checking if there are locations you have visited
*
* @param location the new location
*/
@Override
public void onLocationChanged(@NonNull Location location) {
// calculate the distance walked
double distance = currentLocation.distanceTo(location); // in meters
StaticData.INSTANCE.addDistance(distance);
if (currentLocation != null) {
double distance = currentLocation.distanceTo(location); // in meters
// can't walk 100 meters in a few seconds
if (distance < 100)
StaticData.INSTANCE.addDistance(distance);
}
currentLocation = location;
//new thread because we don't want the main thread to hang, this method gets called a lot
Thread t = new Thread(() -> {
for (com.a1.nextlocation.data.Location l : LocationListManager.INSTANCE.getLocationList()) {

View File

@@ -1,5 +1,6 @@
package com.a1.nextlocation.fragments;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -11,6 +12,8 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Location;
@@ -20,6 +23,9 @@ public class LocationDetailFragment extends Fragment {
private ImageButton imageButton;
private Location location;
private TextView titelText;
private TextView detailText;
private ImageView locationImage;
public LocationDetailFragment() {
@@ -38,6 +44,13 @@ public class LocationDetailFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_location_detail, container, false);
this.titelText = view.findViewById(R.id.detail_location_name);
this.titelText.setText(location.getName());
this.detailText = view.findViewById(R.id.detail_location_text);
this.detailText.setText(location.getDescription());
this.imageButton = view.findViewById(R.id.detail_location_back_button);
this.imageButton.setOnClickListener(v -> {
LocationFragment locationFragment = new LocationFragment();
@@ -47,6 +60,12 @@ public class LocationDetailFragment extends Fragment {
if (location != null) {
Log.d(TAG, "onCreateView: the location has a name of: " + location.getName());
}
this.locationImage = view.findViewById(R.id.detail_location_image);
Context context = this.locationImage.getContext();
int id = context.getResources().getIdentifier(this.location.getImageUrl(), "drawable", context.getPackageName());
this.locationImage.setImageResource(id);
return view;
}

View File

@@ -0,0 +1,5 @@
package com.a1.nextlocation.fragments;
public interface Refreshable {
void refresh();
}

View File

@@ -57,6 +57,10 @@ public class RouteDetailFragment extends Fragment {
return view;
}
/**
* Button onclick method that starts the route that is being viewed.
* @param view the button
*/
public void startRoute(View view) {
ApiHandler.INSTANCE.getDirections(route);
RouteHandler.INSTANCE.followRoute(route);

View File

@@ -5,8 +5,6 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
@@ -20,18 +18,24 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import com.a1.nextlocation.MainActivity;
import com.a1.nextlocation.R;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
public class SettingsFragment extends Fragment {
private SharedPreferences.Editor editor;
private ImageView imageButton;
SwitchCompat fontChanger;
private Refreshable refreshable;
@Override
public void onAttach(@NotNull Context context) {
super.onAttach(context);
refreshable = (Refreshable) context;
}
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -87,7 +91,7 @@ public class SettingsFragment extends Fragment {
private void initializeLanguageDropdown(View view) {
Spinner languageDropdown = view.findViewById(R.id.dropdown_menu_Settings);
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
String[] items = new String[]{getResources().getString(R.string.Dutch), getResources().getString(R.string.English), getResources().getString(R.string.Chinese)};
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
languageDropdown.setAdapter(arrayAdapter);
@@ -99,15 +103,11 @@ public class SettingsFragment extends Fragment {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
setLocale(dropdownPositionToLanguage(id));
// refresh fragment on language change
if (id != previousID) {
Fragment currentFragment = getActivity().getSupportFragmentManager().findFragmentById(R.id.fragment_layout);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.detach(currentFragment);
fragmentTransaction.attach(currentFragment);
fragmentTransaction.commit();
refresh();
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@@ -157,6 +157,8 @@ public class SettingsFragment extends Fragment {
fragmentTransaction.detach(currentFragment);
fragmentTransaction.attach(currentFragment);
fragmentTransaction.commit();
refreshable.refresh();
}
/**

View File

@@ -40,9 +40,11 @@ public class StatisticFragment extends Fragment {
TextView distance = view.findViewById(R.id.statistics_km);
TextView locs = view.findViewById(R.id.statistics_locations_visited);
TextView timeText = view.findViewById(R.id.statistics_time_value);
double dist = StaticData.INSTANCE.getDistanceTraveled()/1000;
distance.setText("" + String.format("%.1f",dist) + " km");
locs.setText("" + StaticData.INSTANCE.getLocationsVisited());
timeText.setText("" + StaticData.INSTANCE.getTimeWalkedRoute());
this.couponList = CouponListManager.INSTANCE.getCouponList();

View File

@@ -132,6 +132,10 @@ public class DirectionsResult {
}
/**
* parses the given json string into this object. This method is used for when you want to
* @param json
*/
public void parseRoute(String json) {
Gson gson = new GsonBuilder().setPrettyPrinting().create();

View File

@@ -20,43 +20,72 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
/**
* Singleton that handles all API calls
*/
public enum ApiHandler {
INSTANCE;
private static String TAG = ApiHandler.class.getCanonicalName();
public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
private final String BASE_URL = "https://api.openrouteservice.org/v2/directions/";
private final String API_KEY = "5b3ce3597851110001cf6248d4eee2099f724255918adc71cc502b2a";
private final String DIRECTIONS_MODE = "foot-walking";
private List<DirectionsListener> listeners = new ArrayList<>();
private OkHttpClient client = new OkHttpClient();
/**
* gets directions from the start location to the end location
* @param startLocation the start location
* @param endLocation the end location
*/
public void getDirections(Location startLocation, Location endLocation) {
getDirections(startLocation.getCoordinates(),endLocation.getCoordinates());
}
/**
* gets directions from the start location latitude and longitude and the end location latitude and longitude
* @param startLat the start latitude
* @param startLong the start longitude
* @param endLat the end latitude
* @param endLong the end longitude
*/
public void getDirections(double startLat, double startLong, double endLat, double endLong) {
getDirections(startLong + "," + startLat, endLong + "," + endLat);
}
/**
* 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 endLocation the end location represented as <i>endlat,endlong</i>
*/
public void getDirections(String startLocation, String endLocation) {
// build the url
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
Thread t = new Thread(() -> {
// build a request from the url
Request request = new Request.Builder().url(requestUrl).build();
// try to get the response
try (Response response = client.newCall(request).execute()) {
if (response.body() != null) {
String responseString = Objects.requireNonNull(response.body()).string();
Log.d(TAG, "getDirections: got response: " + responseString);
System.out.println(responseString);
// convert the response into a result object
DirectionsResult result = new DirectionsResult();
result.parse(responseString);
Log.d(TAG, "getDirections: " + result.getSteps().size());
// notify the listeners
for (DirectionsListener listener : listeners) {
listener.onDirectionsAvailable(result);
}
@@ -77,29 +106,35 @@ public enum ApiHandler {
}
/**
* adds a listener for when a result of an api call is available
* @param listener the new listener
*/
public void addListener(DirectionsListener listener) {
this.listeners.add(listener);
}
/**
* gets directions for the given {@link Route}
* @param route the route to get directions for
*/
public void getDirections(Route route) {
// for (int i = 0; i < route.getLocations().size()-1; i+= 2) {
// Location start = route.getLocations().get(i);
// Location end = route.getLocations().get(i+1);
// getDirections(start,end);
// }
// add the coordinates to the list
ArrayList<double[]> allCoords = new ArrayList<>();
for (Location location : route.getLocations()) {
allCoords.add(location.getCoordinatesAsDoubles());
}
// convert it to a json string
String body = "{\"coordinates\":" + new Gson().toJson(allCoords) + "}";
String requestUrl = BASE_URL + DIRECTIONS_MODE + "?api_key=" + API_KEY;
// new thread, because we don't want to be networking on our main thread
Thread t = new Thread(() -> {
// add the body to the request
RequestBody requestBody = RequestBody.create(body,JSON);
Request request = new Request.Builder()
.url(requestUrl)
@@ -110,15 +145,19 @@ public enum ApiHandler {
if (response.body() != null) {
String responseString = Objects.requireNonNull(response.body()).string();
Log.d(TAG, "getDirections: got response: " + responseString);
// kinda lazy, but we had time pressure
if (responseString.startsWith("{\"error")) {
Log.e(TAG, "getDirections: ERROR IN REQUEST!");
return;
}
// convert the result into a DirectionsResult
DirectionsResult result = new DirectionsResult();
result.parseRoute(responseString);
Log.d(TAG, "getDirections: " + result.getSteps().size());
//notify the listeners
for (DirectionsListener listener : listeners) {
listener.onDirectionsAvailable(result);
}
@@ -132,6 +171,7 @@ public enum ApiHandler {
t.start();
// wait for when we have a result from the api until we can continue, otherwise the route will be drawn before we get the result
try {
t.join();
} catch (InterruptedException e) {

View File

@@ -21,7 +21,14 @@ public class CouponLoader implements Loader<List<Coupon>> {
@Override
public ArrayList<Coupon> load() {
FileIO<ArrayList<Coupon>> fileIO = new FileIO<>();
ArrayList<Coupon> res = fileIO.readFileData(context, "coupons.json",new TypeToken<ArrayList<Coupon>>(){}.getType());
String selectedLanguage = context.getSharedPreferences("Settings", Context.MODE_PRIVATE).getString("Language", "nl");
String fileName = "locations";
// choose the coupon.json based of the selected language
if (!selectedLanguage.equals("en")) {
fileName += "-" + selectedLanguage;
}
ArrayList<Coupon> res = fileIO.readFileData(context, fileName + ".json", new TypeToken<ArrayList<Coupon>>(){}.getType());
Log.d(TAG, "load: " + res);
return res == null ? new ArrayList<>() : res;

View File

@@ -21,7 +21,14 @@ public class LocationLoader implements Loader<List<Location>> {
public ArrayList<Location> load() {
FileIO<ArrayList<Location>> fileIO = new FileIO<>();
ArrayList<Location> res = fileIO.readFileData(context,"locations.json",new TypeToken<ArrayList<Location>>(){}.getType());
String selectedLanguage = context.getSharedPreferences("Settings", Context.MODE_PRIVATE).getString("Language", "nl");
String fileName = "locations";
// choose the locations.json based of the selected language
if (!selectedLanguage.equals("en")) {
fileName += "-" + selectedLanguage;
}
ArrayList<Location> res = fileIO.readFileData(context,fileName + ".json",new TypeToken<ArrayList<Location>>(){}.getType());
return res == null ? new ArrayList<>() : res;
}

View File

@@ -22,7 +22,15 @@ public class RouteLoader implements Loader<List<Route>> {
public ArrayList<Route> load() {
FileIO<ArrayList<Route>> fileIO = new FileIO<>();
ArrayList<Route> res = fileIO.readFileData(context, "routes.json",new TypeToken<ArrayList<Route>>(){}.getType());
String selectedLanguage = context.getSharedPreferences("Settings", Context.MODE_PRIVATE).getString("Language", "nl");
String fileName = "routes";
// choose the routes.json based of the selected language
if (!selectedLanguage.equals("en")) {
fileName += "-" + selectedLanguage;
}
ArrayList<Route> res = fileIO.readFileData(context, fileName + ".json",new TypeToken<ArrayList<Route>>(){}.getType());
return res == null ? new ArrayList<>() : res;
}

View File

@@ -151,6 +151,7 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/statistics_time_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""

View File

@@ -20,4 +20,7 @@
<string name="activate">activeren</string>
<string name="done">Klaar</string>
<string name="cancel">annuleren</string>
<string name="English">Engels</string>
<string name="Dutch">Nederlands</string>
<string name="Chinese">Chinees</string>
</resources>

View File

@@ -19,4 +19,7 @@
<string name="done">Done</string>
<string name="cancel">cancel</string>
<string name="route_stop_toast">Route stopped!</string>
<string name="Dutch">Dutch</string>
<string name="English">English</string>
<string name="Chinese">Chinese</string>
</resources>