Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uv-amse-android
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
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
Lucas NAURY
uv-amse-android
Commits
34895cf0
Commit
34895cf0
authored
Feb 21, 2024
by
Inès EL HADRI
💤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix click detail screen
parent
fab70a91
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
DetailScreen.java
...rc/main/java/com/example/tpleboncoin/ui/DetailScreen.java
+3
-7
HomeAdapter.java
...ain/java/com/example/tpleboncoin/ui/home/HomeAdapter.java
+8
-6
No files found.
app/src/main/java/com/example/tpleboncoin/ui/DetailScreen.java
View file @
34895cf0
...
...
@@ -20,15 +20,11 @@ public class DetailScreen extends AppCompatActivity {
Intent
intent
=
this
.
getIntent
();
if
(
intent
!=
null
){
Annonce
annonce
=
intent
.
getParcelableExtra
(
"annonce"
);
String
titre
=
intent
.
getStringExtra
(
"titre"
);
String
adresse
=
intent
.
getStringExtra
(
"adresse"
);
String
description
=
intent
.
getStringExtra
(
"description"
);
Double
prix
=
intent
.
getDoubleExtra
(
"prix"
,
999
);
binding
.
adresseTextView
.
setText
(
a
dresse
);
binding
.
prixTextView
.
setText
(
prix
.
toString
()+
" €"
);
binding
.
adresseTextView
.
setText
(
a
nnonce
.
getAdresse
()
);
binding
.
prixTextView
.
setText
(
Double
.
toString
(
annonce
.
getPrix
())
+
" €"
);
binding
.
imageView
.
setImageResource
(
R
.
drawable
.
ic_account_circle_black_24dp
);
binding
.
descriptionTextView4
.
setText
(
description
);
binding
.
descriptionTextView4
.
setText
(
annonce
.
);
binding
.
titreTextView
.
setText
(
titre
);
}
}
...
...
app/src/main/java/com/example/tpleboncoin/ui/home/HomeAdapter.java
View file @
34895cf0
...
...
@@ -23,9 +23,8 @@ import java.util.ArrayList;
public
class
HomeAdapter
extends
RecyclerView
.
Adapter
<
HomeAdapter
.
ViewHolder
>
{
private
static
final
String
TAG
=
"CustomAdapter"
;
private
ArrayList
<
Annonce
>
mDataSet
;
private
static
ArrayList
<
Annonce
>
mDataSet
;
private
boolean
mIsGrid
;
private
static
Context
mContext
;
/**
* Provide a reference to the type of views that you are using (custom ViewHolder)
...
...
@@ -33,6 +32,7 @@ public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
public
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
private
final
TextView
titreTextView
;
private
final
TextView
adresseTextView
;
private
final
TextView
prixTextView
;
public
ViewHolder
(
View
v
)
{
super
(
v
);
...
...
@@ -41,9 +41,8 @@ public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
@Override
public
void
onClick
(
View
v
)
{
// TODO : mettre la page de Donia
Intent
detailIntent
=
new
Intent
(
mContext
,
DetailScreen
.
class
);
detailIntent
.
putExtra
(
"titre"
,
titreTextView
.
getText
());
detailIntent
.
putExtra
(
"adresse"
,
adresseTextView
.
getText
());
Intent
detailIntent
=
new
Intent
(
v
.
getContext
(),
DetailScreen
.
class
);
detailIntent
.
putExtra
(
"annonce"
,
mDataSet
.
get
(
getAdapterPosition
()));
v
.
getContext
().
startActivity
(
detailIntent
);
//detailIntent.putExtra("prix", prix);
Log
.
d
(
TAG
,
"Element "
+
getAdapterPosition
()
+
" clicked."
);
...
...
@@ -51,6 +50,7 @@ public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
});
titreTextView
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
titre_annonce
);
adresseTextView
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
adresse_annonce
);
prixTextView
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
prix_annonce
);
}
public
TextView
getTitreTextView
()
{
...
...
@@ -59,6 +59,9 @@ public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
public
TextView
getAdresseTextView
()
{
return
adresseTextView
;
}
public
TextView
getPrixTextView
()
{
return
prixTextView
;
}
}
/**
...
...
@@ -70,7 +73,6 @@ public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
public
HomeAdapter
(
ArrayList
<
Annonce
>
dataSet
,
boolean
isGrid
,
Context
context
)
{
mDataSet
=
dataSet
;
mIsGrid
=
isGrid
;
mContext
=
context
;
}
// Create new views (invoked by the layout manager)
...
...
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