From aae67f53ec112431cae0c3c97eb77e5b2086ece0 Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Tue, 5 Jan 2021 13:18:25 +0100 Subject: [PATCH 01/13] Statistics button works --- .../com/a1/nextlocation/fragments/StatisticFragment.java | 6 ++++++ app/src/main/res/layout/fragment_statistic.xml | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 a4080c5..77d9d32 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java @@ -41,6 +41,12 @@ public class StatisticFragment extends Fragment { TextView couponNumber = view.findViewById(R.id.couponAmount); couponNumber.setText(String.valueOf(adapter.getItemCount())); + + this.imageButton = view.findViewById(R.id.route_back_button); + this.imageButton.setOnClickListener(v -> { + HomeFragment homeFragment = new HomeFragment(); + ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit(); + }); ConstraintLayout constraintLayout = view.findViewById(R.id.Box4); constraintLayout.setOnClickListener(v -> { diff --git a/app/src/main/res/layout/fragment_statistic.xml b/app/src/main/res/layout/fragment_statistic.xml index 773c34d..0bc2015 100644 --- a/app/src/main/res/layout/fragment_statistic.xml +++ b/app/src/main/res/layout/fragment_statistic.xml @@ -217,8 +217,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" - android:layout_marginTop="10dp" + android:layout_marginTop="15dp" + android:background="@drawable/ic_back_button_24" + android:backgroundTint="@color/buttonColour" android:src="@drawable/ic_back_button_24" + android:text="@string/terug" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> From fbf8cbe1c567256669c869f8f234668a30717415 Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Tue, 5 Jan 2021 13:23:48 +0100 Subject: [PATCH 02/13] Small fix --- .../fragments/StatisticFragment.java | 4 +-- .../main/res/layout/fragment_statistic.xml | 25 ++++++++----------- app/src/main/res/layout/location_item.xml | 6 ++--- 3 files changed, 16 insertions(+), 19 deletions(-) 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 77d9d32..e63a74d 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java @@ -41,8 +41,8 @@ public class StatisticFragment extends Fragment { TextView couponNumber = view.findViewById(R.id.couponAmount); couponNumber.setText(String.valueOf(adapter.getItemCount())); - - this.imageButton = view.findViewById(R.id.route_back_button); + + this.imageButton = view.findViewById(R.id.statistics_back_button); this.imageButton.setOnClickListener(v -> { HomeFragment homeFragment = new HomeFragment(); ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit(); diff --git a/app/src/main/res/layout/fragment_statistic.xml b/app/src/main/res/layout/fragment_statistic.xml index 0bc2015..0e63e8e 100644 --- a/app/src/main/res/layout/fragment_statistic.xml +++ b/app/src/main/res/layout/fragment_statistic.xml @@ -1,9 +1,9 @@ @@ -23,12 +23,12 @@ android:id="@+id/name_box" android:layout_width="match_parent" android:layout_height="70dp" + android:layout_marginHorizontal="20dp" + android:background="@color/secondaryColour" app:layout_constraintBottom_toTopOf="@id/Box2" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/textView" - android:background="@color/secondaryColour" - android:layout_marginHorizontal="20dp" > @@ -51,8 +51,7 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - /> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@id/Box2"> @@ -195,13 +193,12 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - /> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> \ No newline at end of file From 2e5f57aa23dd6492dffb1996478415f193b85861 Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Tue, 5 Jan 2021 13:32:28 +0100 Subject: [PATCH 03/13] Added coupon arrow --- .../fragments/RouteDetailFragment.java | 2 +- .../fragments/StatisticFragment.java | 7 +++++++ .../res/layout-land/fragment_route_detail.xml | 16 ++++++++-------- app/src/main/res/layout/fragment_route.xml | 2 +- .../main/res/layout/fragment_route_detail.xml | 12 ++++++------ app/src/main/res/layout/fragment_statistic.xml | 16 ++++++++++++++-- 6 files changed, 37 insertions(+), 18 deletions(-) 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 30a4caa..0106d59 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/RouteDetailFragment.java @@ -33,7 +33,7 @@ public class RouteDetailFragment extends Fragment { this.route = getArguments().getParcelable("route"); } - this.routeDetailText = view.findViewById(R.id.routeDetailText); + this.routeDetailText = view.findViewById(R.id.reoute_detail_tekst); this.routeDetailText.setText(this.route.getName()); this.imageButton = view.findViewById(R.id.route_detail_back_button); 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 e63a74d..707b719 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/StatisticFragment.java @@ -25,6 +25,7 @@ public class StatisticFragment extends Fragment { private List couponList; private ImageView imageButton; + private ImageView couponButton; @Override @@ -48,6 +49,12 @@ public class StatisticFragment extends Fragment { ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, homeFragment).addToBackStack(null).commit(); }); + this.couponButton = view.findViewById(R.id.coupon_button); + this.couponButton.setOnClickListener(v -> { + CouponFragment couponFragment = new CouponFragment(); + ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit(); + }); + ConstraintLayout constraintLayout = view.findViewById(R.id.Box4); constraintLayout.setOnClickListener(v -> { CouponFragment couponFragment = new CouponFragment(); diff --git a/app/src/main/res/layout-land/fragment_route_detail.xml b/app/src/main/res/layout-land/fragment_route_detail.xml index e13fce8..48263eb 100644 --- a/app/src/main/res/layout-land/fragment_route_detail.xml +++ b/app/src/main/res/layout-land/fragment_route_detail.xml @@ -15,9 +15,9 @@ android:text="@string/start_route" android:textColor="@color/buttonColour" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="@+id/routeDetailText" - app:layout_constraintStart_toStartOf="@+id/routeDetailText" - app:layout_constraintTop_toBottomOf="@+id/routeDetailText" + app:layout_constraintEnd_toEndOf="@+id/reoute_detail_tekst" + app:layout_constraintStart_toStartOf="@+id/reoute_detail_tekst" + app:layout_constraintTop_toBottomOf="@+id/reoute_detail_tekst" app:layout_constraintVertical_bias="0.873" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_route.xml b/app/src/main/res/layout/fragment_route.xml index e7f4abc..f68174e 100644 --- a/app/src/main/res/layout/fragment_route.xml +++ b/app/src/main/res/layout/fragment_route.xml @@ -13,7 +13,7 @@ android:layout_height="wrap_content" android:layout_margin="10dp" android:background="@drawable/ic_back_button_24" - android:text="Back" + android:text="@string/terug" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/fragment_route_detail.xml b/app/src/main/res/layout/fragment_route_detail.xml index bd1d939..e365bd9 100644 --- a/app/src/main/res/layout/fragment_route_detail.xml +++ b/app/src/main/res/layout/fragment_route_detail.xml @@ -23,7 +23,7 @@ android:layout_height="wrap_content" android:text="@string/titel" android:textSize="20sp" - app:layout_constraintBottom_toTopOf="@+id/routeDetailImage" + app:layout_constraintBottom_toTopOf="@+id/route_detail_image" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -32,16 +32,16 @@ android:layout_width="250dp" android:layout_height="250dp" android:layout_margin="40dp" - android:id="@+id/routeDetailImage" + android:id="@+id/route_detail_image" app:layout_constraintTop_toBottomOf="@id/route_detail_back_button" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toTopOf="@id/routeDetailText" + app:layout_constraintBottom_toTopOf="@id/reoute_detail_tekst" /> + app:layout_constraintTop_toBottomOf="@id/route_detail_image" />