make data provider for place search selectable in settings

This commit is contained in:
johan12345
2021-08-28 21:19:27 +02:00
parent 36f34bde1e
commit e96fcd4a88
10 changed files with 57 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package net.vonforst.evmap.fragment
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
@@ -122,6 +123,12 @@ class SettingsFragment : PreferenceFragmentCompat(),
"chargeprice_my_tariffs" -> {
updateMyTariffsSummary()
}
"search_provider" -> {
if (prefs.searchProvider == "google") {
Toast.makeText(context, R.string.pref_search_provider_info, Toast.LENGTH_LONG)
.show()
}
}
}
}

View File

@@ -80,6 +80,12 @@ class PreferenceDataSource(val context: Context) {
context.getString(R.string.pref_map_provider_default)
)!!
val searchProvider: String
get() = sp.getString(
"search_provider",
context.getString(R.string.pref_search_provider_default)
)!!
var mapType: AnyMap.Type
get() = AnyMap.Type.valueOf(sp.getString("map_type", null) ?: AnyMap.Type.NORMAL.toString())
set(type) {