package com.doverfuelingsolutions.issp.utils

import android.os.Build
import android.os.Handler
import android.view.View
import android.view.WindowInsets
import androidx.appcompat.app.AppCompatActivity
import com.doverfuelingsolutions.issp.utils.log.DFSLog

class ActivityUtil {

    companion object {

        fun setFullscreen(activity: AppCompatActivity) {
            makeFullscreen(activity)
            Handler(activity.mainLooper).postDelayed({
                makeFullscreen(activity)
            }, 1000)

        }

        @Suppress("DEPRECATION")
        private fun makeFullscreen(activity: AppCompatActivity) {
            if (activity.isFinishing || activity.isDestroyed) return

            activity.supportActionBar?.hide()
            activity.window.decorView.systemUiVisibility =
                View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        }
    }
}