package com.apps.sketchmaster.view

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 androidx.recyclerview.widget.GridLayoutManager
import com.apps.sketchmaster.adapter.TwoTypeAdapter
import com.apps.sketchmaster.event.DeleteClickListener
import com.apps.sketchmaster.databinding.FragmentPageShowBinding


class PageShowFragment : Fragment(),DeleteClickListener {
    private lateinit var binding: FragmentPageShowBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentPageShowBinding.inflate(inflater,container,false)
        init()
        return binding.root
    }
    private fun init(){
        val adapter=TwoTypeAdapter()
        adapter.setListener(this)
        binding.recyclerView.adapter=adapter
        binding.recyclerView.layoutManager=GridLayoutManager(requireActivity(),2)
    }

    override fun onClick(name: String) {
        val intent = Intent(requireActivity(), ShowTitleActivity::class.java)
        intent.putExtra(ShowTitleActivity.TITLE_KEY,name)
        startActivity(intent)
    }
}