package se.ajpanton.notificationlog import android.os.Bundle import android.view.View import androidx.annotation.StringRes import androidx.fragment.app.Fragment import se.ajpanton.notificationlog.databinding.FragmentPageBinding class PageFragment : Fragment(R.layout.fragment_page) { private var binding: FragmentPageBinding? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding = FragmentPageBinding.bind(view) binding?.pageTitle?.setText(requireArguments().getInt(ARG_TITLE)) } override fun onDestroyView() { binding = null super.onDestroyView() } fun setPageTitleVisible(visible: Boolean) { binding?.pageTitle?.visibility = if (visible) View.VISIBLE else View.GONE } companion object { private const val ARG_TITLE = "title" fun newInstance(@StringRes titleRes: Int) = PageFragment().apply { arguments = Bundle().apply { putInt(ARG_TITLE, titleRes) } } } }