From 444409fb057d6ac8faeeb41a9cfde83fa7996291 Mon Sep 17 00:00:00 2001 From: chumva Date: Mon, 17 Jul 2023 15:43:41 +0300 Subject: [PATCH] Fixes and code cleanup --- OsmAnd/res/layout/preference_description.xml | 6 +- .../layout/preference_item_description.xml | 17 +- .../res/layout/preference_switch_divider.xml | 58 ----- OsmAnd/res/xml/dangerous_goods_parameters.xml | 11 +- .../fragments/DangerousGoodsFragment.java | 201 ++++++++---------- .../fragments/RouteParametersFragment.java | 105 +++++---- .../fragments/SettingsScreenType.java | 4 +- 7 files changed, 171 insertions(+), 231 deletions(-) delete mode 100644 OsmAnd/res/layout/preference_switch_divider.xml diff --git a/OsmAnd/res/layout/preference_description.xml b/OsmAnd/res/layout/preference_description.xml index 33762a6937c..5a9bf1678c6 100644 --- a/OsmAnd/res/layout/preference_description.xml +++ b/OsmAnd/res/layout/preference_description.xml @@ -5,10 +5,8 @@ android:layout_height="wrap_content" android:background="?attr/list_background_color" android:minHeight="@dimen/setting_list_item_large_height" - android:paddingLeft="@dimen/content_padding" - android:paddingRight="@dimen/content_padding" - android:paddingStart="@dimen/content_padding" - android:paddingEnd="@dimen/content_padding"> + android:paddingHorizontal="@dimen/content_padding" + android:paddingVertical="@dimen/content_padding_small"> - + tools:text="@string/dangerous_goods_description" /> - \ No newline at end of file diff --git a/OsmAnd/res/layout/preference_switch_divider.xml b/OsmAnd/res/layout/preference_switch_divider.xml deleted file mode 100644 index c67449bc604..00000000000 --- a/OsmAnd/res/layout/preference_switch_divider.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OsmAnd/res/xml/dangerous_goods_parameters.xml b/OsmAnd/res/xml/dangerous_goods_parameters.xml index 5cc73639063..320faffa723 100644 --- a/OsmAnd/res/xml/dangerous_goods_parameters.xml +++ b/OsmAnd/res/xml/dangerous_goods_parameters.xml @@ -1,8 +1,17 @@ - + + + + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DangerousGoodsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DangerousGoodsFragment.java index 9392612480a..f89e9e90c57 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DangerousGoodsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DangerousGoodsFragment.java @@ -1,10 +1,14 @@ package net.osmand.plus.settings.fragments; +import static net.osmand.plus.settings.backend.OsmandSettings.ROUTING_PREFERENCE_PREFIX; +import static net.osmand.plus.settings.fragments.RouteParametersFragment.HAZMAT_CATEGORY_USA_PREFIX; import static net.osmand.plus.utils.AndroidUtils.getRoutingStringPropertyName; -import static net.osmand.router.GeneralRouter.*; -import static net.osmand.router.RoutingConfiguration.parseSilentInt; +import static net.osmand.router.GeneralRouter.RoutingParameter; +import static net.osmand.router.GeneralRouter.RoutingParameterType; +import android.content.Context; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; @@ -12,106 +16,97 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; +import androidx.appcompat.widget.Toolbar; import androidx.preference.Preference; -import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceViewHolder; import androidx.preference.SwitchPreferenceCompat; import net.osmand.plus.R; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.routing.RoutingHelperUtils; +import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.preferences.CommonPreference; import net.osmand.plus.utils.AndroidUtils; import net.osmand.plus.utils.ColorUtilities; +import net.osmand.router.GeneralRouter; +import net.osmand.util.Algorithms; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; public class DangerousGoodsFragment extends BaseSettingsFragment { - private static final String DANGEROUS_GOODS_DESCRIPTION_KEY = "dangerous_goods_description"; - private static final String HAZMAT_CATEGORY_USA_1 = "hazmat_category_usa_1"; - private static final String HAZMAT_CATEGORY_USA_2 = "hazmat_category_usa_2"; - private static final String HAZMAT_CATEGORY_USA_3 = "hazmat_category_usa_3"; - private static final String HAZMAT_CATEGORY_USA_4 = "hazmat_category_usa_4"; - private static final String HAZMAT_CATEGORY_USA_5 = "hazmat_category_usa_5"; - private static final String HAZMAT_CATEGORY_USA_6 = "hazmat_category_usa_6"; - private static final String HAZMAT_CATEGORY_USA_7 = "hazmat_category_usa_7"; - private static final String HAZMAT_CATEGORY_USA_8 = "hazmat_category_usa_8"; - private static final String HAZMAT_CATEGORY_USA_9 = "hazmat_category_usa_9"; - - private String lastPreferenceId; + private final List parameters = new ArrayList<>(); @Override - protected void setupPreferences() { - setupDescription(); - setupDangerousGoodsPreferences(); + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + ApplicationMode mode = getSelectedAppMode(); + GeneralRouter router = app.getRouter(mode); + if (router != null) { + Map routingParameters = RoutingHelperUtils.getParametersForDerivedProfile(mode, router); + for (Map.Entry entry : routingParameters.entrySet()) { + String key = entry.getKey(); + RoutingParameter parameter = entry.getValue(); + if (key.startsWith(HAZMAT_CATEGORY_USA_PREFIX) && parameter.getType() == RoutingParameterType.BOOLEAN) { + parameters.add(parameter); + } + } + } } @Override protected void createToolbar(@NonNull LayoutInflater inflater, @NonNull View view) { super.createToolbar(inflater, view); - TextView toolbarTitle = view.findViewById(R.id.toolbar_title); - if (toolbarTitle != null) { - toolbarTitle.setText(R.string.dangerous_goods); - } + + boolean nightMode = isNightMode(); + Toolbar toolbar = view.findViewById(R.id.toolbar); + toolbar.setBackgroundColor(ColorUtilities.getCardAndListBackgroundColor(app, nightMode)); + + TextView title = view.findViewById(R.id.toolbar_title); + title.setTextColor(ColorUtilities.getPrimaryTextColor(app, nightMode)); + + ImageView closeButton = view.findViewById(R.id.close_button); + closeButton.setImageDrawable(getIcon(AndroidUtils.getNavigationIconResId(app), ColorUtilities.getPrimaryIconColorId(nightMode))); + + ImageView actionButton = toolbar.findViewById(R.id.action_button); + actionButton.setOnClickListener(v -> resetToDefault()); + actionButton.setContentDescription(getString(R.string.reset_to_default)); + actionButton.setImageDrawable(getContentIcon(R.drawable.ic_action_reset_to_default_dark)); + AndroidUiHelper.updateVisibility(actionButton, true); } @Override - protected void updateToolbar() { - super.updateToolbar(); - View view = getView(); - if (view != null) { - ImageView resetIcon = view.findViewById(R.id.profile_icon); - resetIcon.setImageDrawable(getIcon(R.drawable.ic_action_reset_to_default_dark, ColorUtilities.getDefaultIconColorId(isNightMode()))); - - View resetButton = view.findViewById(R.id.profile_button); - resetButton.setContentDescription(getString(R.string.reset_to_default)); - resetButton.setOnClickListener(v -> resetToDefault()); - resetButton.setVisibility(View.VISIBLE); - AndroidUtils.setBackground(resetButton, null); - } + protected void setupPreferences() { + setupHazmatPreferences(); } - private void resetToDefault() { - RouteParametersFragment parametersFragment = getRouteParametersFragment(); - if (parametersFragment != null) { - for (RoutingParameter parameter : parametersFragment.hazmatCategoryUSAParameters) { - if (parameter.getType() == RoutingParameterType.BOOLEAN) { - CommonPreference pref = settings.getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean()); - pref.resetToDefault(); - } - } - updateAllSettings(); - } - } + private void setupHazmatPreferences() { + Context context = requireContext(); - private void setupDescription() { - Preference preference = findPreference(DANGEROUS_GOODS_DESCRIPTION_KEY); - if (preference != null) { - preference.setTitle(getString(R.string.dangerous_goods_description)); - } - } + Iterator iterator = parameters.iterator(); + while (iterator.hasNext()) { + RoutingParameter parameter = iterator.next(); - private void setupDangerousGoodsPreferences() { - RouteParametersFragment fragment = getRouteParametersFragment(); - if (fragment != null) { - PreferenceScreen screen = getPreferenceScreen(); - for (RoutingParameter parameter : fragment.hazmatCategoryUSAParameters) { - String title = getRoutingStringPropertyName(app, parameter.getId(), parameter.getName()); - if (parameter.getType() == RoutingParameterType.BOOLEAN) { - CommonPreference pref = settings.getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean()); - - SwitchPreferenceCompat preference = new SwitchPreferenceCompat(app); - preference.setKey(pref.getId()); - preference.setTitle(title); - preference.setLayoutResource(R.layout.preference_switch_divider); - preference.setIcon(getDangerousGoodsPrefIcon(parameter.getId())); - screen.addPreference(preference); - - lastPreferenceId = pref.getId(); - } + String id = parameter.getId(); + String title = getRoutingStringPropertyName(app, id, parameter.getName()); + CommonPreference pref = settings.getCustomRoutingBooleanProperty(id, parameter.getDefaultBoolean()); + + SwitchPreferenceCompat preference = createSwitchPreference(pref, title, null, R.layout.preference_switch); + preference.setLayoutResource(R.layout.preference_switch); + preference.setIcon(getHazmatPrefIcon(id)); + addOnPreferencesScreen(preference); + + if (iterator.hasNext()) { + Preference divider = new Preference(context); + divider.setLayoutResource(R.layout.divider_half_item_with_background); + divider.setKey(id + "_divider"); + divider.setSelectable(false); + addOnPreferencesScreen(divider); } } } @@ -119,52 +114,38 @@ private void setupDangerousGoodsPreferences() { @Override protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) { super.onBindPreferenceViewHolder(preference, holder); - holder.itemView.setContentDescription(getString(R.string.shared_string_class) + " " + getDangerousGoodsClass(preference.getKey()) + " " + preference.getTitle()); - if (preference.getKey().equals(lastPreferenceId)) { - AndroidUiHelper.updateVisibility(holder.itemView.findViewById(R.id.divider), false); + + String key = preference.getKey(); + if (key.startsWith(ROUTING_PREFERENCE_PREFIX + HAZMAT_CATEGORY_USA_PREFIX)) { + int hazmatClass = getHazmatUsaClass(key.replace(ROUTING_PREFERENCE_PREFIX, "")); + if (hazmatClass >= 0) { + holder.itemView.setContentDescription(getString(R.string.shared_string_class) + + " " + hazmatClass + " " + preference.getTitle()); + } } } - public static int getDangerousGoodsClass(String id) { - Matcher matcher = Pattern.compile("(hazmat_category_usa_)\\d+$").matcher(id); - if (matcher.find()) { - String[] separatedKey = id.split("_"); - return parseSilentInt(separatedKey[separatedKey.length - 1], 0); + private void resetToDefault() { + ApplicationMode mode = getSelectedAppMode(); + for (RoutingParameter parameter : parameters) { + settings.getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean()).resetModeToDefault(mode); } - return 0; + updateAllSettings(); } @Nullable - private RouteParametersFragment getRouteParametersFragment() { - Fragment fragment = getTargetFragment(); - if (fragment instanceof RouteParametersFragment) { - return (RouteParametersFragment) fragment; + private Drawable getHazmatPrefIcon(@NonNull String id) { + int hazmatClass = getHazmatUsaClass(id); + if (hazmatClass >= 0) { + int iconId = AndroidUtils.getDrawableId(app, "ic_action_placard_hazard_" + hazmatClass); + if (iconId > 0) { + return getIcon(iconId); + } } return null; } - private Drawable getDangerousGoodsPrefIcon(String prefId) { - switch (prefId) { - case HAZMAT_CATEGORY_USA_1: - return getIcon(R.drawable.ic_action_placard_hazard_1); - case HAZMAT_CATEGORY_USA_2: - return getIcon(R.drawable.ic_action_placard_hazard_2); - case HAZMAT_CATEGORY_USA_3: - return getIcon(R.drawable.ic_action_placard_hazard_3); - case HAZMAT_CATEGORY_USA_4: - return getIcon(R.drawable.ic_action_placard_hazard_4); - case HAZMAT_CATEGORY_USA_5: - return getIcon(R.drawable.ic_action_placard_hazard_5); - case HAZMAT_CATEGORY_USA_6: - return getIcon(R.drawable.ic_action_placard_hazard_6); - case HAZMAT_CATEGORY_USA_7: - return getIcon(R.drawable.ic_action_placard_hazard_7); - case HAZMAT_CATEGORY_USA_8: - return getIcon(R.drawable.ic_action_placard_hazard_8); - case HAZMAT_CATEGORY_USA_9: - return getIcon(R.drawable.ic_action_placard_hazard_9); - default: - return null; - } + public static int getHazmatUsaClass(@NonNull String id) { + return Algorithms.parseIntSilently(id.replace(HAZMAT_CATEGORY_USA_PREFIX, ""), -1); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java index 5292da32063..53b1d6525ca 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java @@ -2,7 +2,8 @@ import static net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.DRIVING_STYLE; import static net.osmand.plus.settings.backend.OsmandSettings.ROUTING_PREFERENCE_PREFIX; -import static net.osmand.plus.settings.fragments.DangerousGoodsFragment.getDangerousGoodsClass; +import static net.osmand.plus.settings.fragments.DangerousGoodsFragment.getHazmatUsaClass; +import static net.osmand.plus.settings.fragments.SettingsScreenType.DANGEROUS_GOODS; import static net.osmand.plus.utils.AndroidUtils.getRoutingStringPropertyName; import static net.osmand.router.GeneralRouter.GOODS_RESTRICTIONS; import static net.osmand.router.GeneralRouter.HAZMAT_CATEGORY; @@ -80,8 +81,8 @@ public class RouteParametersFragment extends BaseSettingsFragment { public static final String RELIEF_SMOOTHNESS_FACTOR = "relief_smoothness_factor"; private static final String AVOID_ROUTING_PARAMETER_PREFIX = "avoid_"; - private static final String HAZMAT_CATEGORY_USA_PREFIX = "hazmat_category_usa_"; private static final String PREFER_ROUTING_PARAMETER_PREFIX = "prefer_"; + public static final String HAZMAT_CATEGORY_USA_PREFIX = "hazmat_category_usa_"; private static final String ROUTE_PARAMETERS_INFO = "route_parameters_info"; private static final String ROUTE_PARAMETERS_IMAGE = "route_parameters_image"; private static final String ROUTING_SHORT_WAY = "prouting_short_way"; @@ -97,10 +98,10 @@ public class RouteParametersFragment extends BaseSettingsFragment { public static final float DEFAULT_MODE = 0.0f; private final List avoidParameters = new ArrayList<>(); - public final List hazmatCategoryUSAParameters = new ArrayList<>(); private final List preferParameters = new ArrayList<>(); private final List drivingStyleParameters = new ArrayList<>(); private final List reliefFactorParameters = new ArrayList<>(); + private final List hazmatCategoryUSAParameters = new ArrayList<>(); private final List otherRoutingParameters = new ArrayList<>(); private ListParameters hazmatParameters; private RoutingParameter viaFerrataParameter; @@ -441,7 +442,7 @@ public boolean onPreferenceClick(Preference preference) { String prefId = preference.getKey(); ApplicationMode appMode = getSelectedAppMode(); if (settings.ROUTE_STRAIGHT_ANGLE.getId().equals(prefId)) { - showSeekbarSettingsDialog(getActivity(), getSelectedAppMode()); + showSeekbarSettingsDialog(getActivity(), appMode); } else if (HAZMAT_TRANSPORTING_ENABLED.equals(prefId)) { FragmentManager manager = getFragmentManager(); if (manager != null && hazmatParameters != null) { @@ -465,7 +466,7 @@ public boolean onPreferenceClick(Preference preference) { controller.setCallback(this); } } else if (DANGEROUS_GOODS_USA.equals(prefId)) { - BaseSettingsFragment.showInstance(requireActivity(), SettingsScreenType.DANGEROUS_GOODS, getSelectedAppMode(), new Bundle(), RouteParametersFragment.this); + BaseSettingsFragment.showInstance(requireActivity(), DANGEROUS_GOODS, appMode, new Bundle(), this); } return super.onPreferenceClick(preference); } @@ -580,54 +581,70 @@ private void setupViaFerrataPreference(@NonNull RoutingParameter parameter, @Non } private void setupHazmatUSACategoryPreference(@NonNull PreferenceScreen screen) { - if (settings.DRIVING_REGION.get() == DrivingRegion.US) { - Preference uiPreference = new Preference(app); - uiPreference.setKey(DANGEROUS_GOODS_USA); - uiPreference.setTitle(R.string.dangerous_goods); - uiPreference.setLayoutResource(R.layout.preference_with_descr); - screen.addPreference(uiPreference); - updateHazmatUSACategoryPreference(); + if (settings.DRIVING_REGION.getModeValue(getSelectedAppMode()) == DrivingRegion.US) { + List paramsIds = getEnabledHazmatUsaParamsIds(); + + Preference preference = new Preference(requireContext()); + preference.setKey(DANGEROUS_GOODS_USA); + preference.setTitle(R.string.dangerous_goods); + preference.setLayoutResource(R.layout.preference_with_descr); + preference.setSummary(getHazmatUsaDescription(paramsIds)); + preference.setIcon(getHazmatUsaIcon(paramsIds)); + screen.addPreference(preference); + } + } + + @NonNull + private Drawable getHazmatUsaIcon(@NonNull List paramsIds) { + boolean enabled = !paramsIds.isEmpty(); + int iconId = enabled ? R.drawable.ic_action_placard_hazard : R.drawable.ic_action_placard_hazard_off; + int colorId = enabled ? R.color.osmand_live_cancelled : ColorUtilities.getDefaultIconColorId(isNightMode()); + return getIcon(iconId, colorId); + } + + @NonNull + private String getHazmatUsaDescription(@NonNull List paramsIds) { + if (Algorithms.isEmpty(paramsIds)) { + return getString(R.string.shared_string_no); + } + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < paramsIds.size(); i++) { + String id = paramsIds.get(i); + int hazmatClass = getHazmatUsaClass(id); + if (hazmatClass >= 0) { + if (i > 0) { + builder.append(", "); + } + builder.append(hazmatClass); + } } + return getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_class), builder.toString()); } - private void updateHazmatUSACategoryPreference() { - Preference uiPreference = findPreference(DANGEROUS_GOODS_USA); - if (uiPreference == null || hazmatCategoryUSAParameters.isEmpty()) { - return; - } - - StringBuilder enabledClasses = new StringBuilder(); + @NonNull + private List getEnabledHazmatUsaParamsIds() { + List list = new ArrayList<>(); + ApplicationMode appMode = getSelectedAppMode(); for (RoutingParameter parameter : hazmatCategoryUSAParameters) { - CommonPreference preference = settings.getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean()); - if (preference != null && preference.get()) { - if (enabledClasses.toString().isEmpty()) { - enabledClasses.append(getDangerousGoodsClass(parameter.getId())); - } else { - enabledClasses.append(", ").append(getDangerousGoodsClass(parameter.getId())); - } + CommonPreference pref = settings.getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean()); + if (pref.getModeValue(appMode)) { + list.add(parameter.getId()); } } - - String description = enabledClasses.toString().isEmpty() ? getString(R.string.shared_string_no) : getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_class), enabledClasses.toString()); - uiPreference.setSummary(description); - - Drawable icon; - if (enabledClasses.toString().isEmpty()) { - icon = getIcon(R.drawable.ic_action_placard_hazard_off, ColorUtilities.getDefaultIconColorId(isNightMode())); - } else { - icon = getIcon(R.drawable.ic_action_placard_hazard, R.color.osmand_live_cancelled); - } - uiPreference.setIcon(icon); + return list; } private void setupHazmatCategoryPreference(@NonNull RoutingParameter parameter, @NonNull PreferenceScreen screen) { - Preference uiPreference = new Preference(app); - uiPreference.setKey(HAZMAT_TRANSPORTING_ENABLED); - uiPreference.setTitle(R.string.transport_hazmat_title); - uiPreference.setLayoutResource(R.layout.preference_with_descr); - screen.addPreference(uiPreference); - hazmatParameters = populateListParameters(app, parameter); - updateHazmatCategoryPreference(); + Preference hazmatUsaPreference = findPreference(DANGEROUS_GOODS_USA); + if (hazmatUsaPreference == null || !hazmatUsaPreference.isVisible()) { + Preference preference = new Preference(app); + preference.setKey(HAZMAT_TRANSPORTING_ENABLED); + preference.setTitle(R.string.transport_hazmat_title); + preference.setLayoutResource(R.layout.preference_with_descr); + screen.addPreference(preference); + hazmatParameters = populateListParameters(app, parameter); + updateHazmatCategoryPreference(); + } } private void updateHazmatCategoryPreference() { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/SettingsScreenType.java b/OsmAnd/src/net/osmand/plus/settings/fragments/SettingsScreenType.java index dd130af92ce..58fa7e467eb 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/SettingsScreenType.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/SettingsScreenType.java @@ -24,7 +24,6 @@ public enum SettingsScreenType { NAVIGATION(NavigationFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.navigation_settings_new, R.layout.profile_preference_toolbar), COORDINATES_FORMAT(CoordinatesFormatFragment.class.getName(), true, ApplyQueryType.BOTTOM_SHEET, R.xml.coordinates_format, R.layout.profile_preference_toolbar), ROUTE_PARAMETERS(RouteParametersFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.route_parameters, R.layout.profile_preference_toolbar), - DANGEROUS_GOODS(DangerousGoodsFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.dangerous_goods_parameters, R.layout.profile_preference_toolbar), SCREEN_ALERTS(ScreenAlertsFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.screen_alerts, R.layout.profile_preference_toolbar_with_switch), VOICE_ANNOUNCES(VoiceAnnouncesFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.voice_announces, R.layout.profile_preference_toolbar_with_switch), VEHICLE_PARAMETERS(VehicleParametersFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.vehicle_parameters, R.layout.profile_preference_toolbar), @@ -44,7 +43,8 @@ public enum SettingsScreenType { SIMULATION_NAVIGATION(SimulationNavigationSettingFragment.class.getName(), true, ApplyQueryType.NONE, R.xml.simulation_navigation_setting, R.layout.profile_preference_toolbar_with_switch), ANT_PLUS_SETTINGS(ExternalDevicesListFragment.class.getName(), false, null, R.xml.antplus_settings, R.layout.global_preference_toolbar), WEATHER_SETTINGS(WeatherSettingsFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.weather_settings, R.layout.profile_preference_toolbar), - EXTERNAL_SETTINGS_WRITE_TO_TRACK_SETTINGS(ExternalSettingsWriteToTrackSettingsFragment.class.getName(), true, ApplyQueryType.BOTTOM_SHEET, R.xml.external_sensors_write_to_track_settings, R.layout.profile_preference_toolbar); + EXTERNAL_SETTINGS_WRITE_TO_TRACK_SETTINGS(ExternalSettingsWriteToTrackSettingsFragment.class.getName(), true, ApplyQueryType.BOTTOM_SHEET, R.xml.external_sensors_write_to_track_settings, R.layout.profile_preference_toolbar), + DANGEROUS_GOODS(DangerousGoodsFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.dangerous_goods_parameters, R.layout.global_preference_toolbar); public final String fragmentName; public final boolean profileDependent;