Commit 0e51fd34 authored by Lucas NAURY's avatar Lucas NAURY

Change page names

parent bee9c773
Pipeline #2724 canceled with stages
...@@ -27,7 +27,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -27,7 +27,7 @@ public class MainActivity extends AppCompatActivity {
// Passing each menu ID as a set of Ids because each // Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations. // menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( 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(); .build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
......
package com.example.tpleboncoin.ui.dashboard; package com.example.tpleboncoin.ui.ajout_annonce;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -10,22 +10,22 @@ import androidx.annotation.NonNull; ...@@ -10,22 +10,22 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.example.tpleboncoin.databinding.FragmentDashboardBinding; import com.example.tpleboncoin.databinding.FragmentAjoutAnnonceBinding;
public class DashboardFragment extends Fragment { public class AjoutAnnonceFragment extends Fragment {
private FragmentDashboardBinding binding; private FragmentAjoutAnnonceBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
DashboardViewModel dashboardViewModel = AjoutAnnonceViewModel ajout_annonceViewModel =
new ViewModelProvider(this).get(DashboardViewModel.class); new ViewModelProvider(this).get(AjoutAnnonceViewModel.class);
binding = FragmentDashboardBinding.inflate(inflater, container, false); binding = FragmentAjoutAnnonceBinding.inflate(inflater, container, false);
View root = binding.getRoot(); View root = binding.getRoot();
final TextView textView = binding.textDashboard; final TextView textView = binding.textAjoutAnnonce;
dashboardViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); ajout_annonceViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root; return root;
} }
......
package com.example.tpleboncoin.ui.dashboard; package com.example.tpleboncoin.ui.ajout_annonce;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
public class DashboardViewModel extends ViewModel { public class AjoutAnnonceViewModel extends ViewModel {
private final MutableLiveData<String> mText; private final MutableLiveData<String> mText;
public DashboardViewModel() { public AjoutAnnonceViewModel() {
mText = new MutableLiveData<>(); mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment"); mText.setValue("Ajouter une annonce");
} }
public LiveData<String> getText() { public LiveData<String> getText() {
......
<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>
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment"> tools:context=".ui.ajout_annonce.AjoutAnnonceFragment">
<TextView <TextView
android:id="@+id/text_dashboard" android:id="@+id/text_ajout_annonce"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
android:title="@string/title_home" /> android:title="@string/title_home" />
<item <item
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_ajout_annonce"
android:icon="@drawable/ic_dashboard_black_24dp" android:icon="@drawable/ic_baseline_add_box_24"
android:title="@string/title_dashboard" /> android:title="@string/title_add" />
<item <item
android:id="@+id/navigation_notifications" android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp" android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/title_notifications" /> android:title="@string/title_profile" />
</menu> </menu>
\ No newline at end of file
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
tools:layout="@layout/fragment_home" /> tools:layout="@layout/fragment_home" />
<fragment <fragment
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_ajout_annonce"
android:name="com.example.tpleboncoin.ui.dashboard.DashboardFragment" android:name="com.example.tpleboncoin.ui.ajout_annonce.AjoutAnnonceFragment"
android:label="@string/title_dashboard" android:label="@string/title_add"
tools:layout="@layout/fragment_dashboard" /> tools:layout="@layout/fragment_ajout_annonce" />
<fragment <fragment
android:id="@+id/navigation_notifications" android:id="@+id/navigation_notifications"
android:name="com.example.tpleboncoin.ui.notifications.NotificationsFragment" android:name="com.example.tpleboncoin.ui.notifications.NotificationsFragment"
android:label="@string/title_notifications" android:label="@string/title_profile"
tools:layout="@layout/fragment_notifications" /> tools:layout="@layout/fragment_notifications" />
</navigation> </navigation>
\ No newline at end of file
<resources> <resources>
<string name="app_name">TP LeBonCoin</string> <string name="app_name">TP LeBonCoin</string>
<string name="title_home">Home</string> <string name="title_home">Accueil</string>
<string name="title_dashboard">Dashboard</string> <string name="title_add">Ajout</string>
<string name="title_notifications">Notifications</string> <string name="title_profile">Profil</string>
</resources> </resources>
\ 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