Added List button on Home

This commit is contained in:
RemoMeijer
2021-01-04 15:37:09 +01:00
parent e761dd80e5
commit 1b770020ed
10 changed files with 68 additions and 21 deletions

View File

@@ -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();