mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat(map): keep screen on when location tracking is enabled (#3003)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
91ce6c5b93
commit
d5e53e2639
1 changed files with 13 additions and 0 deletions
|
|
@ -19,11 +19,13 @@
|
|||
|
||||
package com.geeksville.mesh.ui.map
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.location.Location
|
||||
import android.net.Uri
|
||||
import android.view.WindowManager
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
|
|
@ -349,6 +351,17 @@ fun MapView(
|
|||
|
||||
var showClusterItemsDialog by remember { mutableStateOf<List<NodeClusterItem>?>(null) }
|
||||
|
||||
LaunchedEffect(isLocationTrackingEnabled) {
|
||||
val activity = context as? Activity ?: return@LaunchedEffect
|
||||
val window = activity.window
|
||||
|
||||
if (isLocationTrackingEnabled) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
} else {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
}
|
||||
|
||||
Scaffold { paddingValues ->
|
||||
Box(modifier = Modifier.fillMaxSize().padding(paddingValues)) {
|
||||
GoogleMap(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue