Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ElBuenoPeso
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matis SPINELLI
ElBuenoPeso
Commits
44cc7624
Commit
44cc7624
authored
Feb 22, 2024
by
m-spi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On fait quelque progrès...
parent
16ad45d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
DBManager.kt
...c/main/java/com/example/elbuenopeso/database/DBManager.kt
+1
-0
MarketFragment.kt
.../java/com/example/elbuenopeso/ui/market/MarketFragment.kt
+20
-20
No files found.
app/src/main/java/com/example/elbuenopeso/database/DBManager.kt
View file @
44cc7624
...
@@ -77,6 +77,7 @@ private constructor(private val context: Context) {
...
@@ -77,6 +77,7 @@ private constructor(private val context: Context) {
contentValue
.
put
(
DBHelper
.
TITLE
,
ad
.
title
)
contentValue
.
put
(
DBHelper
.
TITLE
,
ad
.
title
)
contentValue
.
put
(
DBHelper
.
ADDRESS
,
ad
.
address
)
contentValue
.
put
(
DBHelper
.
ADDRESS
,
ad
.
address
)
contentValue
.
put
(
DBHelper
.
IMAGE
,
ad
.
image
)
contentValue
.
put
(
DBHelper
.
IMAGE
,
ad
.
image
)
contentValue
.
put
(
DBHelper
.
PRIX
,
ad
.
prix
)
this
.
database
!!
.
insert
(
DBHelper
.
TABLE_NAME
,
null
,
contentValue
)
this
.
database
!!
.
insert
(
DBHelper
.
TABLE_NAME
,
null
,
contentValue
)
}
}
...
...
app/src/main/java/com/example/elbuenopeso/ui/market/MarketFragment.kt
View file @
44cc7624
...
@@ -3,6 +3,7 @@ package com.example.elbuenopeso.ui.market
...
@@ -3,6 +3,7 @@ package com.example.elbuenopeso.ui.market
import
AdAdapter
import
AdAdapter
import
android.database.Cursor
import
android.database.Cursor
import
android.os.Bundle
import
android.os.Bundle
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -38,30 +39,29 @@ class MarketFragment : Fragment() {
...
@@ -38,30 +39,29 @@ class MarketFragment : Fragment() {
val
listView
:
ListView
=
binding
.
listView
val
listView
:
ListView
=
binding
.
listView
// seed market items
// seed market items
// var annonces: List<AdModel> = listOf<AdModel>(
var
annonces
:
List
<
AdModel
>
=
listOf
<
AdModel
>(
// AdModel("Poutre", "1 rue Jean-Pierre", "drawable/pichu.png", 25.0),
AdModel
(
"Poutre"
,
"1 rue Jean-Pierre"
,
"drawable/pichu.png"
,
25.0
),
// AdModel("Briques", "2 rue Jean-Michel", "drawable/pichu.png", 16.0),
AdModel
(
"Briques"
,
"2 rue Jean-Michel"
,
"drawable/pichu.png"
,
16.0
),
// AdModel("Mur en bois", "4 rue Alain-Juju", "drawable/pichu.png", 7.2),
AdModel
(
"Mur en bois"
,
"4 rue Alain-Juju"
,
"drawable/pichu.png"
,
7.2
),
// AdModel("Maison de pierre", "7 rue Joris Belhomme", "drawable/pichu.png", 3.99),
AdModel
(
"Maison de pierre"
,
"7 rue Joris Belhomme"
,
"drawable/pichu.png"
,
3.99
),
// AdModel("Téléphone de Timothé", "8 rue de Timothé", "drawable/pichu.png", 0.85),
AdModel
(
"Téléphone de Timothé"
,
"8 rue de Timothé"
,
"drawable/pichu.png"
,
0.85
),
// AdModel("Oridnateur", "10 rue Jean-Charles", "drawable/pichu.png", 104.98),
AdModel
(
"Oridnateur"
,
"10 rue Jean-Charles"
,
"drawable/pichu.png"
,
104.98
),
// AdModel("Charnières", "22 rue Jeanne-Marie", "drawable/pichu.png", 2648.97),
AdModel
(
"Charnières"
,
"22 rue Jeanne-Marie"
,
"drawable/pichu.png"
,
2648.97
),
// AdModel("Porte en marbre", "1 rue Jean-Pierre", "drawable/pichu.png", 480.0),
AdModel
(
"Porte en marbre"
,
"1 rue Jean-Pierre"
,
"drawable/pichu.png"
,
480.0
),
// AdModel("Cheminée", "33 rue du Gouvernement", "drawable/pichu.png", 800.0),
AdModel
(
"Cheminée"
,
"33 rue du Gouvernement"
,
"drawable/pichu.png"
,
800.0
),
// )
)
//
// val adAdapter: AdAdapter = AdAdapter(requireContext(), annonces)
// listView.adapter = adAdapter
/*marketViewModel.text.observe(viewLifecycleOwner) {
/*marketViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
textView.text = it
}*/
}*/
var
dbManager
:
DBManager
?
=
DBManager
.
getDBManager
(
requireContext
());
val
dbManager
:
DBManager
?
=
DBManager
.
getDBManager
(
requireContext
())
dbManager
=
dbManager
!!
.
open
();
dbManager
!!
.
init
()
val
cursor
=
dbManager
.
fetch
();
val
cursor
=
dbManager
.
fetch
()
val
adapter
=
DbAdapter
(
requireContext
(),
cursor
!!
,
R
.
layout
.
fragment_market
);
Log
.
i
(
null
,
cursor
?.
getColumnName
(
0
).
toString
())
adapter
.
notifyDataSetChanged
();
val
adapter
=
DbAdapter
(
requireContext
(),
cursor
!!
,
R
.
layout
.
fragment_market
)
listView
.
adapter
=
adapter
;
adapter
.
notifyDataSetChanged
()
listView
.
adapter
=
adapter
return
root
return
root
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment