mirror of
https://github.com/ev-map/EVMap.git
synced 2025-12-23 23:27:46 -05:00
add dialog to explain removal of Chargeprice data
This commit is contained in:
committed by
Johan von Forstner
parent
21e23efb50
commit
12c1c6a5ec
@@ -151,6 +151,18 @@ class ChargerDetailScreen(
|
||||
)
|
||||
.setTitle(carContext.getString(R.string.auto_prices))
|
||||
.setOnClickListener {
|
||||
if (!prefs.chargepriceRemoval2025DialogShown) {
|
||||
screenManager.push(
|
||||
TextDialogScreen(
|
||||
carContext,
|
||||
R.string.chargeprice_removal_2025_dialog_title,
|
||||
R.string.chargeprice_removal_2025_dialog_detail
|
||||
)
|
||||
)
|
||||
prefs.chargepriceRemoval2025DialogShown = true
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val intent = Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse(ChargepriceApi.getPoiUrl(charger))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.vonforst.evmap.auto
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.car.app.CarContext
|
||||
import androidx.car.app.Screen
|
||||
import androidx.car.app.model.Action
|
||||
import androidx.car.app.model.LongMessageTemplate
|
||||
import androidx.car.app.model.Template
|
||||
|
||||
class TextDialogScreen(
|
||||
ctx: CarContext,
|
||||
@StringRes val title: Int,
|
||||
@StringRes val message: Int
|
||||
) : Screen(ctx) {
|
||||
override fun onGetTemplate(): Template {
|
||||
return LongMessageTemplate.Builder(carContext.getString(message)).apply {
|
||||
setTitle(carContext.getString(title))
|
||||
setHeaderAction(Action.BACK)
|
||||
}.build()
|
||||
}
|
||||
}
|
||||
@@ -447,6 +447,24 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
|
||||
}
|
||||
binding.detailView.btnChargeprice.setOnClickListener {
|
||||
val charger = vm.charger.value?.data ?: return@setOnClickListener
|
||||
|
||||
if (prefs.chargepriceCounter > 0 && !prefs.chargepriceRemoval2025DialogShown) {
|
||||
// user has been using the native Chargeprice integration before
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(R.string.chargeprice_removal_2025_dialog_title)
|
||||
.setMessage(R.string.chargeprice_removal_2025_dialog_detail)
|
||||
.setPositiveButton(R.string.ok) { di, _ ->
|
||||
di.cancel()
|
||||
prefs.chargepriceRemoval2025DialogShown = true
|
||||
(activity as? MapsActivity)?.openUrl(
|
||||
ChargepriceApi.getPoiUrl(charger),
|
||||
binding.root
|
||||
)
|
||||
}
|
||||
.show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
(activity as? MapsActivity)?.openUrl(
|
||||
ChargepriceApi.getPoiUrl(charger),
|
||||
binding.root
|
||||
|
||||
@@ -167,6 +167,12 @@ class PreferenceDataSource(val context: Context) {
|
||||
sp.edit().putLong("chargeprice_counter", value).apply()
|
||||
}
|
||||
|
||||
var chargepriceRemoval2025DialogShown: Boolean
|
||||
get() = sp.getBoolean("chargeprice_removal_2025_dialog_shown", false)
|
||||
set(value) {
|
||||
sp.edit().putBoolean("chargeprice_removal_2025_dialog_shown", value).apply()
|
||||
}
|
||||
|
||||
var opensourceDonationsDialogLastShown: Instant
|
||||
get() = Instant.ofEpochMilli(sp.getLong("opensource_donations_dialog_last_shown", 0L))
|
||||
set(value) {
|
||||
|
||||
@@ -386,4 +386,6 @@
|
||||
<string name="accessibility_employees">Mitarbeiter</string>
|
||||
<string name="accessibility_by_appointment">Nach Vereinbarung</string>
|
||||
<string name="accessibility_residents">Bewohner</string>
|
||||
<string name="chargeprice_removal_2025_dialog_title">Sorry!</string>
|
||||
<string name="chargeprice_removal_2025_dialog_detail">Die Kosten für den Zugriff auf Chargeprice-Daten sind stark gestiegen und können nicht mehr durch Spenden gedeckt werden. Daher kann EVMap diese Daten nicht mehr direkt anzeigen. Hier öffnet sich nun die Chargeprice-Website. Eine alternative Lösung ist in Arbeit, wird aber Zeit brauchen und anfangs nur eingeschränkt funktionieren. Danke für eure Geduld und Unterstützung!</string>
|
||||
</resources>
|
||||
|
||||
@@ -386,4 +386,6 @@
|
||||
<string name="accessibility_employees">Employees</string>
|
||||
<string name="accessibility_by_appointment">By appointment</string>
|
||||
<string name="accessibility_residents">Residents</string>
|
||||
<string name="chargeprice_removal_2025_dialog_title">Sorry!</string>
|
||||
<string name="chargeprice_removal_2025_dialog_detail">Costs for Chargeprice data access have risen sharply and can’t be covered by donations, so EVMap can no longer show this data directly. For now, this opens the Chargeprice website. An alternative solution is being developed, but it’ll take time and may start with limited features. Thanks for your patience and support!</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user