parent
f2a38eb339
commit
02fd486bc1
@ -1,6 +1,34 @@
|
|||||||
package uca.baptistearthur.geocaching.data
|
package uca.baptistearthur.geocaching.data
|
||||||
|
|
||||||
class Stub {
|
import uca.baptistearthur.geocaching.model.Place
|
||||||
|
import uca.baptistearthur.geocaching.model.RoadTrip
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
class Stub {
|
||||||
|
fun load(): MutableList<RoadTrip> {
|
||||||
|
val list = listOf(
|
||||||
|
RoadTrip(
|
||||||
|
"France",
|
||||||
|
Date(),
|
||||||
|
listOf(Place(49.3, 49.3)).toMutableList()
|
||||||
|
),
|
||||||
|
RoadTrip(
|
||||||
|
"Italie",
|
||||||
|
Date(),
|
||||||
|
listOf(Place(48.866667, 2.333333), Place(48.866667, 2.333333)).toMutableList()
|
||||||
|
),
|
||||||
|
RoadTrip(
|
||||||
|
"Danemark",
|
||||||
|
Date(),
|
||||||
|
listOf(Place(48.866667, 2.333333), Place(48.866667, 2.333333)).toMutableList()
|
||||||
|
),
|
||||||
|
RoadTrip(
|
||||||
|
"Islande",
|
||||||
|
Date(),
|
||||||
|
listOf(Place(48.866667, 2.333333), Place(48.866667, 2.333333), Place(48.866667, 2.333333)).toMutableList()
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return list.toMutableList()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,24 +0,0 @@
|
|||||||
package uca.baptistearthur.geocaching.model
|
|
||||||
|
|
||||||
import java.util.Date
|
|
||||||
|
|
||||||
class Stub {
|
|
||||||
|
|
||||||
// private val list = listOf(
|
|
||||||
// RoadTrip(
|
|
||||||
// "France",
|
|
||||||
// Date(),
|
|
||||||
// listOf(Place(48.866667, 2.333333), Place(48.866667, 2.333333)) as ArrayList<Place>
|
|
||||||
// ),
|
|
||||||
// RoadTrip(
|
|
||||||
// "Italie",
|
|
||||||
// Date(),
|
|
||||||
// listOf(Place(48.866667, 2.333333), Place(48.866667, 2.333333)) as ArrayList<Place>
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
|
|
||||||
// fun load(): List<RoadTrip> {
|
|
||||||
// return list
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +1,22 @@
|
|||||||
package uca.baptistearthur.geocaching.recyclerview
|
package uca.baptistearthur.geocaching.recyclerview
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Button
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.recyclerview.widget.RecyclerView.Adapter
|
|
||||||
import uca.baptistearthur.geocaching.R
|
import uca.baptistearthur.geocaching.R
|
||||||
import uca.baptistearthur.geocaching.model.RoadTrip
|
import uca.baptistearthur.geocaching.model.RoadTrip
|
||||||
|
|
||||||
|
|
||||||
class RoadTripAdapter (val voyages: List<RoadTrip>) : Adapter<RoadTripViewHolder>(){
|
class RoadTripAdapter (val voyages: List<RoadTrip>) : RecyclerView.Adapter<RoadTripViewHolder>(){
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: RoadTripViewHolder, position: Int) {
|
|
||||||
holder.itemView.findViewById<Button>(R.id.btnGetRoadTripsInfo).text = "test"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RoadTripViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RoadTripViewHolder {
|
||||||
return RoadTripViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.cell_one_roadtrip, parent, false))
|
return RoadTripViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.cell_one_roadtrip, parent, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
@SuppressLint("SetTextI18n")
|
||||||
return voyages.size
|
override fun onBindViewHolder(holder: RoadTripViewHolder, position: Int) {
|
||||||
|
holder.roadTripAccessButton.text = "> " + voyages[position].name
|
||||||
}
|
}
|
||||||
|
override fun getItemCount(): Int = voyages.size
|
||||||
}
|
}
|
Loading…
Reference in new issue