package com.example.apk_deteksi_kualitas_telur.Ui.Fragment

import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.apk_deteksi_kualitas_telur.R
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.AyamRasActivity
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.KualitasTelurBagusActivity
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.KualitasTelurSedangActivity
import com.example.apk_deteksi_kualitas_telur.Ui.Activity.KualitastelurJelekActivity
import com.example.apk_deteksi_kualitas_telur.databinding.FragmentHomeBinding


class HomeFragment : Fragment() {
    private var _binding: FragmentHomeBinding? = null
    private val binding get() = _binding!!
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
    ): View? {
        _binding = FragmentHomeBinding.inflate(inflater, container, false)
        movePageKualtasTelur()
        return binding.root
    }

    private fun movePageKualtasTelur() {
        binding.cvBagus.setOnClickListener {
            val intent = Intent(requireContext(), KualitasTelurBagusActivity::class.java)
            startActivity(intent)
        }
        binding.cvSedang.setOnClickListener {
            val intent = Intent(requireContext(), KualitasTelurSedangActivity::class.java)
            startActivity(intent)
        }
        binding.cvJelek.setOnClickListener {
            val intent = Intent(requireContext(), KualitastelurJelekActivity::class.java)
            startActivity(intent)
        }
        binding.cvAyamRas.setOnClickListener {
            val intent = Intent(requireContext(), AyamRasActivity::class.java)
            startActivity(intent)
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        _binding = null
    }

}