Merge branch 'develop' into routeFragmentDetail
This commit is contained in:
@@ -53,7 +53,8 @@ public class CouponFragment extends Fragment {
|
||||
this.backButton = view.findViewById(R.id.coupon_back_button);
|
||||
this.backButton.setOnClickListener(v -> {
|
||||
StatisticFragment statisticFragment = new StatisticFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
this.couponRecyclerView.setLayoutManager(this.layoutManager);
|
||||
|
||||
@@ -91,7 +91,8 @@ public class HomeFragment extends Fragment implements LocationListener {
|
||||
this.imageButton = view.findViewById(R.id.location_list_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
LocationFragment locationFragment = new LocationFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
// set up the route stop button
|
||||
|
||||
@@ -12,7 +12,6 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Data;
|
||||
@@ -74,7 +73,8 @@ public class LocationDetailFragment extends Fragment {
|
||||
this.backButton = view.findViewById(R.id.detail_location_back_button);
|
||||
this.backButton.setOnClickListener(v -> {
|
||||
LocationFragment locationFragment = new LocationFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
//Logs the location
|
||||
|
||||
@@ -43,7 +43,8 @@ public class LocationFragment extends Fragment {
|
||||
this.backButton = view.findViewById(R.id.location_back_button);
|
||||
this.backButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
//Loads the location list
|
||||
@@ -58,7 +59,8 @@ public class LocationFragment extends Fragment {
|
||||
//Gives the clicked location to the adapter
|
||||
locationBundle.putParcelable("location", this.locationList.get(clickedPosition));
|
||||
locationDetailFragment.setArguments(locationBundle);
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationDetailFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationDetailFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
this.locationRecyclerView.setLayoutManager(this.layoutManager);
|
||||
|
||||
@@ -14,7 +14,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Location;
|
||||
@@ -80,7 +79,8 @@ public class RouteDetailFragment extends Fragment {
|
||||
ImageButton backButton = view.findViewById(R.id.route_detail_back_button);
|
||||
backButton.setOnClickListener(v -> {
|
||||
RouteFragment routeFragment = new RouteFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
Button startButton = view.findViewById(R.id.start_route_button);
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.widget.ImageButton;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -49,13 +48,15 @@ public class RouteFragment extends Fragment {
|
||||
Bundle routeBundle = new Bundle();
|
||||
routeBundle.putParcelable("route", this.routeList.get(clickedPosition));
|
||||
routeDetailFragment.setArguments(routeBundle);
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeDetailFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, routeDetailFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
ImageButton backButton = view.findViewById(R.id.route_back_button);
|
||||
backButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
routeRecyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -17,10 +16,8 @@ import android.widget.Spinner;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.a1.nextlocation.MainActivity;
|
||||
import com.a1.nextlocation.R;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -66,7 +63,8 @@ public class SettingsFragment extends Fragment {
|
||||
ImageView backButton = view.findViewById(R.id.settings_back_button);
|
||||
backButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
SharedPreferences sharedPreferences = getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE);
|
||||
@@ -96,13 +94,14 @@ public class SettingsFragment extends Fragment {
|
||||
//Changes the font settings depending on the state of the toggle
|
||||
|
||||
fontSwitch.setOnClickListener(view1 -> {
|
||||
if(fontSwitch.isChecked())
|
||||
{
|
||||
if (fontSwitch.isChecked()) {
|
||||
requireActivity().setTheme(R.style.Theme_NextLocationBig);
|
||||
getActivity().recreate();
|
||||
}
|
||||
if(!fontSwitch.isChecked())
|
||||
{
|
||||
requireActivity().setTheme(R.style.Theme_NextLocation);;
|
||||
requireActivity().setTheme(R.style.Theme_NextLocation);
|
||||
getActivity().recreate();
|
||||
}
|
||||
editor.putBoolean("fontSwitch", fontSwitch.isChecked());
|
||||
editor.apply();
|
||||
|
||||
@@ -58,21 +58,24 @@ public class StatisticFragment extends Fragment {
|
||||
ImageView backButton = view.findViewById(R.id.statistics_back_button);
|
||||
backButton.setOnClickListener(v -> {
|
||||
HomeFragment homeFragment = new HomeFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
//Initialises the coupon button
|
||||
ImageView couponButton = view.findViewById(R.id.coupon_button);
|
||||
couponButton.setOnClickListener(v -> {
|
||||
CouponFragment couponFragment = new CouponFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
//Makes the constraintlayout clickable and opens the same layout as the coupon button
|
||||
ConstraintLayout constraintLayout = view.findViewById(R.id.Box4);
|
||||
constraintLayout.setOnClickListener(v -> {
|
||||
CouponFragment couponFragment = new CouponFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||
if (getActivity() != null)
|
||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
android:id="@+id/couponItem"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@+id/name_box"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/name_box"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/name_box"
|
||||
app:layout_constraintRight_toRightOf="@+id/name_box"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/name_box"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:backgroundTint="@color/primaryColour"
|
||||
android:src="@drawable/ic_back_button_24"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -267,8 +267,6 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
android:src="@drawable/ic_back_button_24"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -22,24 +22,28 @@
|
||||
android:paddingVertical="10dp"/>
|
||||
|
||||
<ScrollView
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/helpPopTitle"
|
||||
android:id="@+id/scrollView2"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="450dp">
|
||||
android:layout_height="400dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/helpPopTitle"
|
||||
app:layout_constraintBottom_toTopOf="@id/help_ok_button"
|
||||
>
|
||||
|
||||
<TextView
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/helpPopTitle"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="430dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/help_discription"
|
||||
android:textColor="@color/secondaryColour"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/helpPopTitle" />
|
||||
|
||||
|
||||
</ScrollView>
|
||||
@@ -48,11 +52,13 @@
|
||||
android:id="@+id/help_ok_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:backgroundTint="@color/buttonColour"
|
||||
android:textColor="@color/primaryColour"
|
||||
android:text="ok"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/helpPopTitle" />
|
||||
app:layout_constraintTop_toBottomOf="@id/scrollView2"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/primaryColour</item>
|
||||
<item name="colorPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/secondaryColour</item>
|
||||
<!-- Customize your theme here. -->
|
||||
@@ -12,8 +12,8 @@
|
||||
</style>
|
||||
|
||||
<style name="Theme.Switches" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="colorControlActivated">@color/buttonColour</item>
|
||||
<item name="colorSwitchThumbNormal">@color/primaryColour</item>
|
||||
<item name="colorControlActivated">@color/secondaryColour</item>
|
||||
<item name="colorSwitchThumbNormal">@color/buttonColourCB</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.NextLocationBig" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<string name="Dutch">Nederlands</string>
|
||||
<string name="Chinese">Chinees</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. \n\n\n</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>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<string name="English">English</string>
|
||||
<string name="Chinese">Chinese</string>
|
||||
<string name="help">HELP</string>
|
||||
<string name="help_discription">Hasn\'t been translated yet</string>
|
||||
<string name="help_discription">Various buttons can be seen at the bottom of the screen. These buttons have the following functions: \n\nLocations: displays a list of all locations that can be visited. Each location is briefly described. \n\nRoutes: Displays a list of all routes that can be walked. A description is given of each route. \n\nStats: Displays personal statistics. \n\nSettings: This is where app settings can be adjusted according to your preferences. \n\nHold down on a location to display additional information about the chosen location. \n\n\n</string>
|
||||
<string name="notification_title">You\'re close to a location!</string>
|
||||
<string name="notification_text">You\'re almost at %1$s</string>
|
||||
<string name="following_locations">This route contains the following locations: </string>
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/primaryColour</item>
|
||||
<item name="colorPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/secondaryColour</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||
<item name="colorPrimaryDark">@color/secondaryColour</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Switches" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
|
||||
Reference in New Issue
Block a user