package de.jg_cody.Teraplex.ui.Toilette;

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.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

import de.jg_cody.Teraplex.R;

public class ToiletteFragment extends Fragment {

    private ToiletteViewModel toiletteViewModel;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        toiletteViewModel =
                new ViewModelProvider(this).get(ToiletteViewModel.class);
        View root = inflater.inflate(R.layout.fragment_toilette, container, false);
        final TextView textView = root.findViewById(R.id.text_toilette);
        toiletteViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
            @Override
            public void onChanged(@Nullable String s) {
                textView.setText(s);
            }
        });
        return root;
    }
}