mirror of
https://github.com/ev-map/EVMap.git
synced 2026-01-20 21:07:47 -05:00
Add URLs to edit nobil chargers
There's a web page for Swedish chargers, but we need to send email for the other countries.
This commit is contained in:
committed by
Johan von Forstner
parent
126c47bbc1
commit
1663607171
@@ -1,5 +1,6 @@
|
||||
package net.vonforst.evmap.api.nobil
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
@@ -114,7 +115,10 @@ data class NobilChargerStation(
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
).toString() else null,
|
||||
"https://nobil.no",
|
||||
null,
|
||||
when (chargerStationData.landCode) {
|
||||
"SWE" -> "https://www.energimyndigheten.se/klimat/transporter/laddinfrastruktur/registrera-din-laddstation/elbilsagare/"
|
||||
else -> "mailto:post@nobil.no?subject=" + Uri.encode("Regarding charging station " + chargerStationData.internationalId)
|
||||
},
|
||||
null,
|
||||
chargerStationData.ocpiId != null ||
|
||||
chargerStationData.updated.isAfter(LocalDateTime.now().minusMonths(6)),
|
||||
|
||||
@@ -3,11 +3,14 @@ package net.vonforst.evmap.fragment
|
||||
import android.Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.method.KeyListener
|
||||
@@ -509,7 +512,23 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
R.id.menu_edit -> {
|
||||
val charger = vm.charger.value?.data
|
||||
if (charger?.editUrl != null) {
|
||||
(activity as? MapsActivity)?.openUrl(charger.editUrl, binding.root, true)
|
||||
val uri = Uri.parse(charger.editUrl)
|
||||
if (uri.getScheme() == "mailto") {
|
||||
val intent = Intent(Intent.ACTION_SENDTO, uri)
|
||||
try {
|
||||
startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
R.string.no_email_app_found,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
else {
|
||||
(activity as? MapsActivity)?.openUrl(charger.editUrl, binding.root, true)
|
||||
}
|
||||
|
||||
if (vm.apiId.value == "goingelectric") {
|
||||
// instructions specific to GoingElectric
|
||||
Toast.makeText(
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<string name="connectors">Laddkontakter</string>
|
||||
<string name="no_maps_app_found">Installera en kartapp först</string>
|
||||
<string name="no_browser_app_found">Installera en webbläsare först</string>
|
||||
<string name="no_email_app_found">Installera en e-postapp först</string>
|
||||
<string name="address">Adress</string>
|
||||
<string name="operator">Operatör</string>
|
||||
<string name="network">Nätverk</string>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<string name="connectors">Connectors</string>
|
||||
<string name="no_maps_app_found">Install a navigation app first</string>
|
||||
<string name="no_browser_app_found">Install a web browser first</string>
|
||||
<string name="no_email_app_found">Install an email app first</string>
|
||||
<string name="address">Address</string>
|
||||
<string name="operator">Operator</string>
|
||||
<string name="network">Network</string>
|
||||
|
||||
Reference in New Issue
Block a user