pull/7/head
Baptiiiiste 2 years ago
parent f97fdde0b0
commit 689e46869b

@ -5,9 +5,20 @@ import uca.baptistearthur.geocaching.data.Database
class RTApplication: Application() {
// val db: Database by lazy {
// Database.getInstance(this)
// }
// val db: Database by lazy {
// Database.getInstance(this)
// }
//
// lateinit var db: Database
//
// override fun onCreate() {
// super.onCreate()
//
// // Initialiser la propriété db ici
// db = Database.getInstance(this) as Database
// }
}

@ -3,7 +3,6 @@ package uca.baptistearthur.geocaching.services
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import uca.baptistearthur.geocaching.R
import uca.baptistearthur.geocaching.ui.fragment.DetailledRoadTripFragment
class FragmentService {

@ -1,67 +0,0 @@
package uca.baptistearthur.geocaching.ui.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import uca.baptistearthur.geocaching.R
import uca.baptistearthur.geocaching.model.RoadTripEntity
import uca.baptistearthur.geocaching.recyclerview.PlacesAdapter
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
/**
* A simple [Fragment] subclass.
* Use the [RoadTripEntity.newInstance] factory method to
* create an instance of this fragment.
*/
class DetailledRoadTripFragment(val roadTrip: RoadTripEntity): Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null
private var placesRecyclerView : RecyclerView? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_detailled_roadtrip, container, false)
placesRecyclerView = view?.findViewById(R.id.recyclerViewPlacesList)
placesRecyclerView?.adapter = PlacesAdapter(roadTrip.places)
placesRecyclerView?.layoutManager = LinearLayoutManager(context)
return view
}
companion object {
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment List.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
RoadTripFragment().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
}

@ -19,6 +19,8 @@ import android.location.LocationListener
import android.util.Log
import android.widget.ProgressBar
import androidx.activity.result.contract.ActivityResultContracts
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.osmdroid.bonuspack.routing.OSRMRoadManager
import org.osmdroid.bonuspack.routing.RoadManager
import org.osmdroid.config.IConfigurationProvider
@ -30,19 +32,26 @@ import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
import uca.baptistearthur.geocaching.R
import uca.baptistearthur.geocaching.recyclerview.PlacesAdapter
import uca.baptistearthur.geocaching.ui.overlay.AddMarkerOverlay
import uca.baptistearthur.geocaching.ui.overlay.RecenterOverlay
class RoadtripDetail : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
private var placesRecyclerView : RecyclerView? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
Log.d("GeoMap", "MAP ON CREATE VIEW")
// Inflate the layout for this fragment
val view = inflater.inflate(R.layout.roadtrip_detail, container, false)
// val roadTrip = // récupérer le roadtrip cliqué
// placesRecyclerView = view?.findViewById(R.id.recyclerViewPlacesList)
// placesRecyclerView?.adapter = PlacesAdapter(roadTrip.places)
// placesRecyclerView?.layoutManager = LinearLayoutManager(context)
return view
}
}

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.fragment.DetailledRoadTripFragment"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TMP/ Roadtrip Name"
android:background="@color/main_turquoise_200"
android:textColor="@color/main_turquoise_50"
android:padding="10dp"
android:textSize="20sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/placesList"
android:textColor="@color/main_turquoise_200"
android:padding="5dp"
android:textSize="17sp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewPlacesList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Button
android:id="@+id/btnDeleteRoadTrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btnDeleteRoadTrip"
android:backgroundTint="@color/main_turquoise_500"
android:layout_margin="10dp"/>
</LinearLayout>

@ -1,15 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.fragment.RoadtripDetail">
tools:context=".ui.fragment.RoadtripDetail"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:id="@+id/roadTripDetailTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="DETAIL"/>
android:text="TMP/ Roadtrip Name"
android:background="@color/main_turquoise_200"
android:textColor="@color/main_turquoise_50"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:textSize="20sp"/>
</FrameLayout>
<TextView
android:id="@+id/roadTripDetailDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TMP/ Date"
android:background="@color/main_turquoise_200"
android:textColor="@color/main_turquoise_50"
android:textSize="15sp"
android:paddingLeft="10dp"
android:paddingBottom="5dp"/>
<org.osmdroid.views.MapView
android:id="@+id/roadTripDetailMapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/placesList"
android:textColor="@color/main_turquoise_200"
android:padding="5dp"
android:textSize="17sp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewPlacesList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Button
android:id="@+id/btnDeleteRoadTrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btnDeleteRoadTrip"
android:backgroundTint="@color/main_turquoise_500"
android:layout_margin="10dp"/>
</LinearLayout>
Loading…
Cancel
Save