diff --git a/app/src/main/assets/coupons.json b/app/src/main/assets/coupons.json index 39a85db..eefca7d 100644 --- a/app/src/main/assets/coupons.json +++ b/app/src/main/assets/coupons.json @@ -1,6 +1,10 @@ [ { - "code": "2345", - "reward": "fdasfasdf" + "code": "KROKET10", + "reward": "Gratis 2e kroket bij Kees Kroket™" + }, + { + "code": "654", + "reward": ",juygly" } ] \ No newline at end of file diff --git a/app/src/main/assets/routes.json b/app/src/main/assets/routes.json index 9c84f63..46c734f 100644 --- a/app/src/main/assets/routes.json +++ b/app/src/main/assets/routes.json @@ -3,7 +3,7 @@ "name": "rondje stad", "locations": [ { - "name": "kees kroket", + "name": "KesCrOkÊt breeda", "coordinates": "2.4654645,6.2342323", "description": "lekkere patatjes" } diff --git a/app/src/main/java/com/a1/nextlocation/data/Location.java b/app/src/main/java/com/a1/nextlocation/data/Location.java index 8185aea..f7d2362 100644 --- a/app/src/main/java/com/a1/nextlocation/data/Location.java +++ b/app/src/main/java/com/a1/nextlocation/data/Location.java @@ -1,12 +1,15 @@ package com.a1.nextlocation.data; +import android.os.Parcel; +import android.os.Parcelable; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import org.jetbrains.annotations.NotNull; import org.osmdroid.util.GeoPoint; -public class Location { +public class Location implements Parcelable { @NonNull private String name; @@ -32,6 +35,25 @@ public class Location { this(name,getStringFromCoordinates(latCoord,longCoord),description,imageUrl); } + protected Location(Parcel in) { + name = in.readString(); + coordinates = in.readString(); + description = in.readString(); + imageUrl = in.readString(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public Location createFromParcel(Parcel in) { + return new Location(in); + } + + @Override + public Location[] newArray(int size) { + return new Location[size]; + } + }; + @NotNull public String getName() { return name; @@ -90,4 +112,16 @@ public class Location { return new GeoPoint(this.getLat(),this.getLong()); } + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeString(name); + parcel.writeString(coordinates); + parcel.writeString(description); + parcel.writeString(imageUrl); + } } diff --git a/app/src/main/java/com/a1/nextlocation/data/Route.java b/app/src/main/java/com/a1/nextlocation/data/Route.java index 7ff67dc..baf6016 100644 --- a/app/src/main/java/com/a1/nextlocation/data/Route.java +++ b/app/src/main/java/com/a1/nextlocation/data/Route.java @@ -1,5 +1,8 @@ package com.a1.nextlocation.data; +import android.os.Parcel; +import android.os.Parcelable; + import androidx.annotation.NonNull; import org.jetbrains.annotations.NotNull; @@ -7,7 +10,7 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -public class Route { +public class Route implements Parcelable { @NonNull @@ -29,6 +32,25 @@ public class Route { } + protected Route(Parcel in) { + this.name = in.readString(); + this.locations = in.createTypedArrayList(Location.CREATOR); + this.totalDistance = in.readFloat(); + this.totalTime = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public Route createFromParcel(Parcel in) { + return new Route(in); + } + + @Override + public Route[] newArray(int size) { + return new Route[size]; + } + }; + public void addLocation(Location location) { this.locations.add(location); } @@ -69,4 +91,16 @@ public class Route { this.totalTime = totalTime; } + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeString(name); + parcel.writeTypedList(locations); + parcel.writeFloat(totalDistance); + parcel.writeInt(totalTime); + } } diff --git a/app/src/main/java/com/a1/nextlocation/fragments/CouponFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/CouponFragment.java index 22302bb..1faea7f 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/CouponFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/CouponFragment.java @@ -1,26 +1,85 @@ package com.a1.nextlocation.fragments; +import android.app.AlertDialog; +import android.content.DialogInterface; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +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; +import com.a1.nextlocation.recyclerview.CouponAdapter; +import com.a1.nextlocation.recyclerview.CouponListManager; + +import java.util.List; public class CouponFragment extends Fragment { + private RecyclerView couponRecyclerView; + private RecyclerView.LayoutManager layoutManager; + private List couponList; + private CouponAdapter couponAdapter; + private ImageButton imageButton; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_coupon, container, false); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_coupon, container, false); + + this.couponRecyclerView = view.findViewById(R.id.couponRecyclerView); + 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(); + + this.couponAdapter = new CouponAdapter(this.getContext(), this.couponList, clickedPosition -> showPopup(this.couponList.get(clickedPosition))); + + this.couponRecyclerView.setLayoutManager(this.layoutManager); + this.couponRecyclerView.setAdapter(this.couponAdapter); + return view; + } + + private void showPopup(Coupon coupon) { + AlertDialog.Builder activateBuilder = new AlertDialog.Builder(getContext()); + AlertDialog.Builder couponCodeBuilder = new AlertDialog.Builder(getContext()); + // TODO: use string resources instead of hardcoded strings + activateBuilder.setMessage("Weet je zeker dat je deze coupon wilt activeren?"); + activateBuilder.setCancelable(true); + // TODO: use string resources instead of hardcoded strings + activateBuilder.setPositiveButton("activeren", (dialog, which) -> { + // TODO: use string resources instead of hardcoded strings + dialog.cancel(); + couponCodeBuilder.setMessage("Code: " + coupon.getCode()); + couponCodeBuilder.setPositiveButton("Klaar", (dialog1, which1) -> { + dialog.cancel(); + }); + AlertDialog couponCodePopup = couponCodeBuilder.create(); + couponCodePopup.show(); + }); + // TODO: use string resources instead of hardcoded strings + activateBuilder.setNegativeButton("annuleren", (dialog, which) -> dialog.cancel()); + AlertDialog couponPopup = activateBuilder.create(); + couponPopup.show(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java index d21d925..621d02b 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java @@ -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 diff --git a/app/src/main/java/com/a1/nextlocation/fragments/LocationDetailFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/LocationDetailFragment.java index ea2fae9..62b6313 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/LocationDetailFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/LocationDetailFragment.java @@ -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; } } \ No newline at end of file diff --git a/app/src/main/java/com/a1/nextlocation/fragments/LocationFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/LocationFragment.java index 133665f..237622d 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/LocationFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/LocationFragment.java @@ -3,25 +3,65 @@ package com.a1.nextlocation.fragments; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +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; +import com.a1.nextlocation.recyclerview.CouponAdapter; +import com.a1.nextlocation.recyclerview.LocationAdapter; +import com.a1.nextlocation.recyclerview.LocationListManager; + +import java.util.ArrayList; +import java.util.List; public class LocationFragment extends Fragment { + private RecyclerView locationRecyclerView; + private LocationAdapter locationAdapter; + private RecyclerView.LayoutManager layoutManager; + private List locationList; + private ImageButton imageButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_location, container, false); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view = inflater.inflate(R.layout.fragment_location, container, false); + + this.locationRecyclerView = view.findViewById(R.id.locationRecyclerView); + 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(); + + this.locationAdapter = new LocationAdapter(this.getContext(), this.locationList, clickedPosition -> { + LocationDetailFragment locationDetailFragment = new LocationDetailFragment(); + Bundle locationBundle = new Bundle(); + locationBundle.putParcelable("location", this.locationList.get(clickedPosition)); + locationDetailFragment.setArguments(locationBundle); + ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationDetailFragment).addToBackStack(null).commit(); + }); + + this.locationRecyclerView.setLayoutManager(this.layoutManager); + this.locationRecyclerView.setAdapter(this.locationAdapter); + return view; } } \ No newline at end of file diff --git a/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java index c610d6a..d79bfa2 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java @@ -7,11 +7,16 @@ import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import com.a1.nextlocation.R; +import com.a1.nextlocation.data.Route; public class RouteDetailFragment extends Fragment { + private Route route; + private TextView routeDetailText; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -19,9 +24,16 @@ public class RouteDetailFragment extends Fragment { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_route_detail, container, false); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_route_detail, container, false); + if(getArguments().getParcelable("route") != null) { + this.route = getArguments().getParcelable("route"); + } + + this.routeDetailText = view.findViewById(R.id.routeDetailText); + this.routeDetailText.setText(this.route.getName()); + + + return view; } } \ No newline at end of file diff --git a/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java index 3ebe08a..752b7d6 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java @@ -5,6 +5,9 @@ import android.os.Bundle; 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; import android.util.Log; import android.view.LayoutInflater; @@ -12,6 +15,12 @@ import android.view.View; import android.view.ViewGroup; import com.a1.nextlocation.R; +import com.a1.nextlocation.data.Route; +import com.a1.nextlocation.recyclerview.RouteAdapter; +import com.a1.nextlocation.recyclerview.RouteListManager; + +import java.util.ArrayList; +import java.util.List; import com.a1.nextlocation.data.Location; import com.a1.nextlocation.data.Route; import com.a1.nextlocation.json.DirectionsResult; @@ -21,6 +30,11 @@ import com.a1.nextlocation.network.DirectionsListener; public class RouteFragment extends Fragment { private static final String TAG = RouteFragment.class.getCanonicalName(); + private RecyclerView routeRecyclerView; + private RecyclerView.LayoutManager layoutManager; + private List routeList; + private RouteAdapter routeAdapter; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -29,10 +43,28 @@ public class RouteFragment extends Fragment { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_route, container, false); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_route, container, false); + + this.routeRecyclerView = view.findViewById(R.id.routeRecyclerView); + this.routeRecyclerView.setHasFixedSize(true); + this.layoutManager = new LinearLayoutManager(this.getContext()); + + RouteListManager.INSTANCE.setContext(this.getContext()); + RouteListManager.INSTANCE.load(); + this.routeList = RouteListManager.INSTANCE.getRouteList(); + + this.routeAdapter = new RouteAdapter(this.getContext(), this.routeList, clickedPosition -> { + RouteDetailFragment routeDetailFragment = new RouteDetailFragment(); + 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(); + }); + + this.routeRecyclerView.setLayoutManager(this.layoutManager); + this.routeRecyclerView.setAdapter(this.routeAdapter); + return view; } @Override @@ -40,15 +72,15 @@ public class RouteFragment extends Fragment { super.onViewCreated(view, savedInstanceState); // ApiHandler.INSTANCE.getDirections(8.681436,49.41461,8.687872,49.420318); - Route r = new Route("test"); - r.addLocation(new Location("test",8.681436,49.41461,"route",null)); - r.addLocation(new Location("test",8.687872,49.420318,"route",null)); - ApiHandler.INSTANCE.getDirections(r); +// Route r = new Route("test"); +// r.addLocation(new Location("test",8.681436,49.41461,"route",null)); +// r.addLocation(new Location("test",8.687872,49.420318,"route",null)); +// ApiHandler.INSTANCE.getDirections(r); } public void onDirectionsAvailable(DirectionsResult result) { Log.d(TAG, "onDirectionsAvailable: got result! " + result); - - + + } } \ No newline at end of file diff --git a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java index d86d6ea..a4080c5 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java @@ -2,26 +2,51 @@ package com.a1.nextlocation.fragments; import android.os.Bundle; +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +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; import com.a1.nextlocation.R; +import com.a1.nextlocation.data.Coupon; +import com.a1.nextlocation.recyclerview.CouponAdapter; +import com.a1.nextlocation.recyclerview.CouponListManager; + +import java.util.List; public class StatisticFragment extends Fragment { + private List couponList; + private ImageView imageButton; + + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_statistic, container, false); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_statistic, container, false); + + this.couponList = CouponListManager.INSTANCE.getCouponList(); + CouponAdapter adapter = new CouponAdapter(this.getContext(), this.couponList); + TextView couponNumber = view.findViewById(R.id.couponAmount); + couponNumber.setText(String.valueOf(adapter.getItemCount())); + + + 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(); + }); + return view; } } \ No newline at end of file diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/CouponAdapter.java b/app/src/main/java/com/a1/nextlocation/recyclerview/CouponAdapter.java index 2098508..95ede65 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/CouponAdapter.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/CouponAdapter.java @@ -3,10 +3,13 @@ package com.a1.nextlocation.recyclerview; import android.content.Context; import android.view.View; import android.view.ViewGroup; +import android.view.LayoutInflater; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.a1.nextlocation.R; import com.a1.nextlocation.data.Coupon; import java.util.List; @@ -23,31 +26,49 @@ public class CouponAdapter extends RecyclerView.Adapter coupon, OnItemClickListener listener){ - appContext = context; - couponList = coupon; - clickListener = listener; + this.appContext = context; + this.couponList = coupon; + this.clickListener = listener; + + } + + public CouponAdapter(Context context, List coupon) { + this.appContext = context; + this.couponList = coupon; } @NonNull @Override public CouponViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return null; + View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.coupon_item, parent, false); + return new CouponViewHolder(itemView); } @Override public void onBindViewHolder(@NonNull CouponViewHolder holder, int position) { - + Coupon coupon = couponList.get(position); + holder.setTextViewName(coupon.getReward()); } @Override @@ -55,7 +76,4 @@ public class CouponAdapter extends RecyclerView.Adapter> { diff --git a/app/src/main/java/com/a1/nextlocation/recyclerview/LocationAdapter.java b/app/src/main/java/com/a1/nextlocation/recyclerview/LocationAdapter.java index 5ef367f..b39feae 100644 --- a/app/src/main/java/com/a1/nextlocation/recyclerview/LocationAdapter.java +++ b/app/src/main/java/com/a1/nextlocation/recyclerview/LocationAdapter.java @@ -18,7 +18,7 @@ public class LocationAdapter extends RecyclerView.Adapter locationList; - private CouponAdapter.OnItemClickListener clickListener; + private OnItemClickListener clickListener; public interface OnItemClickListener { void onItemClick(int clickedPosition); @@ -31,6 +31,7 @@ public class LocationAdapter extends RecyclerView.Adapter location, CouponAdapter.OnItemClickListener listener){ + public LocationAdapter(Context context, List location, OnItemClickListener listener){ this.appContext = context; this.locationList = location; this.clickListener = listener; @@ -52,9 +54,8 @@ public class LocationAdapter extends RecyclerView.Adapter route, CouponAdapter.OnItemClickListener listener){ @@ -42,12 +56,14 @@ public class RouteAdapter extends RecyclerView.Adapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -