53 lines
1.6 KiB
Kotlin
53 lines
1.6 KiB
Kotlin
package com.atridad.openclimb
|
|
|
|
import android.content.Intent
|
|
import android.os.Bundle
|
|
import androidx.activity.ComponentActivity
|
|
import androidx.activity.compose.setContent
|
|
import androidx.activity.enableEdgeToEdge
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
import androidx.compose.material3.Surface
|
|
import androidx.compose.runtime.*
|
|
import androidx.compose.ui.Modifier
|
|
import com.atridad.openclimb.ui.OpenClimbApp
|
|
import com.atridad.openclimb.ui.theme.OpenClimbTheme
|
|
|
|
class MainActivity : ComponentActivity() {
|
|
private var shortcutAction by mutableStateOf<String?>(null)
|
|
private var lastUsedGymId by mutableStateOf<String?>(null)
|
|
|
|
fun clearShortcutAction() {
|
|
shortcutAction = null
|
|
lastUsedGymId = null
|
|
}
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
setTheme(R.style.Theme_OpenClimb)
|
|
enableEdgeToEdge()
|
|
|
|
shortcutAction = intent?.action
|
|
lastUsedGymId = intent?.getStringExtra("LAST_USED_GYM_ID")
|
|
|
|
setContent {
|
|
OpenClimbTheme {
|
|
Surface(modifier = Modifier.fillMaxSize()) {
|
|
OpenClimbApp(
|
|
shortcutAction = shortcutAction,
|
|
lastUsedGymId = lastUsedGymId,
|
|
onShortcutActionProcessed = { clearShortcutAction() }
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
override fun onNewIntent(intent: Intent) {
|
|
super.onNewIntent(intent)
|
|
setIntent(intent)
|
|
|
|
shortcutAction = intent.action
|
|
lastUsedGymId = intent.getStringExtra("LAST_USED_GYM_ID")
|
|
}
|
|
}
|