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
2c70b529
Commit
2c70b529
authored
Feb 21, 2024
by
Lucas NAURY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout de la description lors de la création d'une annonce
parent
004808c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
AjoutAnnonceFragment.java
...le/tpleboncoin/ui/ajout_annonce/AjoutAnnonceFragment.java
+3
-6
fragment_ajout_annonce.xml
app/src/main/res/layout/fragment_ajout_annonce.xml
+22
-0
No files found.
app/src/main/java/com/example/tpleboncoin/ui/ajout_annonce/AjoutAnnonceFragment.java
View file @
2c70b529
...
@@ -49,6 +49,7 @@ public class AjoutAnnonceFragment extends Fragment {
...
@@ -49,6 +49,7 @@ public class AjoutAnnonceFragment extends Fragment {
final
EditText
titreAnnonce
=
binding
.
titreAnnonce
;
final
EditText
titreAnnonce
=
binding
.
titreAnnonce
;
final
EditText
adresseAnnonce
=
binding
.
adresseAnnonce
;
final
EditText
adresseAnnonce
=
binding
.
adresseAnnonce
;
final
EditText
prixAnnonce
=
binding
.
prixAnnonce
;
final
EditText
prixAnnonce
=
binding
.
prixAnnonce
;
final
EditText
descriptionAnnonce
=
binding
.
descriptionAnnonce
;
final
Button
boutonCreation
=
binding
.
boutonAjoutAnnonce
;
final
Button
boutonCreation
=
binding
.
boutonAjoutAnnonce
;
// Initialisation de la DB
// Initialisation de la DB
...
@@ -68,15 +69,11 @@ public class AjoutAnnonceFragment extends Fragment {
...
@@ -68,15 +69,11 @@ public class AjoutAnnonceFragment extends Fragment {
}
}
// On créé l'objet de la nouvelle annonce
// On créé l'objet de la nouvelle annonce
Annonce
nouvelleAnnonce
=
new
Annonce
(
titreAnnonce
.
getText
().
toString
(),
adresseAnnonce
.
getText
().
toString
(),
""
,
Double
.
parseDouble
(
prixAnnonce
.
getText
().
toString
()));
Annonce
nouvelleAnnonce
=
new
Annonce
(
titreAnnonce
.
getText
().
toString
(),
adresseAnnonce
.
getText
().
toString
(),
""
,
Double
.
parseDouble
(
prixAnnonce
.
getText
().
toString
()),
descriptionAnnonce
.
getText
().
toString
());
// On navigue vers la page d'accueil en passant la nouvelle annonce comme paramètre
// Bundle bundle = new Bundle();
// bundle.putParcelable("nouvelleAnnonce", nouvelleAnnonce);
// Navigation.findNavController(view).navigate(R.id.navigation_home, bundle);
//On ajoute la nouvelle annonce à la DB
//On ajoute la nouvelle annonce à la DB
dbManager
.
insert
(
nouvelleAnnonce
);
dbManager
.
insert
(
nouvelleAnnonce
);
//On navigue vers la page de liste des annonces
//On navigue vers la page de liste des annonces
Navigation
.
findNavController
(
view
).
navigate
(
R
.
id
.
navigation_home
);
Navigation
.
findNavController
(
view
).
navigate
(
R
.
id
.
navigation_home
);
...
...
app/src/main/res/layout/fragment_ajout_annonce.xml
View file @
2c70b529
...
@@ -145,6 +145,28 @@
...
@@ -145,6 +145,28 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:minHeight=
"@dimen/activity_vertical_margin"
/>
android:minHeight=
"@dimen/activity_vertical_margin"
/>
<TextView
android:id=
"@+id/labelDescription"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:fontFamily=
"sans-serif-medium"
android:text=
"Description : "
android:textAppearance=
"@style/TextAppearance.AppCompat.Medium"
/>
<EditText
android:id=
"@+id/descriptionAnnonce"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:hint=
"ex: Très bon état"
android:inputType=
"text"
android:textColorHint=
"#4D000000"
/>
<Space
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"@dimen/activity_vertical_margin"
/>
<Button
<Button
android:id=
"@+id/boutonAjoutAnnonce"
android:id=
"@+id/boutonAjoutAnnonce"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
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