Merge pull request #11010 from osmandapp/fix_settings_inconsistencies
Fix settings inconsistencies
This commit is contained in:
commit
54a9ca41f7
3 changed files with 25 additions and 13 deletions
|
@ -690,6 +690,10 @@ public abstract class OsmandPlugin {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static <T extends OsmandPlugin> boolean isPluginEnabled(Class<T> clz) {
|
||||
return getEnabledPlugin(clz) != null;
|
||||
}
|
||||
|
||||
public static List<WorldRegion> getCustomDownloadRegions() {
|
||||
List<WorldRegion> l = new ArrayList<>();
|
||||
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {
|
|||
? getString(R.string.shared_string_disabled) : summaryOff.toString();
|
||||
final int activeColor = AndroidUtils.resolveAttribute(themedCtx, R.attr.active_color_basic);
|
||||
final int disabledColor = AndroidUtils.resolveAttribute(themedCtx, android.R.attr.textColorSecondary);
|
||||
boolean checked = pref.getModeValue(getAppMode());
|
||||
boolean checked = switchPreference.isChecked();
|
||||
|
||||
final BottomSheetItemWithCompoundButton[] preferenceBtn = new BottomSheetItemWithCompoundButton[1];
|
||||
preferenceBtn[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
|
||||
|
@ -77,7 +77,7 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {
|
|||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean newValue = !pref.getModeValue(getAppMode());
|
||||
boolean newValue = !switchPreference.isChecked();
|
||||
Fragment targetFragment = getTargetFragment();
|
||||
if (targetFragment instanceof OnConfirmPreferenceChange) {
|
||||
ApplyQueryType applyQueryType = getApplyQueryType();
|
||||
|
|
|
@ -28,9 +28,10 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.routing.RouteProvider;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
|
@ -326,17 +327,10 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
setupRouteRecalcHeader(screen);
|
||||
setupSelectRouteRecalcDistance(screen);
|
||||
setupReverseDirectionRecalculation(screen);
|
||||
addDivider(screen);
|
||||
setupDevelopmentCategoryHeader(screen);
|
||||
if (am.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT)) {
|
||||
setupOsmLiveForPublicTransportPref();
|
||||
setupNativePublicTransport();
|
||||
|
||||
if (OsmandPlugin.isPluginEnabled(OsmandDevelopmentPlugin.class)) {
|
||||
setupDevelopmentCategoryPreferences(screen, am);
|
||||
}
|
||||
if (am.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
setupOsmLiveForRoutingPref();
|
||||
setupDisableComplexRoutingPref();
|
||||
}
|
||||
setupFastRecalculationPref();
|
||||
}
|
||||
|
||||
private void setupOtherBooleanParameterSummary(ApplicationMode am, RoutingParameter p, SwitchPreferenceEx switchPreferenceEx) {
|
||||
|
@ -380,6 +374,20 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
screen.addPreference(routingCategory);
|
||||
}
|
||||
|
||||
private void setupDevelopmentCategoryPreferences(PreferenceScreen screen, ApplicationMode am) {
|
||||
addDivider(screen);
|
||||
setupDevelopmentCategoryHeader(screen);
|
||||
if (am.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT)) {
|
||||
setupOsmLiveForPublicTransportPref();
|
||||
setupNativePublicTransport();
|
||||
}
|
||||
if (am.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
setupOsmLiveForRoutingPref();
|
||||
setupDisableComplexRoutingPref();
|
||||
}
|
||||
setupFastRecalculationPref();
|
||||
}
|
||||
|
||||
private void setupDevelopmentCategoryHeader(PreferenceScreen screen) {
|
||||
PreferenceCategory developmentCategory = new PreferenceCategory(requireContext());
|
||||
developmentCategory.setLayoutResource(R.layout.preference_category_with_descr);
|
||||
|
|
Loading…
Reference in a new issue