[android] Fragment에서 full screen 사용하기

activity를 주로 사용하다가 새로나온 Navigation을 사용하려니, 불편했던 건 쉽게 되는데, 쉬웠던 건 잘 안되는 경우가 있다 ㅋㅋ 

class SplashFragment : Fragment() {

  override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    return inflater.inflate(R.layout.splash_fragment, container, false)
  }

  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
    (activity as AppCompatActivity).supportActionBar?.hide()
  }

  override fun onDestroy() {
    super.onDestroy()
    activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
    (activity as AppCompatActivity).supportActionBar?.show()
  }
}