mirror of
https://github.com/ZCShou/GoGoGo.git
synced 2026-06-05 21:00:50 +08:00
chore: clean
This commit is contained in:
parent
aa6ac5219e
commit
f18830ef47
@ -61,11 +61,6 @@
|
||||
android:name="org.apache.http.legacy"
|
||||
android:required="false" />
|
||||
|
||||
<!-- 百度地图开发者 Key -->
|
||||
<meta-data
|
||||
android:name="com.baidu.lbsapi.API_KEY"
|
||||
android:value="${MAPS_API_KEY}" />
|
||||
|
||||
<!-- 百度地图 间隔定位必须配置此service否则功能无效 -->
|
||||
<service
|
||||
android:name="com.baidu.location.f"
|
||||
|
||||
@ -59,33 +59,6 @@ public class FragmentSettings extends PreferenceFragmentCompat {
|
||||
EditTextPreference pfAltitude = findPreference("setting_altitude");
|
||||
setupDecimalEditTextPreference(pfAltitude);
|
||||
|
||||
ListPreference pfMap = findPreference("setting_map_type");
|
||||
if (pfMap != null) {
|
||||
// 使用自定义 SummaryProvider
|
||||
pfMap.setSummaryProvider((Preference.SummaryProvider<ListPreference>) preference -> Objects.requireNonNull(preference.getEntry()));
|
||||
pfMap.setOnPreferenceChangeListener((preference, newValue) -> !newValue.toString().trim().isEmpty());
|
||||
}
|
||||
EditTextPreference pfMapKey = findPreference("setting_map_key");
|
||||
if (pfMapKey != null) {
|
||||
pfMapKey.setSummary(pfMapKey.getText());
|
||||
pfMapKey.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if (newValue.toString().trim().isEmpty()) {
|
||||
GoUtils.DisplayToast(this.getContext(), getResources().getString(R.string.app_error_input_null));
|
||||
return false;
|
||||
} else {
|
||||
if (!newValue.toString().matches("[a-zA-Z0-9]+")) {
|
||||
GoUtils.DisplayToast(this.getContext(), getResources().getString(R.string.app_error_input));
|
||||
return false;
|
||||
} else {
|
||||
pfMapKey.setSummary(newValue.toString());
|
||||
SDKInitializer.setApiKey(newValue.toString());
|
||||
SDKInitializer.initialize(requireContext().getApplicationContext());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
EditTextPreference pfLatOffset = findPreference("setting_lat_max_offset");
|
||||
setupDecimalEditTextPreference(pfLatOffset);
|
||||
|
||||
|
||||
@ -34,14 +34,11 @@ public class GoApplication extends Application {
|
||||
SDKInitializer.setAgreePrivacy(this, true);
|
||||
// 百度定位 7.5 开始,要求必须同意隐私政策,默认为false(官方说可以统一为以上接口,但实际测试并不行,定位还是需要单独设置)
|
||||
LocationClient.setAgreePrivacy(true);
|
||||
SDKInitializer.setApiKey(BuildConfig.MAPS_API_KEY);
|
||||
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
|
||||
SDKInitializer.initialize(this);
|
||||
|
||||
try {
|
||||
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
|
||||
SDKInitializer.initialize(this);
|
||||
SDKInitializer.setCoordType(CoordType.BD09LL);
|
||||
} catch (BaiduMapSDKException e) {
|
||||
XLog.e("ERROR init baidu sdk");
|
||||
}
|
||||
SDKInitializer.setCoordType(CoordType.BD09LL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -455,13 +455,6 @@ public class MainActivity extends BaseActivity implements SensorEventListener {
|
||||
|
||||
/*============================== 主界面地图 相关 ==============================*/
|
||||
private void initMap() {
|
||||
// 从参数区取地图key
|
||||
String key = sharedPreferences.getString("setting_map_key", BuildConfig.MAPS_API_KEY);
|
||||
if (key != null && !key.equals(getResources().getString(R.string.setting_map_key_default))) {
|
||||
SDKInitializer.setApiKey(key);
|
||||
SDKInitializer.initialize(getApplicationContext());
|
||||
}
|
||||
|
||||
// 地图初始化
|
||||
mMapView = findViewById(R.id.bdMapView);
|
||||
mMapView.showZoomControls(false);
|
||||
|
||||
@ -63,11 +63,7 @@
|
||||
<string name="setting_bike_default">10.0</string>
|
||||
<string name="setting_altitude">海拔高度(米)</string>
|
||||
<string name="setting_altitude_default">55.0</string>
|
||||
<!-- 地图相关参数 -->
|
||||
<string name="setting_group_map">地图</string>
|
||||
<string name="setting_map_type">地图类型</string>
|
||||
<string name="setting_map_key">地图 KEY</string>
|
||||
<string name="setting_map_key_default">无自定义 KEY</string>
|
||||
|
||||
<!-- 位置偏移相关参数 -->
|
||||
<string name="setting_group_location_offset">位置偏移</string>
|
||||
<string name="setting_random_offset">随机偏移</string>
|
||||
|
||||
@ -45,29 +45,6 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
app:title="@string/setting_group_map"
|
||||
app:iconSpaceReserved="false">
|
||||
<ListPreference
|
||||
app:key="setting_map_type"
|
||||
app:title="@string/setting_map_type"
|
||||
app:entries="@array/array_map_type"
|
||||
app:entryValues="@array/array_map_type_values"
|
||||
app:dialogTitle="@string/setting_map_type"
|
||||
app:defaultValue="0"
|
||||
app:iconSpaceReserved="false">
|
||||
</ListPreference>
|
||||
|
||||
<EditTextPreference
|
||||
app:key="setting_map_key"
|
||||
app:title="@string/setting_map_key"
|
||||
app:defaultValue="@string/setting_map_key_default"
|
||||
app:summary="@string/setting_map_key_default"
|
||||
android:inputType="textCapCharacters|textNoSuggestions"
|
||||
app:iconSpaceReserved="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
app:title="@string/setting_group_location_offset"
|
||||
app:iconSpaceReserved="false">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user