summaryrefslogtreecommitdiff
path: root/app/src/main/java/foundation
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2024-01-03 23:51:17 +0100
committerLeonard Kugis <leonard@kug.is>2024-01-03 23:51:17 +0100
commit37568f2fb2da190c840d264c88cbc8ae42e083b1 (patch)
treee2d25842a38f4430e8587ebeb3bb92ff02fc85c6 /app/src/main/java/foundation
parent5e35f14b7bc6b0425ec26b4286451d9f33317d49 (diff)
FakeLocation: Fixed camera position in ROUTE mode
Diffstat (limited to 'app/src/main/java/foundation')
-rw-r--r--app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt b/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt
index 3aaeb61..6dafd5d 100644
--- a/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt
+++ b/app/src/main/java/foundation/e/advancedprivacy/features/location/FakeLocationFragment.kt
@@ -455,11 +455,9 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
if(!binding.edittextJitter.isFocused)
binding.edittextJitter.setText(state.jitter?.toString())
- if (state.mode == LocationMode.REAL_LOCATION) {
- binding.centeredMarker.isVisible = false
- } else {
+ if (state.mode == LocationMode.SPECIFIC_LOCATION) {
binding.mapLoader.isVisible = false
- binding.mapOverlay.isVisible = state.mode != LocationMode.SPECIFIC_LOCATION
+ binding.mapOverlay.isVisible = false
binding.centeredMarker.isVisible = true
mapboxMap?.moveCamera(
CameraUpdateFactory.newLatLng(
@@ -469,6 +467,22 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
)
)
)
+ } else if(state.mode == LocationMode.ROUTE) {
+ binding.mapLoader.isVisible = false
+ binding.mapOverlay.isVisible = true
+ binding.centeredMarker.isVisible = false
+ state.route?.let {
+ mapboxMap?.moveCamera(
+ CameraUpdateFactory.newLatLng(
+ LatLng(
+ state.route.first().latitude.toDouble(),
+ state.route.first().longitude.toDouble()
+ )
+ )
+ )
+ }
+ } else {
+ binding.centeredMarker.isVisible = false
}
binding.textlayoutLatitude.isVisible = (state.mode == LocationMode.SPECIFIC_LOCATION)
@@ -492,7 +506,7 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
locationComponent?.isLocationComponentEnabled = true
locationComponent?.forceLocationUpdate(location)
- if (mode == LocationMode.REAL_LOCATION) {
+ if (mode != LocationMode.SPECIFIC_LOCATION) {
binding.mapLoader.isVisible = false
binding.mapOverlay.isVisible = false
@@ -508,7 +522,7 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
}
} ?: run {
locationComponent?.isLocationComponentEnabled = false
- if (mode == LocationMode.REAL_LOCATION) {
+ if (mode != LocationMode.SPECIFIC_LOCATION) {
binding.mapLoader.isVisible = true
binding.mapOverlay.isVisible = true
}