Compare commits
23 Commits
Author | SHA1 | Date |
---|---|---|
|
872cbea47c | 2 years ago |
|
6b5f6b0f1c | 2 years ago |
|
ec29898d91 | 2 years ago |
|
4b4f1de6b7 | 2 years ago |
|
d2f6389123 | 2 years ago |
|
9cee2c6512 | 2 years ago |
|
334ab83aae | 2 years ago |
|
f2083a33eb | 2 years ago |
|
4e6ca95857 | 2 years ago |
![]() |
b8e5a6e5a3 | 2 years ago |
![]() |
aea9a3114e | 2 years ago |
![]() |
b89dfad74a | 2 years ago |
|
fd33116210 | 2 years ago |
|
ab028cdebe | 2 years ago |
![]() |
2b7ccb39d8 | 2 years ago |
![]() |
fd20790e68 | 2 years ago |
![]() |
fa2a580c63 | 2 years ago |
![]() |
3552beba2f | 2 years ago |
![]() |
4942de0bd5 | 2 years ago |
|
9b9c71474f | 2 years ago |
|
e470e37101 | 2 years ago |
|
8e1e373572 | 2 years ago |
|
63100d9f98 | 2 years ago |
@ -0,0 +1 @@
|
||||
Geocaching
|
After Width: | Height: | Size: 352 KiB |
@ -1,5 +1,61 @@
|
||||
J'ai pas fait grand chose car j'ai eu masse problème avec le projet, il a fallut modifier plein de choses dans les settings graddle.
|
||||
<p align="center">
|
||||
<img src="Documentation/banner.png" />
|
||||
</p>
|
||||
|
||||

|
||||

|
||||
</br>
|
||||
|
||||
|
||||
**RoadTrip** est une application mobile Android qui permet aux utilisateurs de créer des itinéraires de voyage.
|
||||
|
||||

|
||||
|
||||
|
||||
## 🪶 Fonctionnalités
|
||||
|
||||
Lors de votre arrivée sur l'application, vous retrouverez une carte avec votre emplacement actuel. </br>Naviguez sur la carte pour découvrir vos environs.
|
||||
|
||||
Appuyez 2 fois sur la carte pour créer un point d'intérêt, ajoutez en plusieurs afin de construire un itinéraire.
|
||||
|
||||
Validez ensuite votre voyage en cliquant sur le bouton ✅ en bas à gauche de l'écran et donnez lui un nom.
|
||||
|
||||
Retrouvez vos voyages dans l'onglet "Roadtrips" en bas de l'écran.
|
||||
|
||||
Accédez aux informations de votre voyage en cliquant dessus dans la liste déroulante. </br>Vous retrouverez la liste des points d'intérêts que vous avez ajouté, ainsi que les adresses de chacun d'entre eux.
|
||||
|
||||
Vous pouvez supprimer un voyage à tout moment avec le bouton en bas de votre écran</br>Ou vous pouvez l'éditer en rajoutant des points sur la carte et en validant.
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
## 💽 Lancer l'application
|
||||
|
||||
Une fois le dépot cloné, vous pourrez lancer l'application sur votre téléphone Android grâce aux outils fournis par Android Studio. Si vous n'avez pas de téléphone Android, vous pouvez utiliser un émulateur.
|
||||
|
||||

|
||||
|
||||
## 🤖 Made by
|
||||
|
||||
Arthur VALIN : **Arthur.VALIN@etu.uca.fr**
|
||||
|
||||
<a href = "https://codefirst.iut.uca.fr/git/arthur.valin">
|
||||
<img src ="https://codefirst.iut.uca.fr/git/avatars/041c57af1e1d1e855876d8abb5f1c143?size=870" height="50px">
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Baptiste BONNEAU : **Baptiste.BONNEAU@etu.uca.fr**
|
||||
|
||||
<a href = "https://codefirst.iut.uca.fr/git/baptiste.bonneau">
|
||||
<img src ="https://codefirst.iut.uca.fr/git/avatars/e47d41c01439fc439a23cf6843310b05?size=870" height="50px">
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
J'ai laissé des commentaires dans la vue
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 11 KiB |
@ -1,24 +1,10 @@
|
||||
package uca.baptistearthur.geocaching.application
|
||||
|
||||
import android.app.Application
|
||||
import uca.baptistearthur.geocaching.data.Database
|
||||
import uca.baptistearthur.geocaching.data.BDD
|
||||
|
||||
class RTApplication: Application() {
|
||||
|
||||
// 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
|
||||
// }
|
||||
|
||||
val db: BDD by lazy { BDD.getInstance(this) }
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package uca.baptistearthur.geocaching.model
|
||||
|
||||
data class Address(
|
||||
val country: String,
|
||||
val displayName: String)
|
@ -1,6 +1,18 @@
|
||||
package uca.baptistearthur.geocaching.model
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.*
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import uca.baptistearthur.geocaching.network.AddressNetwork
|
||||
|
||||
data class Place(
|
||||
val latitude: Double,
|
||||
val longitude: Double
|
||||
)
|
||||
class Place(private val lat: Double,
|
||||
private val lon: Double,
|
||||
var address: Address = Address("unknown", "unknown"))
|
||||
: GeoPoint(lat, lon){
|
||||
suspend fun initAddress() {
|
||||
AddressNetwork.retrofit.let {
|
||||
CoroutineScope(Dispatchers.IO).async {
|
||||
address = it.getAddress(lat, lon)
|
||||
}.await()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package uca.baptistearthur.geocaching.network
|
||||
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.Query
|
||||
import uca.baptistearthur.geocaching.model.Address
|
||||
|
||||
interface AddressAPI {
|
||||
@GET("/v1/reverse")
|
||||
suspend fun getAddress(
|
||||
@Query("lat") lat: Double,
|
||||
@Query("lon") lon: Double
|
||||
): Address
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package uca.baptistearthur.geocaching.network
|
||||
|
||||
import android.util.Log
|
||||
import com.google.gson.JsonDeserializationContext
|
||||
import com.google.gson.JsonDeserializer
|
||||
import com.google.gson.JsonElement
|
||||
import uca.baptistearthur.geocaching.model.Address
|
||||
import java.lang.reflect.Type
|
||||
|
||||
class AddressDeserializer : JsonDeserializer<Address> {
|
||||
|
||||
override fun deserialize(
|
||||
json: JsonElement?,
|
||||
typeOfT: Type?,
|
||||
context: JsonDeserializationContext?
|
||||
): Address = json?.asJsonObject!!.let{
|
||||
Address(
|
||||
it.get("address").asJsonObject.get("country").asString,
|
||||
it.get("display_name").asString
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package uca.baptistearthur.geocaching.network
|
||||
|
||||
import com.google.gson.GsonBuilder
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Converter
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import uca.baptistearthur.geocaching.model.Address
|
||||
import java.lang.reflect.Type
|
||||
|
||||
|
||||
object AddressNetwork {
|
||||
|
||||
private val API_Info = object {
|
||||
val base_url = "https://forward-reverse-geocoding.p.rapidapi.com/v1/reverse/"
|
||||
val key = "19516a9900mshce10de76f99976bp10f192jsn8c8d82222baa"
|
||||
}
|
||||
|
||||
private val rateLimiter = object {
|
||||
val maxRequestsPerSecond = 2
|
||||
val intervalInMillis = (1000.0 / maxRequestsPerSecond).toLong()
|
||||
var lastRequestTime: Long = 0
|
||||
}
|
||||
|
||||
val rateLimitInterceptor = Interceptor { chain ->
|
||||
val now = System.currentTimeMillis()
|
||||
val elapsed = now - rateLimiter.lastRequestTime
|
||||
if (elapsed < rateLimiter.intervalInMillis) {
|
||||
Thread.sleep(rateLimiter.intervalInMillis - elapsed)
|
||||
}
|
||||
rateLimiter.lastRequestTime = System.currentTimeMillis()
|
||||
|
||||
chain.proceed(chain.request())
|
||||
}
|
||||
private val interceptor = HttpLoggingInterceptor().apply {
|
||||
level = HttpLoggingInterceptor.Level.BODY
|
||||
}
|
||||
|
||||
private val gson = GsonBuilder().apply {
|
||||
registerTypeAdapter(Address::class.java, AddressDeserializer())
|
||||
}.create()
|
||||
|
||||
private val client = OkHttpClient.Builder()
|
||||
.addInterceptor { chain ->
|
||||
val request = chain.request().newBuilder()
|
||||
.addHeader("X-RapidAPI-Key", API_Info.key)
|
||||
.build()
|
||||
chain.proceed(request)
|
||||
}
|
||||
.addInterceptor(interceptor)
|
||||
.addInterceptor(rateLimitInterceptor)
|
||||
.build()
|
||||
|
||||
val retrofit: AddressAPI by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(API_Info.base_url)
|
||||
.client(client)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build()
|
||||
.create(AddressAPI::class.java)
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package uca.baptistearthur.geocaching.services
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import uca.baptistearthur.geocaching.R
|
||||
|
||||
class FragmentService {
|
||||
|
||||
fun loadFragment(fragment: Fragment, supportFragmentManager: FragmentManager){
|
||||
val transaction = supportFragmentManager.beginTransaction()
|
||||
transaction.replace(R.id.fragment_container, fragment)
|
||||
transaction.commit()
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package uca.baptistearthur.geocaching.ui.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import org.osmdroid.bonuspack.routing.OSRMRoadManager
|
||||
import org.osmdroid.util.BoundingBox
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import uca.baptistearthur.geocaching.model.RoadTripEntity
|
||||
import uca.baptistearthur.geocaching.ui.overlay.EditMarkerOverlay
|
||||
import kotlin.math.ln
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.sqrt
|
||||
|
||||
|
||||
class EditRoadtripMap : Map() {
|
||||
|
||||
var roadTrip: RoadTripEntity? = null
|
||||
set(value) {
|
||||
roadTrip?:
|
||||
value?.let {
|
||||
addEditMarkerOverlay(value)
|
||||
getMapParams(value).let{
|
||||
map.controller.setCenter(it.first)
|
||||
map.controller.setZoom(it.second)
|
||||
}
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
private fun addEditMarkerOverlay(roadTrip: RoadTripEntity){
|
||||
val editMarkerOverlay = EditMarkerOverlay(OSRMRoadManager(context, userAgent), roadTrip)
|
||||
editMarkerOverlay.addPlaces(roadTrip.places, map)
|
||||
map.overlays.add(editMarkerOverlay);
|
||||
}
|
||||
|
||||
private fun getMapParams(roadTrip: RoadTripEntity): Pair<GeoPoint, Double>{
|
||||
val boundingBox = BoundingBox.fromGeoPoints(roadTrip.places)
|
||||
val maxDistance = 7000000.0
|
||||
val logZoom = (defaultZoomLevel - minimumZoomLevel) * ln(boundingBox.diagonalLengthInMeters) / ln(maxDistance)
|
||||
val zoomLevel = (defaultZoomLevel - logZoom).coerceIn(minimumZoomLevel, defaultZoomLevel)
|
||||
return Pair(boundingBox.centerWithDateLine, zoomLevel)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package uca.baptistearthur.geocaching.ui.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.LocationManager
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import org.osmdroid.views.MapView
|
||||
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
||||
import android.location.LocationListener
|
||||
import android.util.Log
|
||||
import android.widget.ProgressBar
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import org.osmdroid.bonuspack.routing.OSRMRoadManager
|
||||
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider
|
||||
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
|
||||
import uca.baptistearthur.geocaching.R
|
||||
import uca.baptistearthur.geocaching.ui.overlay.AddMarkerOverlay
|
||||
import uca.baptistearthur.geocaching.ui.overlay.MarkerOverlay
|
||||
import uca.baptistearthur.geocaching.ui.overlay.NewRoadtripOverlay
|
||||
import uca.baptistearthur.geocaching.ui.overlay.RecenterOverlay
|
||||
|
||||
class MyLocationMap : Map() {
|
||||
|
||||
private lateinit var spinner: ProgressBar
|
||||
private lateinit var locationManager: LocationManager
|
||||
private var isMapCentered = false;
|
||||
|
||||
private val locationListener = LocationListener { location ->
|
||||
val geoPoint = GeoPoint(location.latitude, location.longitude)
|
||||
if(!isMapCentered){
|
||||
map.controller.setCenter(geoPoint)
|
||||
spinner.visibility=View.GONE;
|
||||
isMapCentered=true;
|
||||
}
|
||||
map.invalidate()
|
||||
}
|
||||
|
||||
private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()){}
|
||||
|
||||
private fun displaySpinner(view: View){
|
||||
spinner = view.findViewById(R.id.mapLoading)
|
||||
spinner.visibility=View.VISIBLE
|
||||
if (ContextCompat.checkSelfPermission(requireActivity(), ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissionLauncher.launch(ACCESS_FINE_LOCATION)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addMapOverlays(mapView: MapView){
|
||||
super.addMapOverlays(mapView)
|
||||
Log.d("GeoMap", "MyLocationOverlay")
|
||||
|
||||
// Recenter Overlay
|
||||
val recenter = RecenterOverlay(GpsMyLocationProvider(context), map)
|
||||
recenter.enableMyLocation()
|
||||
map.overlays.add(recenter);
|
||||
|
||||
// My Location Overlay
|
||||
val myLocation = MyLocationNewOverlay(GpsMyLocationProvider(context), map)
|
||||
myLocation.enableMyLocation()
|
||||
map.overlays.add(myLocation)
|
||||
|
||||
// Add Marker Overlay
|
||||
val addMarker = AddMarkerOverlay(OSRMRoadManager(context, userAgent))
|
||||
map.overlays.add(addMarker);
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
Log.d("GeoMap", "MAP ON CREATE VIEW")
|
||||
val view = inflater.inflate(R.layout.fragment_map, container, false)
|
||||
map = view.findViewById(R.id.mapView)
|
||||
configureMap()
|
||||
displaySpinner(view)
|
||||
return view
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
Log.d("GeoMap", "MAP RESUME")
|
||||
if (ContextCompat.checkSelfPermission(requireActivity(), ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
locationManager = requireActivity().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0f, locationListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
Log.d("GeoMap", "MAP PAUSE")
|
||||
if (ContextCompat.checkSelfPermission(requireActivity(), ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
locationManager = requireActivity().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
locationManager.removeUpdates(locationListener)
|
||||
isMapCentered=false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,76 +1,49 @@
|
||||
package uca.baptistearthur.geocaching.ui.fragment
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import uca.baptistearthur.geocaching.R
|
||||
import uca.baptistearthur.geocaching.data.Stub
|
||||
import uca.baptistearthur.geocaching.application.RTApplication
|
||||
import uca.baptistearthur.geocaching.model.Place
|
||||
import uca.baptistearthur.geocaching.model.RoadTripEntity
|
||||
import uca.baptistearthur.geocaching.recyclerview.RoadTripAdapter
|
||||
import uca.baptistearthur.geocaching.viewModels.RoadTripViewModel
|
||||
import uca.baptistearthur.geocaching.viewModels.RoadTripViewModelFactory
|
||||
import java.util.*
|
||||
|
||||
// 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 RoadTripFragment : Fragment() {
|
||||
// TODO: Rename and change types of parameters
|
||||
private var param1: String? = null
|
||||
private var param2: String? = null
|
||||
private var model = Stub().load()
|
||||
private var roadTripRecyclerView : RecyclerView? = null
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
param1 = it.getString(ARG_PARAM1)
|
||||
param2 = it.getString(ARG_PARAM2)
|
||||
}
|
||||
private val roadTripViewModel: RoadTripViewModel by viewModels<RoadTripViewModel> {
|
||||
RoadTripViewModelFactory((requireActivity().application as RTApplication).db.roadTripDAO())
|
||||
}
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_roadtrip, container, false)
|
||||
|
||||
roadTripRecyclerView = view?.findViewById(R.id.recyclerViewRoadTripList)
|
||||
roadTripRecyclerView?.adapter = RoadTripAdapter(model, findNavController())
|
||||
|
||||
roadTripViewModel.getAllRoadTrips().observe(viewLifecycleOwner, { roadTrips ->
|
||||
|
||||
if(roadTrips.isEmpty()){
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.noRoadTripFound,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}else roadTripRecyclerView?.adapter = RoadTripAdapter(roadTrips, findNavController())
|
||||
})
|
||||
|
||||
roadTripRecyclerView?.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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,91 +1,8 @@
|
||||
package uca.baptistearthur.geocaching.ui.overlay
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import androidx.core.content.ContextCompat
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.osmdroid.bonuspack.routing.RoadManager
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import org.osmdroid.views.MapView
|
||||
import org.osmdroid.views.overlay.Overlay
|
||||
import org.osmdroid.views.overlay.Polyline
|
||||
import uca.baptistearthur.geocaching.R
|
||||
|
||||
|
||||
class AddMarkerOverlay(val roadManager: RoadManager) : Overlay() {
|
||||
|
||||
private var locations: MutableSet<PlaceMarker> = mutableSetOf()
|
||||
private lateinit var roadOverlay: Polyline
|
||||
private var newRoadtripOverlayVisible = false;
|
||||
override fun onDoubleTap(e: MotionEvent?, mapView: MapView?): Boolean {
|
||||
Log.d("GeoMap", "Longpress")
|
||||
val proj = mapView?.projection;
|
||||
if(proj!=null){
|
||||
val loc = proj.fromPixels(e?.x?.toInt()!!, e.y.toInt() ) as GeoPoint
|
||||
val marker = PlaceMarker(mapView, this)
|
||||
marker.position = loc
|
||||
if(locations.isNotEmpty()) locations.last().setDefaultIcon()
|
||||
locations.add(marker)
|
||||
locations.forEach{ it.closeInfoWindow()}
|
||||
computeIcons(mapView.context)
|
||||
mapView.overlays.add(marker)
|
||||
computeRoad(mapView)
|
||||
computeNewRoadtripOverlay(mapView);
|
||||
mapView.invalidate()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
fun computeIcons(context: Context){
|
||||
if(locations.isNotEmpty()) {
|
||||
val flagIcon = ContextCompat.getDrawable(context, R.drawable.roadtrip_marker)!!
|
||||
locations.last().icon = flagIcon
|
||||
locations.first().icon = flagIcon
|
||||
}
|
||||
}
|
||||
|
||||
fun computeRoad(mapView: MapView) {
|
||||
mapView.overlays.remove(mapView.overlays.find { it is Polyline})
|
||||
if (locations.size > 1) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val road = roadManager.getRoad(ArrayList(locations.map{it -> it.position}))
|
||||
withContext(Dispatchers.Main) {
|
||||
roadOverlay = RoadManager.buildRoadOverlay(road)
|
||||
mapView.overlays.add(roadOverlay)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun computeNewRoadtripOverlay(mapView: MapView){
|
||||
if (locations.size > 1) {
|
||||
if(!newRoadtripOverlayVisible) {
|
||||
mapView.overlays.add(NewRoadtripOverlay(locations))
|
||||
newRoadtripOverlayVisible = true
|
||||
}
|
||||
}else{
|
||||
Log.d("GeoRoad", "TRY DELETE ROADTRIP OVERLAY" + locations.size)
|
||||
Log.d("GeoRoad", ""+mapView.overlays.size)
|
||||
mapView.overlays.remove(mapView.overlays.find { it is NewRoadtripOverlay})
|
||||
newRoadtripOverlayVisible=false
|
||||
}
|
||||
}
|
||||
fun removeMarker(placeMarker: PlaceMarker) = locations.remove(placeMarker);
|
||||
fun getMarkerLabel(placeMarker: PlaceMarker) =
|
||||
when (placeMarker) {
|
||||
locations.first() -> {
|
||||
"Start"
|
||||
}
|
||||
locations.last() -> {
|
||||
"Finish"
|
||||
}
|
||||
else -> {
|
||||
"Step " + locations.indexOf(placeMarker);
|
||||
}
|
||||
}
|
||||
import uca.baptistearthur.geocaching.model.RoadTripEntity
|
||||
|
||||
class AddMarkerOverlay(roadManager: RoadManager) : MarkerOverlay<NewRoadtripOverlay>(roadManager) {
|
||||
override fun createNewConfirmationOverlay(): NewRoadtripOverlay = NewRoadtripOverlay(places)
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package uca.baptistearthur.geocaching.ui.overlay
|
||||
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.osmdroid.views.MapView
|
||||
import org.osmdroid.views.overlay.Overlay
|
||||
import uca.baptistearthur.geocaching.R
|
||||
|
||||
abstract class ConfirmationOverlay(val points: MutableCollection<PlaceMarker>) : Overlay() {
|
||||
|
||||
private var circleRectF=RectF()
|
||||
|
||||
override fun draw(canvas: Canvas, mapView: MapView, shadow: Boolean) {
|
||||
|
||||
val circleSize = 300f
|
||||
val circlePadding = 20f
|
||||
val circleY = canvas.height - circleSize - circlePadding
|
||||
circleRectF= RectF(circlePadding, circleY, circlePadding + circleSize, circleY + circleSize)
|
||||
|
||||
val paint = Paint().apply {
|
||||
color = Color.WHITE
|
||||
style = Paint.Style.FILL
|
||||
}
|
||||
|
||||
canvas.drawCircle(
|
||||
circleSize / 2 + circlePadding,
|
||||
circleY + circleSize / 2,
|
||||
circleSize / 2,
|
||||
paint
|
||||
)
|
||||
|
||||
val iconSize = 180
|
||||
val icon = ContextCompat.getDrawable(mapView.context, R.drawable.check)
|
||||
|
||||
val iconX = (circleSize / 2 - iconSize / 2 + circlePadding).toInt()
|
||||
val iconY = (circleY + circleSize / 2 - iconSize / 2).toInt()
|
||||
|
||||
icon?.setBounds(iconX, iconY, iconX + iconSize, iconY + iconSize)
|
||||
icon?.draw(canvas)
|
||||
}
|
||||
|
||||
override fun onSingleTapConfirmed(e: MotionEvent?, mapView: MapView?) =
|
||||
if (e != null && circleRectF.contains(e.x, e.y)) {
|
||||
mapView?.let{
|
||||
confirm(it)
|
||||
}
|
||||
true
|
||||
}else{
|
||||
false
|
||||
}
|
||||
|
||||
abstract fun confirm(mapView: MapView)
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package uca.baptistearthur.geocaching.ui.overlay
|
||||
|
||||
import android.graphics.Canvas
|
||||
import org.osmdroid.bonuspack.routing.RoadManager
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import org.osmdroid.views.MapView
|
||||
import uca.baptistearthur.geocaching.model.RoadTripEntity
|
||||
|
||||
class EditMarkerOverlay(roadManager: RoadManager, var roadTrip: RoadTripEntity) : MarkerOverlay<EditRoadtripOverlay>(roadManager) {
|
||||
|
||||
fun addPlaces(geopoints: Collection<GeoPoint>, mapView: MapView)=
|
||||
geopoints.forEach {
|
||||
addMarkerAtGeopoint(it, mapView)
|
||||
}
|
||||
|
||||
override fun createNewConfirmationOverlay(): EditRoadtripOverlay = EditRoadtripOverlay(places, roadTrip)
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package uca.baptistearthur.geocaching.ui.overlay
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.text.InputFilter
|
||||
import android.util.Log
|
||||
import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelStoreOwner
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import org.osmdroid.views.MapView
|
||||
import uca.baptistearthur.geocaching.R
|
||||
import uca.baptistearthur.geocaching.application.RTApplication
|
||||
import uca.baptistearthur.geocaching.model.Place
|
||||
import uca.baptistearthur.geocaching.model.RoadTripEntity
|
||||
import uca.baptistearthur.geocaching.viewModels.RoadTripViewModel
|
||||
import uca.baptistearthur.geocaching.viewModels.RoadTripViewModelFactory
|
||||
import java.util.*
|
||||
|
||||
class EditRoadtripOverlay(points: MutableCollection<PlaceMarker>, val roadTripEntity: RoadTripEntity) : ConfirmationOverlay(points) {
|
||||
|
||||
fun getRoadTripViewModelFromOverlay(overlayContext: Context): RoadTripViewModel {
|
||||
val roadTripDao = (overlayContext.applicationContext as RTApplication).db.roadTripDAO()
|
||||
val viewModelFactory = RoadTripViewModelFactory(roadTripDao)
|
||||
return ViewModelProvider(overlayContext as ViewModelStoreOwner, viewModelFactory).get(
|
||||
RoadTripViewModel::class.java)
|
||||
}
|
||||
|
||||
private fun onValidation(mapView: MapView, input: String) {
|
||||
val places: MutableList<Place> =
|
||||
points.map { Place(it.position.latitude, it.position.longitude) }.toMutableList()
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
places.filter { it.address.displayName === "unknown" }.forEach { it.initAddress() }
|
||||
val newRoadTrip = RoadTripEntity(
|
||||
id = roadTripEntity.id,
|
||||
name = input,
|
||||
date = roadTripEntity.date,
|
||||
places = places
|
||||
)
|
||||
getRoadTripViewModelFromOverlay(mapView.context).deleteRoadTrip(roadTripEntity)
|
||||
getRoadTripViewModelFromOverlay(mapView.context).insertRoadTrip(newRoadTrip)
|
||||
Toast.makeText(
|
||||
mapView.context,
|
||||
R.string.changesSaved,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
override fun confirm(mapView: MapView) {
|
||||
val input = EditText(mapView.context)
|
||||
input.setText(roadTripEntity.name)
|
||||
input.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(50))
|
||||
|
||||
val dialog = AlertDialog.Builder(mapView.context)
|
||||
.setTitle(R.string.newRoadtripDialog)
|
||||
.setView(input)
|
||||
.setPositiveButton(R.string.confirm) { _, _ ->
|
||||
val userInput = input.text.toString()
|
||||
if (userInput.isNotBlank()) {
|
||||
onValidation(mapView, input.text.toString())
|
||||
} else {
|
||||
Toast.makeText(
|
||||
mapView.context,
|
||||
R.string.emptyTextError,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) { dialog, _ ->
|
||||
dialog.cancel()
|
||||
}
|
||||
.create()
|
||||
dialog.show()
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package uca.baptistearthur.geocaching.ui.overlay
|
||||
|
||||
import android.content.Context
|
||||
import android.view.MotionEvent
|
||||
import androidx.core.content.ContextCompat
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.osmdroid.bonuspack.routing.RoadManager
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import org.osmdroid.views.MapView
|
||||
import org.osmdroid.views.overlay.Overlay
|
||||
import org.osmdroid.views.overlay.Polyline
|
||||
import uca.baptistearthur.geocaching.R
|
||||
|
||||
|
||||
abstract class MarkerOverlay<T : ConfirmationOverlay>(val roadManager: RoadManager) : Overlay() {
|
||||
|
||||
protected var places: MutableSet<PlaceMarker> = mutableSetOf()
|
||||
private lateinit var roadOverlay: Polyline
|
||||
private var confirmationOverlayIsVisible = false;
|
||||
|
||||
protected fun addMarkerAtGeopoint(geoPoint: GeoPoint, mapView: MapView){
|
||||
val marker = PlaceMarker(mapView, this)
|
||||
marker.position = geoPoint
|
||||
if(places.isNotEmpty()) places.last().setDefaultIcon()
|
||||
places.add(marker)
|
||||
places.forEach{ it.closeInfoWindow()}
|
||||
computeIcons(mapView.context)
|
||||
mapView.overlays.add(marker)
|
||||
computeRoad(mapView)
|
||||
computeConfirmationOverlay(mapView);
|
||||
mapView.invalidate()
|
||||
}
|
||||
|
||||
override fun onDoubleTap(e: MotionEvent?, mapView: MapView?): Boolean {
|
||||
|
||||
val proj = mapView?.projection;
|
||||
if(proj!=null){
|
||||
val geoPoint = proj.fromPixels(e?.x?.toInt()!!, e.y.toInt() ) as GeoPoint
|
||||
addMarkerAtGeopoint(geoPoint, mapView)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
fun computeIcons(context: Context) {
|
||||
if (places.isNotEmpty()) {
|
||||
val flagIcon = ContextCompat.getDrawable(context, R.drawable.roadtrip_marker)!!
|
||||
places.last().icon = flagIcon
|
||||
places.first().icon = flagIcon
|
||||
}
|
||||
}
|
||||
|
||||
fun computeRoad(mapView: MapView) {
|
||||
mapView.overlays.removeAll{ it is Polyline }
|
||||
if (places.size > 1) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val road = roadManager.getRoad(ArrayList(places.map{it.position}))
|
||||
withContext(Dispatchers.Main) {
|
||||
roadOverlay = RoadManager.buildRoadOverlay(road)
|
||||
mapView.overlays.add(roadOverlay)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract fun createNewConfirmationOverlay(): T
|
||||
|
||||
fun computeConfirmationOverlay(mapView: MapView){
|
||||
if (places.size > 1) {
|
||||
if(!confirmationOverlayIsVisible) {
|
||||
mapView.overlays.add(createNewConfirmationOverlay())
|
||||
confirmationOverlayIsVisible = true
|
||||
}
|
||||
}else{
|
||||
mapView.overlays.removeAll{ it is ConfirmationOverlay }
|
||||
confirmationOverlayIsVisible=false
|
||||
}
|
||||
}
|
||||
fun removeMarker(placeMarker: PlaceMarker) = places.remove(placeMarker);
|
||||
fun getMarkerLabel(placeMarker: PlaceMarker) =
|
||||
when (placeMarker) {
|
||||
places.first() -> {
|
||||
"Start"
|
||||
}
|
||||
places.last() -> {
|
||||
"Finish"
|
||||
}
|
||||
else -> {
|
||||
"Step " + places.indexOf(placeMarker);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +1,88 @@
|
||||
package uca.baptistearthur.geocaching.ui.overlay
|
||||
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.text.InputFilter
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelStoreOwner
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
import org.osmdroid.views.MapView
|
||||
import org.osmdroid.views.overlay.Overlay
|
||||
import org.osmdroid.views.overlay.Polyline
|
||||
import uca.baptistearthur.geocaching.R
|
||||
import uca.baptistearthur.geocaching.application.RTApplication
|
||||
import uca.baptistearthur.geocaching.model.Address
|
||||
import uca.baptistearthur.geocaching.model.Place
|
||||
import uca.baptistearthur.geocaching.model.RoadTripEntity
|
||||
import uca.baptistearthur.geocaching.viewModels.RoadTripViewModel
|
||||
import uca.baptistearthur.geocaching.viewModels.RoadTripViewModelFactory
|
||||
import java.util.*
|
||||
|
||||
|
||||
class NewRoadtripOverlay(val points: Collection<PlaceMarker>) : Overlay() {
|
||||
class NewRoadtripOverlay(points: MutableCollection<PlaceMarker>) : ConfirmationOverlay(points) {
|
||||
|
||||
private var circleRectF=RectF()
|
||||
|
||||
override fun draw(canvas: Canvas, mapView: MapView, shadow: Boolean) {
|
||||
fun getRoadTripViewModelFromOverlay(overlayContext: Context): RoadTripViewModel {
|
||||
val roadTripDao = (overlayContext.applicationContext as RTApplication).db.roadTripDAO()
|
||||
val viewModelFactory = RoadTripViewModelFactory(roadTripDao)
|
||||
return ViewModelProvider(overlayContext as ViewModelStoreOwner, viewModelFactory).get(RoadTripViewModel::class.java)
|
||||
}
|
||||
|
||||
val circleSize = 300f
|
||||
val circlePadding = 20f
|
||||
val circleY = canvas.height - circleSize - circlePadding
|
||||
circleRectF= RectF(circlePadding, circleY, circlePadding + circleSize, circleY + circleSize)
|
||||
private fun clearMap(mapView: MapView){
|
||||
mapView.overlays.removeAll { it is PlaceMarker || it is Polyline || it is NewRoadtripOverlay }
|
||||
}
|
||||
|
||||
val paint = Paint().apply {
|
||||
color = Color.WHITE
|
||||
style = Paint.Style.FILL
|
||||
private fun onValidation(mapView: MapView, input: String){
|
||||
val places: MutableList<Place> = points.map { Place(it.position.latitude, it.position.longitude) }.toMutableList()
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
places.forEach{
|
||||
it.initAddress()
|
||||
Log.d("GeoMap", it.address.displayName)
|
||||
}
|
||||
val newRoadTrip = RoadTripEntity(
|
||||
id = 0, // auto-generated ID
|
||||
name = input,
|
||||
date = Date(),
|
||||
places = places
|
||||
)
|
||||
getRoadTripViewModelFromOverlay(mapView.context).insertRoadTrip(newRoadTrip);
|
||||
Toast.makeText(
|
||||
mapView.context,
|
||||
R.string.roadtripAdded,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
points.clear()
|
||||
}
|
||||
clearMap(mapView)
|
||||
}
|
||||
|
||||
canvas.drawCircle(
|
||||
circleSize / 2 + circlePadding,
|
||||
circleY + circleSize / 2,
|
||||
circleSize / 2,
|
||||
paint
|
||||
)
|
||||
|
||||
val iconSize = 180
|
||||
val icon = ContextCompat.getDrawable(mapView.context, R.drawable.check)
|
||||
|
||||
val iconX = (circleSize / 2 - iconSize / 2 + circlePadding).toInt()
|
||||
val iconY = (circleY + circleSize / 2 - iconSize / 2).toInt()
|
||||
override fun confirm(mapView: MapView){
|
||||
val input = EditText(mapView.context)
|
||||
input.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(50))
|
||||
|
||||
icon?.setBounds(iconX, iconY, iconX + iconSize, iconY + iconSize)
|
||||
icon?.draw(canvas)
|
||||
val dialog = AlertDialog.Builder(mapView.context)
|
||||
.setTitle(R.string.newRoadtripDialog)
|
||||
.setView(input)
|
||||
.setPositiveButton(R.string.confirm) { _, _ ->
|
||||
val userInput = input.text.toString()
|
||||
if (userInput.isNotBlank()) {
|
||||
onValidation(mapView, input.text.toString())
|
||||
} else {
|
||||
Toast.makeText(
|
||||
mapView.context,
|
||||
R.string.emptyTextError,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) { dialog, _ ->
|
||||
dialog.cancel()
|
||||
}
|
||||
.create()
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
override fun onSingleTapConfirmed(e: MotionEvent?, mapView: MapView?) =
|
||||
if (e != null && circleRectF.contains(e.x, e.y)) {
|
||||
// TODO: Sauvegarder le trajet (dans la variable points).
|
||||
Log.d("GeoRoad", "CONFIRM : "+points.size)
|
||||
true
|
||||
}else{
|
||||
false
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#FFFFFF">
|
||||
<group android:scaleX="0.4698"
|
||||
android:scaleY="0.4698"
|
||||
android:translateX="6.3624"
|
||||
android:translateY="6.3624">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M22,16v-2l-8.5,-5V3.5C13.5,2.67 12.83,2 12,2s-1.5,0.67 -1.5,1.5V9L2,14v2l8.5,-2.5V19L8,20.5L8,22l4,-1l4,1l0,-1.5L13.5,19v-5.5L22,16z"/>
|
||||
</group>
|
||||
</vector>
|
@ -1,18 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="91dp"
|
||||
android:height="91dp"
|
||||
android:viewportWidth="91"
|
||||
android:viewportHeight="91">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M67.305,36.442v-8.055c0,-0.939 -0.762,-1.701 -1.7,-1.701H54.342v-5.524c0,-0.938 -0.761,-1.7 -1.699,-1.7h-12.75c-0.939,0 -1.701,0.762 -1.701,1.7v5.524H26.93c-0.939,0 -1.7,0.762 -1.7,1.701v8.055c0,0.938 0.761,1.699 1.7,1.699h0.488v34.021c0,0.938 0.761,1.7 1.699,1.7h29.481c3.595,0 6.52,-2.924 6.52,-6.518V38.142h0.486C66.543,38.142 67.305,37.381 67.305,36.442zM41.592,22.862h9.35v3.824h-9.35V22.862zM61.719,67.345c0,1.719 -1.4,3.117 -3.12,3.117h-27.78v-32.32l30.9,0.002V67.345zM63.904,34.742H28.629v-4.655h11.264h12.75h11.262V34.742z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M36.066,44.962h3.4v19.975h-3.4z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M44.566,44.962h3.4v19.975h-3.4z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M53.066,44.962h3.4v19.975h-3.4z"/>
|
||||
</vector>
|
@ -0,0 +1,20 @@
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<solid
|
||||
android:color="@color/gray" >
|
||||
</solid>
|
||||
|
||||
<padding
|
||||
android:left="5dp"
|
||||
android:top="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp" >
|
||||
</padding>
|
||||
|
||||
<corners
|
||||
android:radius="11dp" >
|
||||
</corners>
|
||||
|
||||
</shape>
|
@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="800dp"
|
||||
android:height="800dp"
|
||||
android:viewportWidth="330"
|
||||
android:viewportHeight="330">
|
||||
<path
|
||||
android:pathData="M250.61,154.39l-150,-150c-5.86,-5.86 -15.35,-5.86 -21.21,0c-5.86,5.86 -5.86,15.35 0,21.21l139.39,139.39L79.39,304.39c-5.86,5.86 -5.86,15.35 0,21.21C82.32,328.54 86.16,330 90,330s7.68,-1.46 10.61,-4.39l150,-150c2.81,-2.81 4.39,-6.63 4.39,-10.61C255,161.02 253.42,157.2 250.61,154.39z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/app_logo_background"/>
|
||||
<foreground android:drawable="@drawable/app_logo_foreground"/>
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/app_logo_background"/>
|
||||
<foreground android:drawable="@drawable/app_logo_foreground"/>
|
||||
</adaptive-icon>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 982 B |
Before Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,18 @@
|
||||
<resources>
|
||||
<string name="app_name">RoadTrip</string>
|
||||
<string name="map">Carte</string>
|
||||
<string name="travels">Voyages</string>
|
||||
<string name="roadtrip_title">Mes RoadTrips:</string>
|
||||
<string name="add_roadtrip_button">+</string>
|
||||
<string name="placesList">Vos lieux à visiter:</string>
|
||||
<string name="btnDeleteRoadTrip">Supprimer le voyage</string>
|
||||
<string name="confirm">Valider</string>
|
||||
<string name="cancel">Annuler</string>
|
||||
<string name="emptyTextError">Le texte ne peux pas être vide</string>
|
||||
<string name="newRoadtripDialog">Entrez le nom de votre voyage</string>
|
||||
<string name="roadTripDeleteConfirmation">Le voyage a bien été supprimé</string>
|
||||
<string name="roadTripDeleteError">Une erreur est survenue lors de la suppresion du voyage</string>
|
||||
<string name="noRoadTripFound">Aucun voyage n\'a été trouvé, utilisez la carte</string>
|
||||
<string name="roadtripAdded">Roadtrip ajouté</string>
|
||||
<string name="changesSaved">Changements sauvegardés</string>
|
||||
</resources>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="app_logo_background">#52796F</color>
|
||||
</resources>
|
@ -1,13 +1,18 @@
|
||||
<resources>
|
||||
<string name="app_name">RoadTrip</string>
|
||||
<string name="carte">Carte</string>
|
||||
<string name="voyages">Voyages</string>
|
||||
<string name="roadtrip_title">Mes RoadTrips:</string>
|
||||
<string name="map">Map</string>
|
||||
<string name="travels">Travels</string>
|
||||
<string name="roadtrip_title">My RoadTrips:</string>
|
||||
<string name="add_roadtrip_button">+</string>
|
||||
<string name="textaddNewRoadTrip">Entrez le nom du nouveau voyage</string>
|
||||
<string name="placesList">Vos lieux à visiter:</string>
|
||||
<string name="btnDeleteRoadTrip">Supprimer le voyage</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="placesList">Your places to visit:</string>
|
||||
<string name="btnDeleteRoadTrip">Delete travel</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="emptyTextError">The text cannot be empty</string>
|
||||
<string name="newRoadtripDialog">Enter the name of your travel</string>
|
||||
<string name="roadTripDeleteConfirmation">The road trip has been successfully deleted</string>
|
||||
<string name="roadTripDeleteError">An error occurred while deleting the road trip.</string>
|
||||
<string name="noRoadTripFound">No trip was found, add one with the map.</string>
|
||||
<string name="roadtripAdded">Roadtrip added</string>
|
||||
<string name="changesSaved">Changes saved</string>
|
||||
</resources>
|
@ -1,7 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.3.0' apply false
|
||||
id 'com.android.library' version '7.3.0' apply false
|
||||
id 'com.android.application' version '7.4.1' apply false
|
||||
id 'com.android.library' version '7.4.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
|
||||
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
|
||||
// id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
|
||||
}
|