Commit f55acfa4 authored by Timothé KOBAK's avatar Timothé KOBAK

Merge remote-tracking branch 'origin/master'

parents ba02b6a8 2d5ea4ce
......@@ -8,6 +8,7 @@ import android.widget.TextView
import com.example.elbuenopeso.R
import com.example.elbuenopeso.models.AdModel
import com.example.elbuenopeso.ui.dashboard.MarketFragment
import java.math.RoundingMode
class AdAdapter(private val context: Context, private val adModelArrayList: List<AdModel>) : BaseAdapter() {
......@@ -27,9 +28,12 @@ class AdAdapter(private val context: Context, private val adModelArrayList: List
val imageIV: ImageView = convertView.findViewById(R.id.itemListViewImageView)
val titleTV: TextView = convertView.findViewById(R.id.itemListViewTitleView)
val addressTV: TextView = convertView.findViewById(R.id.itemListViewTextView)
val prixTV: TextView = convertView.findViewById(R.id.itemListViewPrixView)
imageIV.setImageResource(ad.image)
titleTV.text = ad.title
addressTV.text = ad.address
val prix = (ad.prix.toString())
prixTV.text = "${prix.toBigDecimal().setScale(2, RoundingMode.UP).toDouble()} €"
return convertView
}
}
\ No newline at end of file
package com.example.elbuenopeso.models
public class AdModel(var title: String, var address: String, var image: Int) {
public class AdModel(var title: String, var address: String, var image: Int, var prix: Double) {
}
\ No newline at end of file
......@@ -34,15 +34,15 @@ class MarketFragment : Fragment() {
val listView: ListView = binding.listView
// seed market items
var annonces: List<AdModel> = listOf<AdModel>(
AdModel("Poutre", "1 rue Jean-Pierre", R.drawable.pichu),
AdModel("Briques", "2 rue Jean-Michel", R.drawable.pichu),
AdModel("Mur en bois", "4 rue Alain-Juju", R.drawable.pichu),
AdModel("Maison de pierre", "7 rue Joris Belhomme", R.drawable.pichu),
AdModel("Téléphone de Timothé", "8 rue de Timothé", R.drawable.pichu),
AdModel("Oridnateur", "10 rue Jean-Charles", R.drawable.pichu),
AdModel("Charnières", "22 rue Jeanne-Marie", R.drawable.pichu),
AdModel("Porte en marbre", "1 rue Jean-Pierre", R.drawable.pichu),
AdModel("Cheminée", "33 rue du Gouvernement", R.drawable.pichu),
AdModel("Poutre", "1 rue Jean-Pierre", R.drawable.pichu, 25.0),
AdModel("Briques", "2 rue Jean-Michel", R.drawable.pichu, 16.0),
AdModel("Mur en bois", "4 rue Alain-Juju", R.drawable.pichu, 7.2),
AdModel("Maison de pierre", "7 rue Joris Belhomme", R.drawable.pichu, 3.99),
AdModel("Téléphone de Timothé", "8 rue de Timothé", R.drawable.pichu, 0.85),
AdModel("Oridnateur", "10 rue Jean-Charles", R.drawable.pichu, 104.98),
AdModel("Charnières", "22 rue Jeanne-Marie", R.drawable.pichu, 2648.97),
AdModel("Porte en marbre", "1 rue Jean-Pierre", R.drawable.pichu, 480.0),
AdModel("Cheminée", "33 rue du Gouvernement", R.drawable.pichu, 800.0),
)
var adAdapter: AdAdapter = AdAdapter(requireContext(), annonces)
......
......@@ -14,13 +14,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toTopOf="@+id/text_dashboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -9,7 +9,6 @@
android:id="@+id/itemListViewTitleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="TextView"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@+id/itemListViewImageView"
......@@ -27,9 +26,17 @@
android:id="@+id/itemListViewTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="@+id/itemListViewImageView"
app:layout_constraintStart_toEndOf="@+id/itemListViewImageView" />
<TextView
android:id="@+id/itemListViewPrixView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toTopOf="@+id/itemListViewTextView"
app:layout_constraintStart_toEndOf="@+id/itemListViewImageView"
app:layout_constraintTop_toBottomOf="@+id/itemListViewTitleView" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment