Develop #5
@@ -1,5 +1,6 @@
|
|||||||
package com.a1.nextlocation.fragments;
|
package com.a1.nextlocation.fragments;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -17,12 +18,21 @@ import com.a1.nextlocation.data.Route;
|
|||||||
import com.a1.nextlocation.recyclerview.RouteAdapter;
|
import com.a1.nextlocation.recyclerview.RouteAdapter;
|
||||||
import com.a1.nextlocation.recyclerview.RouteListManager;
|
import com.a1.nextlocation.recyclerview.RouteListManager;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RouteFragment extends Fragment {
|
public class RouteFragment extends Fragment {
|
||||||
private static final String TAG = RouteFragment.class.getCanonicalName();
|
private static final String TAG = RouteFragment.class.getCanonicalName();
|
||||||
|
|
||||||
private List<Route> routeList;
|
private List<Route> routeList;
|
||||||
|
private Refreshable refreshable;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NotNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
refreshable = (Refreshable) context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -55,8 +65,10 @@ public class RouteFragment extends Fragment {
|
|||||||
ImageButton backButton = view.findViewById(R.id.route_back_button);
|
ImageButton backButton = view.findViewById(R.id.route_back_button);
|
||||||
backButton.setOnClickListener(v -> {
|
backButton.setOnClickListener(v -> {
|
||||||
HomeFragment homeFragment = new HomeFragment();
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
if (getActivity() != null)
|
if (getActivity() != null) {
|
||||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
|
refreshable.refreshAndNavigateTo(R.id.map_view);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
routeRecyclerView.setLayoutManager(layoutManager);
|
routeRecyclerView.setLayoutManager(layoutManager);
|
||||||
|
|||||||
@@ -65,9 +65,10 @@ public class SettingsFragment extends Fragment {
|
|||||||
ImageView backButton = view.findViewById(R.id.settings_back_button);
|
ImageView backButton = view.findViewById(R.id.settings_back_button);
|
||||||
backButton.setOnClickListener(v -> {
|
backButton.setOnClickListener(v -> {
|
||||||
HomeFragment homeFragment = new HomeFragment();
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
if (getActivity() != null)
|
if (getActivity() != null) {
|
||||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
});
|
refreshable.refreshAndNavigateTo(R.id.map_view);
|
||||||
|
}});
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE);
|
SharedPreferences sharedPreferences = getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,19 @@ import com.a1.nextlocation.data.Data;
|
|||||||
import com.a1.nextlocation.recyclerview.CouponAdapter;
|
import com.a1.nextlocation.recyclerview.CouponAdapter;
|
||||||
import com.a1.nextlocation.recyclerview.CouponListManager;
|
import com.a1.nextlocation.recyclerview.CouponListManager;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class StatisticFragment extends Fragment {
|
public class StatisticFragment extends Fragment {
|
||||||
private TextView distance;
|
private TextView distance;
|
||||||
|
private Refreshable refreshable;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NotNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
refreshable = (Refreshable) context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -60,6 +69,7 @@ public class StatisticFragment extends Fragment {
|
|||||||
HomeFragment homeFragment = new HomeFragment();
|
HomeFragment homeFragment = new HomeFragment();
|
||||||
if (getActivity() != null)
|
if (getActivity() != null)
|
||||||
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||||
|
refreshable.refreshAndNavigateTo(R.id.map_view);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Initialises the coupon button
|
//Initialises the coupon button
|
||||||
|
|||||||
Reference in New Issue
Block a user