|
@@ -8,27 +8,69 @@ import android.os.Bundle
|
|
import android.os.Handler
|
|
import android.os.Handler
|
|
import android.os.Looper
|
|
import android.os.Looper
|
|
import android.util.Log
|
|
import android.util.Log
|
|
-import android.view.View
|
|
|
|
import android.view.WindowInsets
|
|
import android.view.WindowInsets
|
|
-import android.widget.Button
|
|
|
|
-import android.widget.TextView
|
|
|
|
-import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
|
|
+import android.view.WindowInsetsController
|
|
|
|
+import android.view.WindowManager
|
|
|
|
+import androidx.activity.ComponentActivity
|
|
|
|
+import androidx.activity.compose.setContent
|
|
|
|
+import androidx.compose.material.MaterialTheme
|
|
import androidx.core.view.WindowCompat
|
|
import androidx.core.view.WindowCompat
|
|
-import androidx.core.view.WindowInsetsCompat
|
|
|
|
-import androidx.core.view.WindowInsetsControllerCompat
|
|
|
|
import androidx.lifecycle.*
|
|
import androidx.lifecycle.*
|
|
-import chef.sundby.com.homecontroldisplay.databinding.ActivityFullscreenBinding
|
|
|
|
-import com.android.volley.Request
|
|
|
|
-import com.android.volley.Response
|
|
|
|
-import com.android.volley.toolbox.StringRequest
|
|
|
|
-import com.android.volley.toolbox.Volley
|
|
|
|
|
|
+import chef.sundby.com.homecontroldisplay.ui.HomeControlApp
|
|
import kotlinx.coroutines.*
|
|
import kotlinx.coroutines.*
|
|
-import java.lang.Runnable
|
|
|
|
-import kotlin.coroutines.coroutineContext
|
|
|
|
|
|
+import androidx.compose.material.Surface
|
|
|
|
+import chef.sundby.com.homecontroldisplay.ui.theme.HomeControlDisplayTheme
|
|
|
|
|
|
-class FullscreenActivity : AppCompatActivity() {
|
|
|
|
|
|
+class FullscreenActivity : ComponentActivity() {
|
|
|
|
|
|
- private lateinit var binding: ActivityFullscreenBinding
|
|
|
|
|
|
+ private var cnt : Int = 0
|
|
|
|
+
|
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
|
+ setContent {
|
|
|
|
+ HomeControlDisplayTheme {
|
|
|
|
+ Surface(color = MaterialTheme.colors.background) {
|
|
|
|
+ HomeControlApp()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ hideSystemUI()
|
|
|
|
+ fetchDataInBackground()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun fetchDataInBackground() {
|
|
|
|
+
|
|
|
|
+ Log.i("THOMAS","Starting fetchDataInBackground()")
|
|
|
|
+
|
|
|
|
+ lifecycleScope.launchWhenStarted {
|
|
|
|
+ repeatOnLifecycle(Lifecycle.State.STARTED) {
|
|
|
|
+ while (true) {
|
|
|
|
+ Log.i("THOMAS","Cnt: $cnt")
|
|
|
|
+ delay(1000)
|
|
|
|
+ cnt++
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fun hideSystemUI() {
|
|
|
|
+
|
|
|
|
+ //Hides the ugly action bar at the top
|
|
|
|
+ actionBar?.hide()
|
|
|
|
+
|
|
|
|
+ WindowCompat.setDecorFitsSystemWindows(window, false)
|
|
|
|
+
|
|
|
|
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
|
|
|
+ window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
|
+ } else {
|
|
|
|
+ window.insetsController?.apply {
|
|
|
|
+ hide(WindowInsets.Type.statusBars())
|
|
|
|
+ systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*private lateinit var binding: ActivityFullscreenBinding
|
|
private lateinit var fullscreenContent: TextView
|
|
private lateinit var fullscreenContent: TextView
|
|
private lateinit var aButton: Button
|
|
private lateinit var aButton: Button
|
|
private val hideHandler = Handler(Looper.myLooper()!!)
|
|
private val hideHandler = Handler(Looper.myLooper()!!)
|
|
@@ -129,6 +171,9 @@ class FullscreenActivity : AppCompatActivity() {
|
|
isFullscreen = true
|
|
isFullscreen = true
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ */
|
|
|
|
+
|
|
companion object {
|
|
companion object {
|
|
/**
|
|
/**
|
|
* Some older devices needs a small delay between UI widget updates
|
|
* Some older devices needs a small delay between UI widget updates
|