Commit e1bc847a authored by Lucas NAURY's avatar Lucas NAURY

Supression de la page "profil"

parent d3f07225
...@@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -31,7 +31,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_ajout_annonce, R.id.navigation_notifications) R.id.navigation_home, R.id.navigation_ajout_annonce)
.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.notifications;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.example.tpleboncoin.databinding.FragmentNotificationsBinding;
public class NotificationsFragment extends Fragment {
private FragmentNotificationsBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
NotificationsViewModel notificationsViewModel =
new ViewModelProvider(this).get(NotificationsViewModel.class);
binding = FragmentNotificationsBinding.inflate(inflater, container, false);
View root = binding.getRoot();
final TextView textView = binding.textNotifications;
notificationsViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root;
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
\ No newline at end of file
package com.example.tpleboncoin.ui.notifications;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class NotificationsViewModel extends ViewModel {
private final MutableLiveData<String> mText;
public NotificationsViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is notifications fragment");
}
public LiveData<String> getText() {
return mText;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment">
<TextView
android:id="@+id/text_notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -11,9 +11,4 @@ ...@@ -11,9 +11,4 @@
android:icon="@drawable/ic_baseline_add_box_24" android:icon="@drawable/ic_baseline_add_box_24"
android:title="@string/title_add" /> android:title="@string/title_add" />
<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_account_circle_black_24dp"
android:title="@string/title_profile" />
</menu> </menu>
\ No newline at end of file
...@@ -17,9 +17,4 @@ ...@@ -17,9 +17,4 @@
android:label="@string/title_add_top" android:label="@string/title_add_top"
tools:layout="@layout/fragment_ajout_annonce" /> tools:layout="@layout/fragment_ajout_annonce" />
<fragment
android:id="@+id/navigation_notifications"
android:name="com.example.tpleboncoin.ui.notifications.NotificationsFragment"
android:label="@string/title_profile"
tools:layout="@layout/fragment_notifications" />
</navigation> </navigation>
\ 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