Route detail added
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "Evenementen Route",
|
"name": "Event Route",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"name": "Escaping Breda: Escape Room Games Boschstraat 114",
|
"name": "Escaping Breda: Escape Room Games Boschstraat 114",
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
"imageURL": "escaping_room"
|
"imageURL": "escaping_room"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Hongerige Route",
|
"name": "Hungry Route",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"name":"Subway Karnemelkstraat 10 A, 1",
|
"name":"Subway Karnemelkstraat 10 A, 1",
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ public class LocationDetailFragment extends Fragment {
|
|||||||
currentDistanceToLocation = Location.getDistance(Data.INSTANCE.getLocation().getLatitude(), Data.INSTANCE.getLocation().getLongitude(), this.location.getLat(), this.location.getLong());
|
currentDistanceToLocation = Location.getDistance(Data.INSTANCE.getLocation().getLatitude(), Data.INSTANCE.getLocation().getLongitude(), this.location.getLat(), this.location.getLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
String detailText = "";
|
//Adds distance text from the current distance of the user to the opened location
|
||||||
|
String detailText;
|
||||||
if(getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).getBoolean("imperialSwitch", false)){
|
if(getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).getBoolean("imperialSwitch", false)){
|
||||||
if(currentDistanceToLocation > 1609)
|
if(currentDistanceToLocation > 1609)
|
||||||
detailText = location.getDescription() + String.format("%.3f",currentDistanceToLocation * 0.000621371192) + "mi";
|
detailText = location.getDescription() + String.format("%.3f",currentDistanceToLocation * 0.000621371192) + "mi";
|
||||||
@@ -66,7 +67,6 @@ public class LocationDetailFragment extends Fragment {
|
|||||||
else
|
else
|
||||||
detailText = location.getDescription() + currentDistanceToLocation + "m";
|
detailText = location.getDescription() + currentDistanceToLocation + "m";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.detailText = view.findViewById(R.id.detail_location_text);
|
this.detailText = view.findViewById(R.id.detail_location_text);
|
||||||
this.detailText.setText(detailText);
|
this.detailText.setText(detailText);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.a1.nextlocation.fragments;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -44,7 +45,7 @@ public class RouteDetailFragment extends Fragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint({"SetTextI18n", "DefaultLocale"})
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_route_detail, container, false);
|
View view = inflater.inflate(R.layout.fragment_route_detail, container, false);
|
||||||
@@ -60,8 +61,14 @@ public class RouteDetailFragment extends Fragment {
|
|||||||
TextView routeName = view.findViewById(R.id.route_title);
|
TextView routeName = view.findViewById(R.id.route_title);
|
||||||
routeName.setText(this.route.getName());
|
routeName.setText(this.route.getName());
|
||||||
|
|
||||||
TextView routeDetailText = view.findViewById(R.id.reoute_detail_tekst);
|
TextView routeDetailText = view.findViewById(R.id.route_detail_tekst);
|
||||||
routeDetailText.setText(this.route.getDescription());
|
StringBuilder locations = new StringBuilder();
|
||||||
|
for(Location location : this.route.getLocations()){
|
||||||
|
locations.append("<br>•").append(location.getName());
|
||||||
|
}
|
||||||
|
String detailText = this.route.getDescription() + "<br><br><b>" + getResources().getString(R.string.following_locations) + "</b>" + locations + "<br><br><b>" + getResources().getString(R.string.start_location) + ": </b>" + route.getLocations().get(0).getName() + "<br>" + "<b>" + getResources().getString(R.string.end_location) + ": </b>" + route.getLocations().get(route.getLocations().size()-1).getName();
|
||||||
|
routeDetailText.setText(Html.fromHtml(detailText));
|
||||||
|
|
||||||
|
|
||||||
TextView totalDistance = view.findViewById(R.id.total_distance);
|
TextView totalDistance = view.findViewById(R.id.total_distance);
|
||||||
String distance_tekst = getResources().getString(R.string.total_distance_route);
|
String distance_tekst = getResources().getString(R.string.total_distance_route);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/secondaryColour"
|
android:background="@color/secondaryColour"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
android:text=""
|
android:text=""
|
||||||
/>
|
/>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -37,19 +37,27 @@
|
|||||||
android:id="@+id/route_detail_image"
|
android:id="@+id/route_detail_image"
|
||||||
app:layout_constraintTop_toBottomOf="@id/route_detail_back_button"
|
app:layout_constraintTop_toBottomOf="@id/route_detail_back_button"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
app:layout_constraintBottom_toTopOf="@id/reoute_detail_tekst" />
|
|
||||||
|
|
||||||
<TextView
|
<ScrollView
|
||||||
android:id="@+id/reoute_detail_tekst"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="200dp"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:layout_margin="20dp"
|
||||||
android:layout_marginTop="20dp"
|
android:background="@color/secondaryColour"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:id="@+id/route_scroll_view"
|
||||||
app:layout_constraintHorizontal_bias="0.6"
|
app:layout_constraintBottom_toTopOf="@id/total_distance"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/route_detail_image"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/route_detail_image" />
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/route_detail_tekst"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="20dp" />
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/start_route_button"
|
android:id="@+id/start_route_button"
|
||||||
@@ -77,6 +85,6 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.498"
|
app:layout_constraintHorizontal_bias="0.498"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/reoute_detail_tekst" />
|
app:layout_constraintTop_toBottomOf="@+id/route_scroll_view" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -20,10 +20,14 @@
|
|||||||
<string name="activate">activeren</string>
|
<string name="activate">activeren</string>
|
||||||
<string name="done">Klaar</string>
|
<string name="done">Klaar</string>
|
||||||
<string name="total_distance_route">De totale afstand van de route is: </string>
|
<string name="total_distance_route">De totale afstand van de route is: </string>
|
||||||
|
<string name="route_stop_toast">Route is gestopt!</string>
|
||||||
<string name="cancel">annuleren</string>
|
<string name="cancel">annuleren</string>
|
||||||
<string name="English">Engels</string>
|
<string name="English">Engels</string>
|
||||||
<string name="Dutch">Nederlands</string>
|
<string name="Dutch">Nederlands</string>
|
||||||
<string name="Chinese">Chinees</string>
|
<string name="Chinese">Chinees</string>
|
||||||
<string name="help">HELP</string>
|
<string name="help">HELP</string>
|
||||||
<string name="help_discription">Onderaan het scherm zijn verschillende knoppen te zien. Deze knoppen hebben de volgende functies: \n\nLocaties: toont een lijst met alle locaties die bezocht kunnen worden. Elke locatie wordt kort beschreven. \n\nRoutes: Toont een lijst met alle routes die gelopen kunnen worden. Van elke route wordt een omschrijving gegeven. \n\nStatistieken: Toont persoonlijke statistieken. \n\nInstellingen: Hier kunnen app-instellingen worden aangepast naar eigen voorkeur. \n\nEen locatie ingedrukt houden laat extra informatie zien over de gekozen locatie</string>
|
<string name="help_discription">Onderaan het scherm zijn verschillende knoppen te zien. Deze knoppen hebben de volgende functies: \n\nLocaties: toont een lijst met alle locaties die bezocht kunnen worden. Elke locatie wordt kort beschreven. \n\nRoutes: Toont een lijst met alle routes die gelopen kunnen worden. Van elke route wordt een omschrijving gegeven. \n\nStatistieken: Toont persoonlijke statistieken. \n\nInstellingen: Hier kunnen app-instellingen worden aangepast naar eigen voorkeur. \n\nEen locatie ingedrukt houden laat extra informatie zien over de gekozen locatie</string>
|
||||||
|
<string name="end_location">Eind locatie</string>
|
||||||
|
<string name="start_location">Start locatie</string>
|
||||||
|
<string name="following_locations">"Deze route bevat de volgende locaties: "</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -25,4 +25,7 @@
|
|||||||
<string name="Chinese">Chinese</string>
|
<string name="Chinese">Chinese</string>
|
||||||
<string name="help">HELP</string>
|
<string name="help">HELP</string>
|
||||||
<string name="help_discription">Hasn\'t been translated yet</string>
|
<string name="help_discription">Hasn\'t been translated yet</string>
|
||||||
|
<string name="following_locations">This route contains the following locations: </string>
|
||||||
|
<string name="end_location">End location</string>
|
||||||
|
<string name="start_location">Start location</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user