From a75b81033fbac33726845e79c1f566303c338215 Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Tue, 5 Jan 2021 10:09:24 +0100 Subject: [PATCH 1/3] Fixed locationList --- .../fragments/LocationDetailFragment.java | 15 ++++++--------- app/src/main/res/layout/fragment_location.xml | 9 +++++---- 2 files changed, 11 insertions(+), 13 deletions(-) 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 62b6313..82bcabb 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/LocationDetailFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/LocationDetailFragment.java @@ -19,20 +19,17 @@ public class LocationDetailFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 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(); -// }); + 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; } diff --git a/app/src/main/res/layout/fragment_location.xml b/app/src/main/res/layout/fragment_location.xml index 7f03472..4816ef1 100644 --- a/app/src/main/res/layout/fragment_location.xml +++ b/app/src/main/res/layout/fragment_location.xml @@ -29,11 +29,12 @@ app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/location_RV" /> + \ No newline at end of file From d63b150275be14a451d35a239adf6f55353f442d Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Tue, 5 Jan 2021 10:47:35 +0100 Subject: [PATCH 2/3] Improved fragments --- app/src/main/res/layout/fragment_coupon.xml | 4 ++- app/src/main/res/layout/fragment_home.xml | 2 +- app/src/main/res/layout/fragment_location.xml | 4 ++- .../res/layout/fragment_location_detail.xml | 8 ++--- .../main/res/layout/fragment_route_detail.xml | 36 +++++++------------ 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/app/src/main/res/layout/fragment_coupon.xml b/app/src/main/res/layout/fragment_coupon.xml index bdbbc67..20baf40 100644 --- a/app/src/main/res/layout/fragment_coupon.xml +++ b/app/src/main/res/layout/fragment_coupon.xml @@ -12,6 +12,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="9dp" + android:layout_marginTop="20dp" android:text="Statistics" android:textSize="20sp" app:layout_constraintStart_toEndOf="@id/couponBackButton" @@ -21,10 +22,11 @@ android:id="@+id/couponBackButton" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginStart="10dp" + android:layout_marginTop="12dp" android:background="@drawable/ic_back_button_24" android:backgroundTint="@color/buttonColour" android:text="Back" - android:layout_margin="10dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index f20aeb6..04010ac 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -6,7 +6,6 @@ android:layout_height="match_parent" tools:context=".fragments.HomeFragment"> - diff --git a/app/src/main/res/layout/fragment_location.xml b/app/src/main/res/layout/fragment_location.xml index 4816ef1..7277118 100644 --- a/app/src/main/res/layout/fragment_location.xml +++ b/app/src/main/res/layout/fragment_location.xml @@ -12,6 +12,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="9dp" + android:layout_marginTop="20dp" android:text="Locations" android:textSize="20sp" app:layout_constraintStart_toEndOf="@id/locationBackButton" @@ -21,10 +22,11 @@ android:id="@+id/locationBackButton" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginStart="10dp" + android:layout_marginTop="12dp" android:background="@drawable/ic_back_button_24" android:backgroundTint="@color/buttonColour" android:text="Back" - android:layout_margin="10dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/fragment_location_detail.xml b/app/src/main/res/layout/fragment_location_detail.xml index 17b7203..c9e0124 100644 --- a/app/src/main/res/layout/fragment_location_detail.xml +++ b/app/src/main/res/layout/fragment_location_detail.xml @@ -44,11 +44,11 @@ android:id="@+id/detail_location_back_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:src="@drawable/ic_back_button_24" + android:layout_marginStart="10dp" + android:layout_marginTop="12dp" android:backgroundTint="@color/primaryColour" - app:layout_constraintBottom_toBottomOf="@+id/detail_location_name" - app:layout_constraintEnd_toStartOf="@+id/detail_location_name" + android:src="@drawable/ic_back_button_24" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/detail_location_name" /> + app:layout_constraintTop_toTopOf="parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_route_detail.xml b/app/src/main/res/layout/fragment_route_detail.xml index 197630c..9eaa3c0 100644 --- a/app/src/main/res/layout/fragment_route_detail.xml +++ b/app/src/main/res/layout/fragment_route_detail.xml @@ -46,36 +46,24 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="20dp" - android:layout_marginBottom="100dp" - app:layout_constraintBottom_toTopOf="@id/startRouteText" + android:layout_marginTop="56dp" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.6" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/routeDetailImage" /> - - - + app:layout_constraintHorizontal_bias="0.498" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/routeDetailText" + app:layout_constraintVertical_bias="0.671" /> + \ No newline at end of file From d53f63a6d797fb2950eb46cf47d7ec13a97b0d4c Mon Sep 17 00:00:00 2001 From: RemoMeijer Date: Tue, 5 Jan 2021 12:02:20 +0100 Subject: [PATCH 3/3] Updated values --- .../com/a1/nextlocation/MainActivity.java | 6 +---- .../fragments/CouponFragment.java | 5 ++-- .../nextlocation/fragments/HomeFragment.java | 7 +----- .../fragments/LocationFragment.java | 6 ++--- .../nextlocation/fragments/RouteFragment.java | 3 +-- .../res/layout-land/fragment_route_detail.xml | 8 +++---- app/src/main/res/layout/activity_main.xml | 24 +++++++++---------- app/src/main/res/layout/coupon_item.xml | 2 +- app/src/main/res/layout/fragment_coupon.xml | 8 +++---- app/src/main/res/layout/fragment_home.xml | 2 +- app/src/main/res/layout/fragment_location.xml | 6 ++--- app/src/main/res/layout/fragment_route.xml | 10 ++++---- .../main/res/layout/fragment_route_detail.xml | 8 +++---- app/src/main/res/layout/fragment_settings.xml | 4 ++-- .../main/res/layout/fragment_statistic.xml | 4 ++-- app/src/main/res/layout/location_item.xml | 2 +- app/src/main/res/layout/route_item.xml | 4 ++-- 17 files changed, 48 insertions(+), 61 deletions(-) diff --git a/app/src/main/java/com/a1/nextlocation/MainActivity.java b/app/src/main/java/com/a1/nextlocation/MainActivity.java index 9ba6645..5c52fcf 100644 --- a/app/src/main/java/com/a1/nextlocation/MainActivity.java +++ b/app/src/main/java/com/a1/nextlocation/MainActivity.java @@ -1,14 +1,10 @@ package com.a1.nextlocation; -import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentTransaction; import android.os.Bundle; -import android.view.MenuItem; -import com.a1.nextlocation.R; import com.a1.nextlocation.fragments.HomeFragment; import com.a1.nextlocation.fragments.RouteFragment; import com.a1.nextlocation.fragments.SettingsFragment; @@ -28,7 +24,7 @@ public class MainActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - BottomNavigationView bottomNav = findViewById(R.id.navbar); + BottomNavigationView bottomNav = findViewById(R.id.navigation_bar); bottomNav.setOnNavigationItemSelectedListener(navListener); LocationListManager.INSTANCE.setContext(this); 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 1faea7f..984e38c 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/CouponFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/CouponFragment.java @@ -1,7 +1,6 @@ package com.a1.nextlocation.fragments; import android.app.AlertDialog; -import android.content.DialogInterface; import android.os.Bundle; import androidx.fragment.app.Fragment; @@ -38,11 +37,11 @@ public class CouponFragment extends Fragment { 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 = view.findViewById(R.id.coupon_recyclerview); this.couponRecyclerView.setHasFixedSize(true); this.layoutManager = new LinearLayoutManager(this.getContext()); - this.imageButton = view.findViewById(R.id.couponBackButton); + this.imageButton = view.findViewById(R.id.coupon_back_button); this.imageButton.setOnClickListener(v -> { StatisticFragment statisticFragment = new StatisticFragment(); ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, statisticFragment).addToBackStack(null).commit(); 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 ffcbc7c..bbc3a60 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java @@ -5,7 +5,6 @@ package com.a1.nextlocation.fragments; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; -import android.content.res.Resources; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; @@ -23,17 +22,13 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import com.a1.nextlocation.R; -import com.a1.nextlocation.data.Route; -import com.a1.nextlocation.recyclerview.CouponListManager; import com.a1.nextlocation.recyclerview.CustomOverlay; import com.a1.nextlocation.recyclerview.LocationListManager; -import com.a1.nextlocation.recyclerview.RouteListManager; import org.osmdroid.api.IMapController; import org.osmdroid.config.Configuration; import org.osmdroid.util.GeoPoint; import org.osmdroid.views.MapView; -import org.osmdroid.views.overlay.Overlay; import org.osmdroid.views.overlay.OverlayItem; import org.osmdroid.views.overlay.compass.CompassOverlay; import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; @@ -87,7 +82,7 @@ public class HomeFragment extends Fragment { Configuration.getInstance().setUserAgentValue(userAgent); // create the map view - mapView = view.findViewById(R.id.mapView); + mapView = view.findViewById(R.id.map_view); mapView.setDestroyMode(false); mapView.setTag("mapView"); mapView.setMultiTouchControls(true); 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 237622d..03afb8e 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/LocationFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/LocationFragment.java @@ -14,11 +14,9 @@ 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 { @@ -38,11 +36,11 @@ public class LocationFragment extends Fragment { View view = inflater.inflate(R.layout.fragment_location, container, false); - this.locationRecyclerView = view.findViewById(R.id.locationRecyclerView); + this.locationRecyclerView = view.findViewById(R.id.location_recyclerview); this.locationRecyclerView.setHasFixedSize(true); this.layoutManager = new LinearLayoutManager(this.getContext()); - this.imageButton = view.findViewById(R.id.locationBackButton); + this.imageButton = view.findViewById(R.id.location_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/java/com/a1/nextlocation/fragments/RouteFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java index 9ac07c3..cef1194 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/RouteFragment.java @@ -16,7 +16,6 @@ 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; public class RouteFragment extends Fragment { @@ -36,7 +35,7 @@ public class RouteFragment extends Fragment { 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 = view.findViewById(R.id.route_recyclerview); this.routeRecyclerView.setHasFixedSize(true); this.layoutManager = new LinearLayoutManager(this.getContext()); 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 b5863ad..ebd2b7e 100644 --- a/app/src/main/res/layout-land/fragment_route_detail.xml +++ b/app/src/main/res/layout-land/fragment_route_detail.xml @@ -13,14 +13,14 @@ android:layout_height="wrap_content" android:layout_margin="10dp" android:background="@drawable/ic_back_button_24" - app:layout_constraintBottom_toBottomOf="@+id/routeTitle" + app:layout_constraintBottom_toBottomOf="@+id/route_title" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/routeTitle" - app:layout_constraintEnd_toStartOf="@id/routeTitle" + app:layout_constraintTop_toTopOf="@+id/route_title" + app:layout_constraintEnd_toStartOf="@id/route_title" /> + android:textSize="25dp" + app:layout_constraintBottom_toBottomOf="@id/top_bar" + app:layout_constraintStart_toEndOf="@id/info_button" + app:layout_constraintTop_toTopOf="@id/top_bar" /> \ No newline at end of file diff --git a/app/src/main/res/layout/coupon_item.xml b/app/src/main/res/layout/coupon_item.xml index 49e3b93..b1b303f 100644 --- a/app/src/main/res/layout/coupon_item.xml +++ b/app/src/main/res/layout/coupon_item.xml @@ -5,7 +5,7 @@ android:layout_height="wrap_content"> + app:layout_constraintTop_toBottomOf="@+id/coupon_back_button" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 04010ac..5a55efa 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -7,7 +7,7 @@ tools:context=".fragments.HomeFragment"> diff --git a/app/src/main/res/layout/fragment_location.xml b/app/src/main/res/layout/fragment_location.xml index 7277118..deed47a 100644 --- a/app/src/main/res/layout/fragment_location.xml +++ b/app/src/main/res/layout/fragment_location.xml @@ -15,11 +15,11 @@ android:layout_marginTop="20dp" android:text="Locations" android:textSize="20sp" - app:layout_constraintStart_toEndOf="@id/locationBackButton" + app:layout_constraintStart_toEndOf="@id/location_back_button" app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/route_back_button" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_route_detail.xml b/app/src/main/res/layout/fragment_route_detail.xml index 9eaa3c0..8b39d88 100644 --- a/app/src/main/res/layout/fragment_route_detail.xml +++ b/app/src/main/res/layout/fragment_route_detail.xml @@ -13,13 +13,13 @@ android:layout_height="wrap_content" android:layout_marginEnd="100dp" android:background="@drawable/ic_back_button_24" - app:layout_constraintBottom_toBottomOf="@id/routeTitle" - app:layout_constraintEnd_toStartOf="@id/routeTitle" + app:layout_constraintBottom_toBottomOf="@id/route_title" + app:layout_constraintEnd_toStartOf="@id/route_title" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@id/routeTitle" /> + app:layout_constraintTop_toTopOf="@id/route_title" /> diff --git a/app/src/main/res/layout/fragment_statistic.xml b/app/src/main/res/layout/fragment_statistic.xml index 7498fa9..5abfdc0 100644 --- a/app/src/main/res/layout/fragment_statistic.xml +++ b/app/src/main/res/layout/fragment_statistic.xml @@ -20,7 +20,7 @@ app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/location_item.xml b/app/src/main/res/layout/location_item.xml index d5cee0b..db57909 100644 --- a/app/src/main/res/layout/location_item.xml +++ b/app/src/main/res/layout/location_item.xml @@ -21,6 +21,6 @@ android:gravity="center" android:text="location" android:textSize="20dp" - app:layout_constraintStart_toEndOf="@+id/routeImage" /> + app:layout_constraintStart_toEndOf="@+id/route_Image" /> \ No newline at end of file diff --git a/app/src/main/res/layout/route_item.xml b/app/src/main/res/layout/route_item.xml index c6f675f..d9091d8 100644 --- a/app/src/main/res/layout/route_item.xml +++ b/app/src/main/res/layout/route_item.xml @@ -9,7 +9,7 @@ @@ -21,7 +21,7 @@ android:text="test text" android:gravity="center" android:textSize="20dp" - app:layout_constraintStart_toEndOf="@+id/routeImage" + app:layout_constraintStart_toEndOf="@+id/route_Image" /> \ No newline at end of file