package ch.spherIC.recurvebowsight.ui.calcsight;

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 ch.spherIC.recurvebowsight.databinding.FragmentCalcsightParametersBinding;

public class CalculateSightParametersFragment extends Fragment {

    private final int position;
    private FragmentCalcsightParametersBinding binding;

    public CalculateSightParametersFragment(int position) {
        this.position = position;
    }

    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        CalculateSightParametersViewModel galleryViewModel = new ViewModelProvider(this).get(CalculateSightParametersViewModel.class);
        binding = FragmentCalcsightParametersBinding.inflate(inflater, container, false);
        View root = binding.getRoot();

        final TextView textView = binding.textCalcsightParams;
        galleryViewModel.setText(position);
        galleryViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
        return root;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
}