Added List button on Home
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"name": "rondje stad",
|
||||
"locations": [
|
||||
{
|
||||
"name": "kees kroket",
|
||||
"name": "KesCrOkÊt breeda",
|
||||
"coordinates": "2.4654645,6.2342323",
|
||||
"description": "lekkere patatjes"
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Coupon;
|
||||
@@ -26,6 +27,7 @@ public class CouponFragment extends Fragment {
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private List<Coupon> couponList;
|
||||
private CouponAdapter couponAdapter;
|
||||
private ImageButton imageButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -40,6 +42,12 @@ public class CouponFragment extends Fragment {
|
||||
this.couponRecyclerView.setHasFixedSize(true);
|
||||
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||
|
||||
this.imageButton = view.findViewById(R.id.couponBackButton);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
StatisticFragment statisticFragment = new StatisticFragment();
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
CouponListManager.INSTANCE.setContext(this.getContext());
|
||||
CouponListManager.INSTANCE.load();
|
||||
this.couponList = CouponListManager.INSTANCE.getCouponList();
|
||||
|
||||
@@ -13,12 +13,14 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Route;
|
||||
@@ -42,6 +44,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class HomeFragment extends Fragment {
|
||||
private final String userAgent = "com.ai.nextlocation.fragments";
|
||||
private ImageButton imageButton;
|
||||
private MapView mapView;
|
||||
private final int REQUEST_PERMISSIONS_REQUEST_CODE = 1;
|
||||
private final String TAG = HomeFragment.class.getCanonicalName();
|
||||
@@ -60,10 +63,16 @@ public class HomeFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_home, container, false);
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,15 +3,19 @@ package com.a1.nextlocation.fragments;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
|
||||
public class LocationDetailFragment extends Fragment {
|
||||
|
||||
private ImageButton imageButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -21,7 +25,15 @@ public class LocationDetailFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_location_detail, container, false);
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_location_detail, container, false);
|
||||
//
|
||||
// this.imageButton = view.findViewById(R.id.detail_location_back_button);
|
||||
// this.imageButton.setOnClickListener(v -> {
|
||||
// LocationFragment locationFragment = new LocationFragment();
|
||||
// ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
|
||||
// });
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
import com.a1.nextlocation.data.Location;
|
||||
@@ -25,6 +26,7 @@ public class LocationFragment extends Fragment {
|
||||
private LocationAdapter locationAdapter;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private List<Location> locationList;
|
||||
private ImageButton imageButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -40,6 +42,12 @@ public class LocationFragment extends Fragment {
|
||||
this.locationRecyclerView.setHasFixedSize(true);
|
||||
this.layoutManager = new LinearLayoutManager(this.getContext());
|
||||
|
||||
// this.imageButton = view.findViewById(R.id.locationBackButton);
|
||||
// this.imageButton.setOnClickListener(v -> {
|
||||
// HomeFragment homeFragment = new HomeFragment();
|
||||
// ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit();
|
||||
// });
|
||||
|
||||
LocationListManager.INSTANCE.setContext(this.getContext());
|
||||
LocationListManager.INSTANCE.load();
|
||||
this.locationList = LocationListManager.INSTANCE.getLocationList();
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -23,6 +24,7 @@ import java.util.List;
|
||||
public class StatisticFragment extends Fragment {
|
||||
|
||||
private List<Coupon> couponList;
|
||||
private ImageView imageButton;
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,6 +40,7 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
||||
}
|
||||
|
||||
public void setTextViewText(String text){
|
||||
this.locationName = itemView.findViewById(R.id.location_name);
|
||||
locationName.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -53,9 +54,8 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
|
||||
@NonNull
|
||||
@Override
|
||||
public LocationAdapter.LocationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_location, parent, false);
|
||||
LocationViewHolder viewHolder = new LocationViewHolder(itemView);
|
||||
return viewHolder;
|
||||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.location_item, parent, false);
|
||||
return new LocationViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -9,6 +10,23 @@
|
||||
<org.osmdroid.views.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</org.osmdroid.views.MapView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/location_list_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@drawable/ic_baseline_outlined_flag_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -14,11 +14,11 @@
|
||||
android:layout_margin="9dp"
|
||||
android:text="Locations"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/routeBackButton"
|
||||
app:layout_constraintStart_toEndOf="@id/locationBackButton"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/routeBackButton"
|
||||
android:id="@+id/locationBackButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ic_back_button_24"
|
||||
|
||||
@@ -7,16 +7,6 @@
|
||||
android:background="@color/primaryColour"
|
||||
tools:context=".fragments.StatisticFragment">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/primaryColour"
|
||||
android:src="@drawable/ic_back_button_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user