package com.xyzshell.myphoneinfo.dashboard

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.xyzshell.myphoneinfo.R
import com.xyzshell.myphoneinfo.databinding.FragmentCameraBinding
import com.xyzshell.myphoneinfo.dialog.DialogCameraMore

class CameraFragment : Fragment() {
    private lateinit var binding:FragmentCameraBinding;
    private var dialogCamera0: DialogCameraMore? = null
    private var dialogCamera1: DialogCameraMore? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {

        }
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        binding = FragmentCameraBinding.inflate(inflater, container, false)
        initText()
        binding.rearMore.setOnClickListener {
            dialogCamera0= dialogCamera0?:DialogCameraMore(0)
            dialogCamera0?.show(childFragmentManager, "DialogCameraMore0")
        }
        binding.frontMore.setOnClickListener {
            dialogCamera1= dialogCamera1?:DialogCameraMore(1)
            dialogCamera1?.show(childFragmentManager, "DialogCameraMore1")
        }
        return binding.root
    }

    private fun initText() {
        binding.rearCheck1.content.text=getString(R.string.optical_image_stabilization)
        binding.rearCheck2.content.text=getString(R.string.flash)
        binding.frontCheck1.content.text=getString(R.string.optical_image_stabilization)
        binding.frontCheck2.content.text=getString(R.string.flash)
        binding.videoCheck1.content.text=getString(R.string.hight_speed_video)
        binding.videoCheck2.content.text=getString(R.string.video_stabilization)
    }

    companion object {

        @JvmStatic
        fun newInstance() =
            CameraFragment().apply {
                arguments = Bundle().apply {

                }
            }
    }
}