Merge pull request #9291 from osmandapp/speed_cameras_fix

Speed cameras fix
This commit is contained in:
max-klaus 2020-06-23 12:24:09 +03:00 committed by GitHub
commit b358ecca66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 15 deletions

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="speed_cameras_removed_descr">This device doesn\'t have speed cameras.</string>
<string name="shared_string_uninstall_and_restart">Uninstall and Restart</string>
<string name="speed_cameras_restart_descr">Restart is needed to completely delete speed camera data.</string>
<string name="item_deleted">%1$s deleted</string>

View file

@ -69,7 +69,7 @@
android:key="speed_cameras_uninstalled"
android:persistent="false"
android:layout="@layout/preference_with_descr"
android:title="@string/uninstall_speed_cameras"
tools:title="@string/uninstall_speed_cameras"
tools:icon="@drawable/ic_speed_camera_disabled" />
</PreferenceScreen>

View file

@ -822,7 +822,7 @@ public class PoiFiltersHelper {
String subCategory = query.getString(2);
if (subCategory == null) {
m.put(a, null);
} else {
} else if (!mapPoiTypes.isTypeForbidden(subCategory)) {
if (m.get(a) == null) {
m.put(a, new LinkedHashSet<String>());
}
@ -849,7 +849,9 @@ public class PoiFiltersHelper {
map.get(filterId), application);
filter.setSavedFilterByName(query.getString(2));
filter.setDeleted(deleted);
list.add(filter);
if (filter.getAcceptedTypesCount() > 0) {
list.add(filter);
}
}
} while (query.moveToNext());
}

View file

@ -30,7 +30,6 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
private static final String SEND_ANONYMOUS_DATA_PREF_ID = "send_anonymous_data";
private static final String DIALOGS_AND_NOTIFICATIONS_PREF_ID = "dialogs_and_notifications";
private static final String LEGAL_CATEGORY_ID = "legal";
@Override
protected void setupPreferences() {
@ -41,7 +40,6 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
setupSendAnonymousDataPref();
setupDialogsAndNotificationsPref();
setupEnableProxyPref();
setupLegalCategory();
setupUninstallSpeedCamerasPref();
}
@ -108,7 +106,6 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
app.restartApp(activity);
}
} else if (prefId.equals(settings.SPEED_CAMERAS_UNINSTALLED.getId())) {
setupLegalCategory();
setupUninstallSpeedCamerasPref();
}
}
@ -121,7 +118,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
@Override
public boolean onPreferenceClick(Preference preference) {
String prefId = preference.getKey();
if (settings.SPEED_CAMERAS_UNINSTALLED.getId().equals(prefId)) {
if (settings.SPEED_CAMERAS_UNINSTALLED.getId().equals(prefId) && !settings.SPEED_CAMERAS_UNINSTALLED.get()) {
FragmentManager fm = getFragmentManager();
if (fm != null) {
SpeedCamerasBottomSheet.showInstance(fm, this);
@ -214,14 +211,12 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
enableProxy.setIcon(getPersistentPrefIcon(R.drawable.ic_action_proxy));
}
private void setupLegalCategory() {
PreferenceCategory legalCategory = (PreferenceCategory) findPreference(LEGAL_CATEGORY_ID);
legalCategory.setVisible(!settings.SPEED_CAMERAS_UNINSTALLED.get());
}
private void setupUninstallSpeedCamerasPref() {
boolean uninstalled = settings.SPEED_CAMERAS_UNINSTALLED.get();
Preference uninstallSpeedCameras = (Preference) findPreference(settings.SPEED_CAMERAS_UNINSTALLED.getId());
uninstallSpeedCameras.setIcon(getActiveIcon(R.drawable.ic_speed_camera_disabled));
uninstallSpeedCameras.setVisible(!settings.SPEED_CAMERAS_UNINSTALLED.get());
if (!uninstalled) {
uninstallSpeedCameras.setIcon(getActiveIcon(R.drawable.ic_speed_camera_disabled));
}
uninstallSpeedCameras.setTitle(uninstalled ? R.string.speed_cameras_removed_descr : R.string.uninstall_speed_cameras);
}
}

View file

@ -150,7 +150,7 @@ public class ScreenAlertsFragment extends BaseSettingsFragment implements OnPref
return getIcon(americanSigns ? R.drawable.warnings_traffic_calming_us : R.drawable.warnings_traffic_calming);
} else if (settings.SHOW_PEDESTRIAN.getModeValue(selectedMode)) {
return getIcon(americanSigns ? R.drawable.warnings_pedestrian_us : R.drawable.warnings_pedestrian);
} else if (settings.SHOW_CAMERAS.getModeValue(selectedMode)) {
} else if (settings.SHOW_CAMERAS.getModeValue(selectedMode) && !settings.SPEED_CAMERAS_UNINSTALLED.get()) {
return getIcon(R.drawable.warnings_speed_camera);
} else if (settings.SHOW_TUNNELS.getModeValue(selectedMode)) {
return getIcon(americanSigns ? R.drawable.warnings_tunnel_us : R.drawable.warnings_tunnel);