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
0e51fd34
Commit
0e51fd34
authored
Feb 16, 2024
by
Lucas NAURY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change page names
parent
bee9c773
Pipeline
#2724
canceled with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
28 deletions
+33
-28
MainActivity.java
app/src/main/java/com/example/tpleboncoin/MainActivity.java
+1
-1
AjoutAnnonceFragment.java
...le/tpleboncoin/ui/ajout_annonce/AjoutAnnonceFragment.java
+9
-9
AjoutAnnonceViewModel.java
...e/tpleboncoin/ui/ajout_annonce/AjoutAnnonceViewModel.java
+4
-4
ic_baseline_add_box_24.xml
app/src/main/res/drawable/ic_baseline_add_box_24.xml
+5
-0
fragment_ajout_annonce.xml
app/src/main/res/layout/fragment_ajout_annonce.xml
+2
-2
bottom_nav_menu.xml
app/src/main/res/menu/bottom_nav_menu.xml
+4
-4
mobile_navigation.xml
app/src/main/res/navigation/mobile_navigation.xml
+5
-5
strings.xml
app/src/main/res/values/strings.xml
+3
-3
No files found.
app/src/main/java/com/example/tpleboncoin/MainActivity.java
View file @
0e51fd34
...
...
@@ -27,7 +27,7 @@ public class MainActivity extends AppCompatActivity {
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration
appBarConfiguration
=
new
AppBarConfiguration
.
Builder
(
R
.
id
.
navigation_home
,
R
.
id
.
navigation_
dashboard
,
R
.
id
.
navigation_notifications
)
R
.
id
.
navigation_home
,
R
.
id
.
navigation_
ajout_annonce
,
R
.
id
.
navigation_notifications
)
.
build
();
NavController
navController
=
Navigation
.
findNavController
(
this
,
R
.
id
.
nav_host_fragment_activity_main
);
NavigationUI
.
setupActionBarWithNavController
(
this
,
navController
,
appBarConfiguration
);
...
...
app/src/main/java/com/example/tpleboncoin/ui/
dashboard/Dashboard
Fragment.java
→
app/src/main/java/com/example/tpleboncoin/ui/
ajout_annonce/AjoutAnnonce
Fragment.java
View file @
0e51fd34
package
com
.
example
.
tpleboncoin
.
ui
.
dashboard
;
package
com
.
example
.
tpleboncoin
.
ui
.
ajout_annonce
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
...
...
@@ -10,22 +10,22 @@ import androidx.annotation.NonNull;
import
androidx.fragment.app.Fragment
;
import
androidx.lifecycle.ViewModelProvider
;
import
com.example.tpleboncoin.databinding.Fragment
Dashboard
Binding
;
import
com.example.tpleboncoin.databinding.Fragment
AjoutAnnonce
Binding
;
public
class
Dashboard
Fragment
extends
Fragment
{
public
class
AjoutAnnonce
Fragment
extends
Fragment
{
private
Fragment
Dashboard
Binding
binding
;
private
Fragment
AjoutAnnonce
Binding
binding
;
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
DashboardViewModel
dashboard
ViewModel
=
new
ViewModelProvider
(
this
).
get
(
Dashboard
ViewModel
.
class
);
AjoutAnnonceViewModel
ajout_annonce
ViewModel
=
new
ViewModelProvider
(
this
).
get
(
AjoutAnnonce
ViewModel
.
class
);
binding
=
Fragment
Dashboard
Binding
.
inflate
(
inflater
,
container
,
false
);
binding
=
Fragment
AjoutAnnonce
Binding
.
inflate
(
inflater
,
container
,
false
);
View
root
=
binding
.
getRoot
();
final
TextView
textView
=
binding
.
text
Dashboard
;
dashboard
ViewModel
.
getText
().
observe
(
getViewLifecycleOwner
(),
textView:
:
setText
);
final
TextView
textView
=
binding
.
text
AjoutAnnonce
;
ajout_annonce
ViewModel
.
getText
().
observe
(
getViewLifecycleOwner
(),
textView:
:
setText
);
return
root
;
}
...
...
app/src/main/java/com/example/tpleboncoin/ui/
dashboard/Dashboard
ViewModel.java
→
app/src/main/java/com/example/tpleboncoin/ui/
ajout_annonce/AjoutAnnonce
ViewModel.java
View file @
0e51fd34
package
com
.
example
.
tpleboncoin
.
ui
.
dashboard
;
package
com
.
example
.
tpleboncoin
.
ui
.
ajout_annonce
;
import
androidx.lifecycle.LiveData
;
import
androidx.lifecycle.MutableLiveData
;
import
androidx.lifecycle.ViewModel
;
public
class
Dashboard
ViewModel
extends
ViewModel
{
public
class
AjoutAnnonce
ViewModel
extends
ViewModel
{
private
final
MutableLiveData
<
String
>
mText
;
public
Dashboard
ViewModel
()
{
public
AjoutAnnonce
ViewModel
()
{
mText
=
new
MutableLiveData
<>();
mText
.
setValue
(
"
This is dashboard fragment
"
);
mText
.
setValue
(
"
Ajouter une annonce
"
);
}
public
LiveData
<
String
>
getText
()
{
...
...
app/src/main/res/drawable/ic_baseline_add_box_24.xml
0 → 100644
View file @
0e51fd34
<vector
android:height=
"24dp"
android:tint=
"#000000"
android:viewportHeight=
"24"
android:viewportWidth=
"24"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"@android:color/white"
android:pathData=
"M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"
/>
</vector>
app/src/main/res/layout/fragment_
dashboard
.xml
→
app/src/main/res/layout/fragment_
ajout_annonce
.xml
View file @
0e51fd34
...
...
@@ -4,10 +4,10 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.
dashboard.Dashboard
Fragment"
>
tools:context=
".ui.
ajout_annonce.AjoutAnnonce
Fragment"
>
<TextView
android:id=
"@+id/text_
dashboard
"
android:id=
"@+id/text_
ajout_annonce
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
...
...
app/src/main/res/menu/bottom_nav_menu.xml
View file @
0e51fd34
...
...
@@ -7,13 +7,13 @@
android:title=
"@string/title_home"
/>
<item
android:id=
"@+id/navigation_
dashboard
"
android:icon=
"@drawable/ic_
dashboard_black_24dp
"
android:title=
"@string/title_
dashboar
d"
/>
android:id=
"@+id/navigation_
ajout_annonce
"
android:icon=
"@drawable/ic_
baseline_add_box_24
"
android:title=
"@string/title_
ad
d"
/>
<item
android:id=
"@+id/navigation_notifications"
android:icon=
"@drawable/ic_notifications_black_24dp"
android:title=
"@string/title_
notifications
"
/>
android:title=
"@string/title_
profile
"
/>
</menu>
\ No newline at end of file
app/src/main/res/navigation/mobile_navigation.xml
View file @
0e51fd34
...
...
@@ -12,14 +12,14 @@
tools:layout=
"@layout/fragment_home"
/>
<fragment
android:id=
"@+id/navigation_
dashboard
"
android:name=
"com.example.tpleboncoin.ui.
dashboard.Dashboard
Fragment"
android:label=
"@string/title_
dashboar
d"
tools:layout=
"@layout/fragment_
dashboard
"
/>
android:id=
"@+id/navigation_
ajout_annonce
"
android:name=
"com.example.tpleboncoin.ui.
ajout_annonce.AjoutAnnonce
Fragment"
android:label=
"@string/title_
ad
d"
tools:layout=
"@layout/fragment_
ajout_annonce
"
/>
<fragment
android:id=
"@+id/navigation_notifications"
android:name=
"com.example.tpleboncoin.ui.notifications.NotificationsFragment"
android:label=
"@string/title_
notifications
"
android:label=
"@string/title_
profile
"
tools:layout=
"@layout/fragment_notifications"
/>
</navigation>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
0e51fd34
<resources>
<string
name=
"app_name"
>
TP LeBonCoin
</string>
<string
name=
"title_home"
>
Home
</string>
<string
name=
"title_
dashboard"
>
Dashboard
</string>
<string
name=
"title_
notifications"
>
Notifications
</string>
<string
name=
"title_home"
>
Accueil
</string>
<string
name=
"title_
add"
>
Ajout
</string>
<string
name=
"title_
profile"
>
Profil
</string>
</resources>
\ No newline at end of file
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