Merge branch 'develop' of https://github.com/SemvdH/Next-Location into develop

This commit is contained in:
Sem van der Hoeven
2021-01-06 19:25:15 +01:00
19 changed files with 125 additions and 275 deletions

View File

@@ -27,17 +27,19 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
class CouponViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView couponCode;
private TextView couponReward;
public CouponViewHolder(@NonNull View itemView) {
super(itemView);
itemView.setOnClickListener(this);
}
/**
* Sets the text of the coupon
* @param text the text that will be set
*/
public void setTextViewName(String text){
this.couponReward = itemView.findViewById(R.id.coupon_name);
this.couponReward.setText(text);
TextView couponReward = itemView.findViewById(R.id.coupon_name);
couponReward.setText(text);
}
@Override

View File

@@ -22,10 +22,9 @@ public enum CouponListManager {
return couponList;
}
public Coupon getCoupon(int place) {
return couponList.get(place);
}
/**
* Prepares the list for loading
*/
public void load(){
CouponLoader couponLoader = new CouponLoader(this.context);
this.couponList = couponLoader.load();

View File

@@ -18,6 +18,10 @@ public class CouponLoader implements Loader<List<Coupon>> {
this.context = context;
}
/**
* Loads the Arraylist of coupons out of the JSON
* @return Arraylist of coupons
*/
@Override
public ArrayList<Coupon> load() {
FileIO<ArrayList<Coupon>> fileIO = new FileIO<>();

View File

@@ -1,42 +0,0 @@
package com.a1.nextlocation.recyclerview;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import org.osmdroid.api.IMapView;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ItemizedOverlay;
import org.osmdroid.views.overlay.OverlayItem;
import java.util.ArrayList;
public class CustomOverlay extends ItemizedOverlay<OverlayItem> {
private final MapView mapView;
private ArrayList<OverlayItem> overlayItems = new ArrayList<>();
public CustomOverlay(Drawable pDefaultMarker, MapView mapView) {
super(pDefaultMarker);
this.mapView = mapView;
}
public void addOverlayItem(OverlayItem item) {
overlayItems.add(item);
populate();
}
@Override
protected OverlayItem createItem(int i) {
return overlayItems.get(i);
}
@Override
public int size() {
return overlayItems.size();
}
@Override
public boolean onSnapToItem(int x, int y, Point snapPoint, IMapView mapView) {
return true;
}
}

View File

@@ -42,11 +42,19 @@ public class LocationAdapter extends RecyclerView.Adapter<LocationAdapter.Locati
clickListener.onItemClick(getAdapterPosition());
}
/**
* Sets the text of the location name
* @param text the text that will be set
*/
public void setTextViewText(String text){
this.locationName = itemView.findViewById(R.id.location_name);
locationName.setText(text);
this.locationName.setText(text);
}
/**
* Sets the image of the locatoin
* @param text the text of the image filename
*/
public void setImageViewImage(String text){
this.locationImage = itemView.findViewById(R.id.location_image);
Context context = locationImage.getContext();