summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/data/repositories/CityDataSource.kt4
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt26
-rw-r--r--app/src/main/res/layout/fragment_fake_location.xml4
-rw-r--r--app/src/main/res/values/themes.xml2
4 files changed, 25 insertions, 11 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/CityDataSource.kt b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/CityDataSource.kt
index 5fab9b7..d6a6a19 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/CityDataSource.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/CityDataSource.kt
@@ -26,9 +26,9 @@ object CityDataSource {
private val PARIS = Pair(48.8566f, 2.3522f)
private val LONDON = Pair(51.5074f, 0.1278f)
private val SHANGHAI = Pair(31.2304f, 121.4737f)
- private val MADRID = Pair(40.4168f, 3.7038f)
+ private val MADRID = Pair(40.4168f, -3.7038f)
private val LAHORE = Pair(31.5204f, 74.3587f)
- private val CHICAGO = Pair(41.8781f, 87.6298f)
+ private val CHICAGO = Pair(41.8781f, -87.6298f)
val citiesLocationsList = listOf(
BARCELONA,
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
index 6821a33..bc35521 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
@@ -63,7 +63,7 @@ class FakeLocationFragment :
NavToolbarFragment(R.layout.fragment_fake_location),
MVIView<FakeLocationFeature.State, Action> {
- private var isCameraMoved: Boolean = false
+ private var isFirstLaunch: Boolean = true
private val dependencyContainer: DependencyContainer by lazy {
(this.requireActivity().application as PrivacyCentralApplication).dependencyContainer
@@ -96,8 +96,20 @@ class FakeLocationFragment :
is FakeLocationFeature.SingleEvent.ErrorEvent -> {
displayToast(event.error)
}
- is FakeLocationFeature.SingleEvent.LocationUpdatedEvent ->
+ is FakeLocationFeature.SingleEvent.LocationUpdatedEvent -> {
+ if (isFirstLaunch && mapboxMap != null) {
+ mapboxMap?.moveCamera(
+ CameraUpdateFactory.newLatLng(
+ LatLng(
+ event.location?.latitude ?: 0.0,
+ event.location?.longitude ?: 0.0
+ )
+ )
+ )
+ isFirstLaunch = false
+ }
updateLocation(event.location)
+ }
}
}
}
@@ -121,7 +133,7 @@ class FakeLocationFragment :
binding.mapView.setup(savedInstanceState) { mapboxMap ->
this.mapboxMap = mapboxMap
- mapboxMap.getUiSettings().isRotateGesturesEnabled = false
+ mapboxMap.uiSettings.isRotateGesturesEnabled = false
mapboxMap.setStyle(Style.MAPBOX_STREETS) { style ->
enableLocationPlugin(style)
@@ -149,7 +161,7 @@ class FakeLocationFragment :
isLat: Boolean
) = { editable: Editable? ->
inputJob?.cancel()
- if (editable != null && editable.length > 0 && editText.isEnabled) {
+ if (editable != null && editable.isNotEmpty() && editText.isEnabled) {
inputJob = lifecycleScope.launch {
delay(DEBOUNCE_PERIOD)
ensureActive()
@@ -238,7 +250,6 @@ class FakeLocationFragment :
binding.mapView.isEnabled = (state.mode == LocationMode.SPECIFIC_LOCATION)
if (state.mode != LocationMode.SPECIFIC_LOCATION) {
- isCameraMoved = false
binding.centeredMarker.isVisible = false
} else {
binding.mapLoader.isVisible = false
@@ -247,7 +258,10 @@ class FakeLocationFragment :
mapboxMap?.moveCamera(
CameraUpdateFactory.newLatLng(
- LatLng(state.specificLatitude?.toDouble() ?: 0.0, state.specificLongitude?.toDouble() ?: 0.0)
+ LatLng(
+ state.specificLatitude?.toDouble() ?: 0.0,
+ state.specificLongitude?.toDouble() ?: 0.0
+ )
)
)
}
diff --git a/app/src/main/res/layout/fragment_fake_location.xml b/app/src/main/res/layout/fragment_fake_location.xml
index 065d222..64432cb 100644
--- a/app/src/main/res/layout/fragment_fake_location.xml
+++ b/app/src/main/res/layout/fragment_fake_location.xml
@@ -117,7 +117,7 @@
>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edittext_longitude"
- android:inputType="numberDecimal"
+ android:inputType="numberDecimal|numberSigned"
android:layout_height="wrap_content"
android:layout_width="match_parent"
/>
@@ -136,7 +136,7 @@
>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edittext_latitude"
- android:inputType="numberDecimal"
+ android:inputType="numberDecimal|numberSigned"
android:layout_height="wrap_content"
android:layout_width="match_parent"
/>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 60cd9e4..febea31 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -2,7 +2,7 @@
<!-- Base application theme. -->
<style name="Theme.PrivacyCentralApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
- <item name="colorPrimary">@color/primary</item>
+ <item name="colorPrimary">@color/accent</item>
<item name="colorAccent">@color/accent</item>
<!-- Status bar color. -->