mirror of
https://github.com/ev-map/EVMap.git
synced 2025-12-30 18:47:46 -05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ff8329171 | ||
|
|
e9b70a2f00 | ||
|
|
c4c3aba7c7 | ||
|
|
890af2ddef | ||
|
|
ba0b36b3ec | ||
|
|
161b48789f | ||
|
|
042b983aa3 | ||
|
|
1c21da7be0 | ||
|
|
405baed0f7 | ||
|
|
19c0d57f2b | ||
|
|
42c2a2f72a | ||
|
|
36ee3ff231 | ||
|
|
883735ef05 |
52
.github/workflows/tests.yml
vendored
52
.github/workflows/tests.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Copy apikeys.xml
|
||||
run: cp .github/workflows/apikeys-ci.xml app/src/main/res/values/apikeys.xml
|
||||
run: cp _ci/apikeys-ci.xml app/src/main/res/values/apikeys.xml
|
||||
|
||||
- name: Build app
|
||||
run: ./gradlew assemble${{ matrix.buildvariant }}Debug --no-daemon
|
||||
@@ -36,3 +36,53 @@ jobs:
|
||||
run: ./gradlew lint${{ matrix.buildvariant }}Debug --no-daemon
|
||||
- name: Check licenses
|
||||
run: ./gradlew exportLibraryDefinitions --no-daemon
|
||||
|
||||
apk_check:
|
||||
name: Release APK checks (${{ matrix.buildvariant }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
buildvariant: [ FossNormal, FossAutomotive, GoogleNormal, GoogleAutomotive ]
|
||||
|
||||
steps:
|
||||
- name: Install checksec
|
||||
run: sudo apt install -y checksec
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java environment
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'zulu'
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Copy apikeys.xml
|
||||
run: cp _ci/apikeys-ci.xml app/src/main/res/values/apikeys.xml
|
||||
|
||||
- name: Build app
|
||||
run: ./gradlew assemble${{ matrix.buildvariant }}Release --no-daemon
|
||||
|
||||
- name: Unpack native libraries from APK
|
||||
run: |
|
||||
VARIANT_FILENAME=$(echo ${{ matrix.buildvariant }} | sed -E 's/([a-z])([A-Z])/\1-\2/g' | tr 'A-Z' 'a-z')
|
||||
VARIANT_FOLDER=$(echo ${{ matrix.buildvariant }} | sed -E 's/^([A-Z])/\L\1/')
|
||||
APK_FILE="app/build/outputs/apk/$VARIANT_FOLDER/release/app-$VARIANT_FILENAME-release-unsigned.apk"
|
||||
unzip $APK_FILE "lib/*"
|
||||
|
||||
- name: Run checksec on native libraries
|
||||
run: |
|
||||
checksec --output=json --dir=lib > checksec_output.json
|
||||
jq --argjson exceptions '[
|
||||
"lib/armeabi-v7a/libc++_shared.so",
|
||||
"lib/x86/libc++_shared.so"
|
||||
]' '
|
||||
to_entries
|
||||
| map(select(.value.fortify_source == "no" and (.key as $lib | $exceptions | index($lib) | not)))
|
||||
| if length > 0 then
|
||||
error("The following libraries do not have fortify enabled (and are not in the exception list): " + (map(.key) | join(", ")))
|
||||
else
|
||||
"All libraries have fortify enabled or are in the exception list."
|
||||
end
|
||||
' checksec_output.json
|
||||
|
||||
@@ -20,16 +20,18 @@ android {
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
// NOTE: always increase versionCode by 2 since automotive flavor uses versionCode + 1
|
||||
versionCode = 246
|
||||
versionName = "1.9.13"
|
||||
versionCode = 250
|
||||
versionName = "1.9.15"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
val isRunningOnCI = System.getenv("CI") == "true"
|
||||
val isCIKeystoreAvailable = System.getenv("KEYSTORE_PASSWORD") != null
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
val isRunningOnCI = System.getenv("CI") == "true"
|
||||
if (isRunningOnCI) {
|
||||
if (isRunningOnCI && isCIKeystoreAvailable) {
|
||||
// configure keystore
|
||||
storeFile = file("../_ci/keystore.jks")
|
||||
storePassword = System.getenv("KEYSTORE_PASSWORD")
|
||||
@@ -46,7 +48,11 @@ android {
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
signingConfig = if (isRunningOnCI && !isCIKeystoreAvailable) {
|
||||
null
|
||||
} else {
|
||||
signingConfigs.getByName("release")
|
||||
}
|
||||
}
|
||||
create("releaseAutomotivePackageName") {
|
||||
// Faurecia Aptoide requires the automotive variant to use a separate package name
|
||||
@@ -315,7 +321,7 @@ dependencies {
|
||||
automotiveImplementation("androidx.car.app:app-automotive:$carAppVersion")
|
||||
|
||||
// AnyMaps
|
||||
val anyMapsVersion = "1174ef9375"
|
||||
val anyMapsVersion = "a3290b148d"
|
||||
implementation("com.github.ev-map.AnyMaps:anymaps-base:$anyMapsVersion")
|
||||
googleImplementation("com.github.ev-map.AnyMaps:anymaps-google:$anyMapsVersion")
|
||||
googleImplementation("com.google.android.gms:play-services-maps:19.0.0")
|
||||
@@ -323,7 +329,7 @@ dependencies {
|
||||
// duplicates classes from mapbox-sdk-services
|
||||
exclude("org.maplibre.gl", "android-sdk-geojson")
|
||||
}
|
||||
implementation("org.maplibre.gl:android-sdk:10.3.3") {
|
||||
implementation("org.maplibre.gl:android-sdk:10.3.4") {
|
||||
exclude("org.maplibre.gl", "android-sdk-geojson")
|
||||
}
|
||||
|
||||
@@ -348,7 +354,12 @@ dependencies {
|
||||
implementation("androidx.room:room-runtime:$room_version")
|
||||
kapt("androidx.room:room-compiler:$room_version")
|
||||
implementation("androidx.room:room-ktx:$room_version")
|
||||
implementation("com.github.anboralabs:spatia-room:0.3.0")
|
||||
implementation("com.github.anboralabs:spatia-room:0.3.0") {
|
||||
exclude("com.github.dalgarins", "android-spatialite")
|
||||
}
|
||||
// forked version with upgraded sqlite & libxml
|
||||
// https://github.com/dalgarins/android-spatialite/pull/10
|
||||
implementation("com.github.ev-map:android-spatialite:31495dcd81")
|
||||
|
||||
// billing library
|
||||
val billing_version = "7.0.0"
|
||||
|
||||
@@ -45,14 +45,20 @@ interface LocationAwareScreen {
|
||||
class CarAppService : androidx.car.app.CarAppService() {
|
||||
private val CHANNEL_ID = "car_location"
|
||||
private val NOTIFICATION_ID = 1000
|
||||
private val TAG = "CarAppService"
|
||||
private var foregroundStarted = false
|
||||
|
||||
fun ensureForegroundService() {
|
||||
// we want to run as a foreground service to make sure we can use location
|
||||
if (!foregroundStarted) {
|
||||
createNotificationChannel()
|
||||
startForeground(NOTIFICATION_ID, getNotification())
|
||||
foregroundStarted = true
|
||||
try {
|
||||
if (!foregroundStarted) {
|
||||
createNotificationChannel()
|
||||
startForeground(NOTIFICATION_ID, getNotification())
|
||||
foregroundStarted = true
|
||||
Log.i(TAG, "Started foreground service")
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.w(TAG, "Failed to start foreground service: ", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,11 @@ class ChargepriceFragment : Fragment() {
|
||||
}
|
||||
false
|
||||
}
|
||||
headerBinding.tvChargeFromTo.setOnClickListener {
|
||||
it.postDelayed({
|
||||
vm.resetBatteryRangeToDefault()
|
||||
}, 250)
|
||||
}
|
||||
|
||||
binding.toolbar.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
|
||||
@@ -1065,7 +1065,6 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
|
||||
override fun onMapReady(map: AnyMap) {
|
||||
this.map = map
|
||||
vm.mapProjection = map.projection
|
||||
val context = this.context ?: return
|
||||
view ?: return
|
||||
|
||||
@@ -1095,14 +1094,12 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
map.uiSettings.setIndoorLevelPickerEnabled(false)
|
||||
|
||||
map.setOnCameraIdleListener {
|
||||
vm.mapProjection = map.projection
|
||||
vm.mapPosition.value = MapPosition(
|
||||
map.projection.visibleRegion.latLngBounds, map.cameraPosition.zoom
|
||||
)
|
||||
vm.reloadChargepoints()
|
||||
}
|
||||
map.setOnCameraMoveListener {
|
||||
vm.mapProjection = map.projection
|
||||
vm.mapPosition.value = MapPosition(
|
||||
map.projection.visibleRegion.latLngBounds, map.cameraPosition.zoom
|
||||
)
|
||||
@@ -1602,12 +1599,10 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
detailsDialog.onDestroy()
|
||||
vm.mapProjection = null
|
||||
|
||||
map = null
|
||||
mapFragment = null
|
||||
_binding = null
|
||||
vm.mapProjection = null
|
||||
markers.clear()
|
||||
clusterMarkers = emptyList()
|
||||
searchResultMarker = null
|
||||
|
||||
@@ -44,7 +44,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
try {
|
||||
return locationManager.getLastKnownLocation(LocationManager.FUSED_PROVIDER)
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "Permissions not granted for fused provider", e)
|
||||
Log.w(TAG, "Permissions not granted for fused provider", e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
}
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "Permissions not granted for provider: $provider", e)
|
||||
Log.w(TAG, "Permissions not granted for provider: $provider", e)
|
||||
}
|
||||
}
|
||||
return bestLocation
|
||||
@@ -103,7 +103,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
enableFused(gpsInterval)
|
||||
checkLastKnownFused()
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "Permissions not granted for fused provider", e)
|
||||
Log.w(TAG, "Permissions not granted for fused provider", e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
looper
|
||||
)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.e(TAG, "Unable to register for GPS updates.", e)
|
||||
Log.w(TAG, "Unable to register for GPS updates.", e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
looper
|
||||
)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.e(TAG, "Unable to register for network updates.", e)
|
||||
Log.w(TAG, "Unable to register for network updates.", e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
looper
|
||||
)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.e(TAG, "Unable to register for passive updates.", e)
|
||||
Log.w(TAG, "Unable to register for passive updates.", e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class FusionEngine(context: Context) : LocationEngine(context),
|
||||
looper
|
||||
)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.e(TAG, "Unable to register for passive updates.", e)
|
||||
Log.w(TAG, "Unable to register for passive updates.", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ import net.vonforst.evmap.api.goingelectric.GoingElectricApiWrapper
|
||||
import net.vonforst.evmap.api.openchargemap.OpenChargeMapApiWrapper
|
||||
import net.vonforst.evmap.model.*
|
||||
import net.vonforst.evmap.ui.cluster
|
||||
import net.vonforst.evmap.utils.crossesAntimeridian
|
||||
import net.vonforst.evmap.utils.splitAtAntimeridian
|
||||
import net.vonforst.evmap.viewmodel.Resource
|
||||
import net.vonforst.evmap.viewmodel.Status
|
||||
import net.vonforst.evmap.viewmodel.await
|
||||
@@ -145,6 +147,14 @@ class ChargeLocationsRepository(
|
||||
filters: FilterValues?,
|
||||
overrideCache: Boolean = false
|
||||
): LiveData<Resource<List<ChargepointListItem>>> {
|
||||
if (bounds.crossesAntimeridian()) {
|
||||
val (a, b) = bounds.splitAtAntimeridian()
|
||||
val liveDataA = getChargepoints(a, zoom, filters, overrideCache)
|
||||
val liveDataB = getChargepoints(b, zoom, filters, overrideCache)
|
||||
return combineLiveData(liveDataA, liveDataB)
|
||||
}
|
||||
|
||||
|
||||
val api = api.value!!
|
||||
|
||||
val dbResult = if (filters == null) {
|
||||
@@ -208,6 +218,32 @@ class ChargeLocationsRepository(
|
||||
}
|
||||
}
|
||||
|
||||
private fun combineLiveData(
|
||||
liveDataA: LiveData<Resource<List<ChargepointListItem>>>,
|
||||
liveDataB: LiveData<Resource<List<ChargepointListItem>>>
|
||||
) = MediatorLiveData<Resource<List<ChargepointListItem>>>().apply {
|
||||
listOf(liveDataA, liveDataB).forEach {
|
||||
addSource(it) {
|
||||
val valA = liveDataA.value
|
||||
val valB = liveDataB.value
|
||||
val combinedList = if (valA?.data != null && valB?.data != null) {
|
||||
valA.data + valB.data
|
||||
} else if (valA?.data != null) {
|
||||
valA.data
|
||||
} else if (valB?.data != null) {
|
||||
valB.data
|
||||
} else null
|
||||
if (valA?.status == Status.SUCCESS && valB?.status == Status.SUCCESS) {
|
||||
Resource.success(combinedList)
|
||||
} else if (valA?.status == Status.ERROR || valB?.status == Status.ERROR) {
|
||||
Resource.error(valA?.message ?: valB?.message, combinedList)
|
||||
} else {
|
||||
Resource.loading(combinedList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getChargepointsRadius(
|
||||
location: LatLng,
|
||||
radius: Int,
|
||||
|
||||
@@ -6,8 +6,9 @@ import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.text.SpannableString
|
||||
import android.text.format.DateUtils
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.text.util.Linkify
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import android.widget.ImageView
|
||||
@@ -215,21 +216,25 @@ fun setTopMargin(view: View, topMargin: Float) {
|
||||
|
||||
/**
|
||||
* Linkify is already possible using the autoLink and linksClickable attributes, but this does not
|
||||
* remove spans correctly. So we implement a new version that manually removes the spans.
|
||||
* remove spans correctly after autoLink is set to false.
|
||||
* So we implement a new version that manually uses Linkify to create links if necessary.
|
||||
*/
|
||||
@BindingAdapter("linkify")
|
||||
fun setLinkify(textView: TextView, oldValue: Int, newValue: Int) {
|
||||
if (oldValue == newValue) return
|
||||
@BindingAdapter(value = ["linkify", "android:text"])
|
||||
fun setLinkify(
|
||||
textView: TextView,
|
||||
oldLinkify: Int,
|
||||
oldText: CharSequence?,
|
||||
newLinkify: Int,
|
||||
newText: CharSequence?
|
||||
) {
|
||||
if (oldLinkify == newLinkify && oldText == newText) return
|
||||
|
||||
textView.autoLinkMask = newValue
|
||||
textView.linksClickable = newValue != 0
|
||||
|
||||
// remove spans
|
||||
val text = textView.text
|
||||
if (newValue == 0 && text != null && text is SpannableString) {
|
||||
text.getSpans(0, text.length, Any::class.java).forEach {
|
||||
text.removeSpan(it)
|
||||
}
|
||||
textView.text = newText
|
||||
if (newLinkify != 0) {
|
||||
Linkify.addLinks(textView, newLinkify)
|
||||
textView.movementMethod = LinkMovementMethod.getInstance()
|
||||
} else {
|
||||
textView.movementMethod = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,15 @@ import androidx.core.content.ContextCompat
|
||||
import com.car2go.maps.model.LatLng
|
||||
import com.car2go.maps.model.LatLngBounds
|
||||
import net.vonforst.evmap.model.Coordinate
|
||||
import java.util.*
|
||||
import kotlin.math.*
|
||||
import java.util.Locale
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.asin
|
||||
import kotlin.math.atan2
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.floor
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.sin
|
||||
import kotlin.math.sqrt
|
||||
|
||||
/**
|
||||
* Adds a certain distance in meters to a location. Approximate calculation.
|
||||
@@ -152,4 +159,25 @@ fun Coordinate.formatDecimal(accuracy: Int = 6): String {
|
||||
|
||||
fun Location.formatDecimal(accuracy: Int = 6): String {
|
||||
return "%.${accuracy}f, %.${accuracy}f".format(Locale.ENGLISH, latitude, longitude)
|
||||
}
|
||||
|
||||
fun LatLngBounds.normalize() = LatLngBounds(
|
||||
LatLng(southwest.latitude, normalizeLongitude(southwest.longitude)),
|
||||
LatLng(northeast.latitude, normalizeLongitude(northeast.longitude)),
|
||||
)
|
||||
|
||||
private fun normalizeLongitude(long: Double) =
|
||||
if (-180.0 <= long && long <= 180.0) long else (long + 180) % 360 - 180
|
||||
|
||||
fun LatLngBounds.crossesAntimeridian() = southwest.longitude > 0 && northeast.longitude < 0
|
||||
|
||||
fun LatLngBounds.splitAtAntimeridian(): Pair<LatLngBounds, LatLngBounds> {
|
||||
if (!crossesAntimeridian()) throw IllegalArgumentException("does not cross antimeridian")
|
||||
return LatLngBounds(
|
||||
LatLng(southwest.latitude, southwest.longitude),
|
||||
LatLng(northeast.latitude, 180.0),
|
||||
) to LatLngBounds(
|
||||
LatLng(southwest.latitude, -180.0),
|
||||
LatLng(northeast.latitude, northeast.longitude),
|
||||
)
|
||||
}
|
||||
@@ -1,14 +1,29 @@
|
||||
package net.vonforst.evmap.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.*
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.distinctUntilChanged
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import jsonapi.Meta
|
||||
import jsonapi.Relationship
|
||||
import jsonapi.Relationships
|
||||
import jsonapi.ResourceIdentifier
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import net.vonforst.evmap.api.chargeprice.*
|
||||
import net.vonforst.evmap.api.chargeprice.ChargePrice
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceApi
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceCar
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceChargepointMeta
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceInclude
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceMeta
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceOptions
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceRequest
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceRequestTariffMeta
|
||||
import net.vonforst.evmap.api.chargeprice.ChargepriceStation
|
||||
import net.vonforst.evmap.api.equivalentPlugTypes
|
||||
import net.vonforst.evmap.model.ChargeLocation
|
||||
import net.vonforst.evmap.model.Chargepoint
|
||||
@@ -298,4 +313,8 @@ class ChargepriceViewModel(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun resetBatteryRangeToDefault() {
|
||||
batteryRange.value = prefs.chargepriceBatteryRangeAndroidAuto
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.vonforst.evmap.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import android.graphics.Point
|
||||
import android.os.Parcelable
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
@@ -14,7 +13,6 @@ import androidx.lifecycle.map
|
||||
import androidx.lifecycle.switchMap
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.car2go.maps.AnyMap
|
||||
import com.car2go.maps.Projection
|
||||
import com.car2go.maps.model.LatLng
|
||||
import com.car2go.maps.model.LatLngBounds
|
||||
import com.mahc.custombottomsheetbehavior.BottomSheetBehaviorGoogleMapsLike
|
||||
@@ -50,7 +48,8 @@ import net.vonforst.evmap.storage.FilterProfile
|
||||
import net.vonforst.evmap.storage.PreferenceDataSource
|
||||
import net.vonforst.evmap.ui.cluster
|
||||
import net.vonforst.evmap.utils.distanceBetween
|
||||
import kotlin.math.roundToInt
|
||||
import net.vonforst.evmap.utils.normalize
|
||||
import kotlin.math.cos
|
||||
|
||||
@Parcelize
|
||||
data class MapPosition(val bounds: LatLngBounds, val zoom: Float) : Parcelable
|
||||
@@ -76,7 +75,6 @@ class MapViewModel(application: Application, private val state: SavedStateHandle
|
||||
prefs
|
||||
)
|
||||
private val availabilityRepo = AvailabilityRepository(application)
|
||||
var mapProjection: Projection? = null
|
||||
|
||||
val apiId = repo.api.map { it.id }
|
||||
|
||||
@@ -471,14 +469,21 @@ class MapViewModel(application: Application, private val state: SavedStateHandle
|
||||
* expands LatLngBounds beyond the viewport (1.5x the width and height)
|
||||
*/
|
||||
private fun extendBounds(bounds: LatLngBounds): LatLngBounds {
|
||||
val mapProjection = mapProjection ?: return bounds
|
||||
val swPoint = mapProjection.toScreenLocation(bounds.southwest)
|
||||
val nePoint = mapProjection.toScreenLocation(bounds.northeast)
|
||||
val dx = ((nePoint.x - swPoint.x) * 0.25).roundToInt()
|
||||
val dy = ((nePoint.y - swPoint.y) * 0.25).roundToInt()
|
||||
val newSw = mapProjection.fromScreenLocation(Point(swPoint.x - dx, swPoint.y - dy))
|
||||
val newNe = mapProjection.fromScreenLocation(Point(nePoint.x + dx, nePoint.y + dy))
|
||||
return LatLngBounds(newSw, newNe)
|
||||
val sw = bounds.southwest
|
||||
val ne = bounds.northeast
|
||||
var west = sw.longitude - (ne.longitude - sw.longitude) * 0.25
|
||||
var east = ne.longitude + (ne.longitude - sw.longitude) * 0.25
|
||||
val south =
|
||||
sw.latitude - (ne.latitude - sw.latitude) * 0.25 * cos(Math.toRadians(sw.latitude))
|
||||
val north =
|
||||
ne.latitude + (ne.latitude - sw.latitude) * 0.25 * cos(Math.toRadians(ne.latitude))
|
||||
|
||||
if (east - west >= 360) {
|
||||
west = -180.0
|
||||
east = 180.0
|
||||
}
|
||||
|
||||
return LatLngBounds(LatLng(south, west), LatLng(north, east)).normalize()
|
||||
}
|
||||
|
||||
fun reloadAvailability() {
|
||||
|
||||
@@ -48,11 +48,14 @@
|
||||
tools:orientation="horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/tvChargeFromTo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?selectableItemBackground"
|
||||
android:text="@{String.format(@string/chargeprice_battery_range, vm.batteryRange[0], vm.batteryRange[1])}"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleSmall"
|
||||
android:textColor="?colorPrimary"
|
||||
@@ -68,8 +71,8 @@
|
||||
android:text="@{@string/chargeprice_stats(vm.chargepriceMetaForChargepoint.data.energy, BindingAdaptersKt.time((int) Math.round(vm.chargepriceMetaForChargepoint.data.duration)), vm.chargepriceMetaForChargepoint.data.energy / vm.chargepriceMetaForChargepoint.data.duration * 60)}"
|
||||
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
|
||||
app:invisibleUnlessAnimated="@{!vm.batteryRangeSliderDragging && vm.chargepriceMetaForChargepoint.status == Status.SUCCESS}"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:layout_constraintStart_toStartOf="@+id/tvChargeFromTo"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvChargeFromTo"
|
||||
tools:text="(18 kWh, approx. 23 min, ⌀ 50 kW)" />
|
||||
|
||||
<TextView
|
||||
|
||||
5
fastlane/metadata/android/de-DE/changelogs/248.txt
Normal file
5
fastlane/metadata/android/de-DE/changelogs/248.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Verbesserungen:
|
||||
- Preisvergleich: Zurücksetzen der Ladebereichsauswahl durch Tippen auf den Titel darüber
|
||||
|
||||
Fehler behoben:
|
||||
- Anzeigefehler behoben
|
||||
2
fastlane/metadata/android/de-DE/changelogs/250.txt
Normal file
2
fastlane/metadata/android/de-DE/changelogs/250.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Fehler behoben:
|
||||
- Anzeigefehler behoben
|
||||
5
fastlane/metadata/android/en-US/changelogs/248.txt
Normal file
5
fastlane/metadata/android/en-US/changelogs/248.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Improvements:
|
||||
- Price comparison: Reset charging range by tapping on title above it
|
||||
|
||||
Bugfixes:
|
||||
- Fixed display errors
|
||||
2
fastlane/metadata/android/en-US/changelogs/250.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/250.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Bugfixes:
|
||||
- Fixed display errors
|
||||
Reference in New Issue
Block a user