mirror of
https://github.com/ZCShou/GoGoGo.git
synced 2026-06-05 21:00:50 +08:00
fix: set map key
This commit is contained in:
parent
ffcc08e4d1
commit
7fabfd687b
@ -68,7 +68,6 @@ public class FragmentSettings extends PreferenceFragmentCompat {
|
||||
EditTextPreference pfMapKey = findPreference("setting_map_key");
|
||||
if (pfMapKey != null) {
|
||||
pfMapKey.setSummary(pfMapKey.getText());
|
||||
pfMapKey.setText("P9I4SjSfRtFenM1hLTyZwoW3YLnmtSda");
|
||||
pfMapKey.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if (newValue.toString().trim().isEmpty()) {
|
||||
GoUtils.DisplayToast(this.getContext(), getResources().getString(R.string.app_error_input_null));
|
||||
@ -80,6 +79,7 @@ public class FragmentSettings extends PreferenceFragmentCompat {
|
||||
} else {
|
||||
pfMapKey.setSummary(newValue.toString());
|
||||
SDKInitializer.setApiKey(newValue.toString());
|
||||
SDKInitializer.initialize(requireContext().getApplicationContext());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -610,6 +610,7 @@ public class MainActivity extends BaseActivity implements SensorEventListener {
|
||||
// 从参数区取地图key
|
||||
String key = sharedPreferences.getString("setting_map_key", getResources().getString(R.string.setting_map_key_default));
|
||||
SDKInitializer.setApiKey(key);
|
||||
SDKInitializer.initialize(getApplicationContext());
|
||||
// 地图初始化
|
||||
mMapView = findViewById(R.id.bdMapView);
|
||||
mMapView.showZoomControls(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user