Added Ski navigational type.

Extracted string resources
This commit is contained in:
madwasp79 2019-05-23 13:54:09 +03:00
parent 29f44c6bc0
commit 934cdd2df3
5 changed files with 19 additions and 12 deletions

View file

@ -343,7 +343,7 @@
<dimen name="setting_profile_item_height">64dp</dimen>
<dimen name="setting_profile_image_margin">20dp</dimen>
<dimen name="setting_profile_image_margin">24dp</dimen>
<dimen name="setting_profile_item_switch_margin">18dp</dimen>
</resources>

View file

@ -11,6 +11,11 @@
Thx - Hardy
-->
<string name="select_icon_profile_dialog_title">Select icon</string>
<string name="settings_routing_mode_string">Mode: %s</string>
<string name="settings_derived_routing_mode_string">User Mode, derived from: %s</string>
<string name="routing_profile_ski">Ski</string>
<string name="profile_type_descr_string">Type: %s</string>
<string name="profile_type_base_string">Base Profile</string>
<string name="profile_alert_need_routing_type_title">Select navigation type</string>
@ -3150,6 +3155,6 @@
<string name="run_full_osmand_header">Launch OsmAnd?</string>
<string name="routing_attr_avoid_sett_name">Avoid cobblestone and sett</string>
<string name="routing_attr_avoid_sett_description">Avoid cobblestone and sett</string>
<string name="select_icon_profile_dialog_title">Select icon</string>
</resources>

View file

@ -377,9 +377,10 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
? mode.toHumanString(SettingsBaseActivity.this)
: mode.getUserProfileName();
String subtitle = mode.getParent() == null
? "Mode: " + Algorithms.capitalizeFirstLetterAndLowercase(mode.getStringKey().replace("_", ""))
: "User Mode, derived from: " + Algorithms
.capitalizeFirstLetterAndLowercase(mode.getParent().getStringKey());
? String.format(getString(R.string.settings_routing_mode_string), Algorithms
.capitalizeFirstLetterAndLowercase(mode.getStringKey().replace("_", "")))
: String.format(getString(R.string.settings_derived_routing_mode_string), Algorithms
.capitalizeFirstLetterAndLowercase(mode.getParent().getStringKey()));
getModeTitleTV().setText(title);
getModeSubTitleTV().setText(subtitle);
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getSmallIconDark(),

View file

@ -55,6 +55,7 @@ import net.osmand.plus.routing.RouteProvider.RouteService;
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
import net.osmand.router.GeneralRouter;
import net.osmand.util.Algorithms;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.logging.Log;
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
@ -708,18 +709,16 @@ public class EditProfileFragment extends BaseOsmAndFragment {
for (Entry<String, GeneralRouter> e : inputProfiles.entrySet()) {
int iconRes = R.drawable.ic_action_gdirections_dark;
String name = e.getValue().getProfileName();
String description;
if (e.getValue().getFilename() == null) {
String description = context.getString(R.string.osmand_default_routing);
if (EnumUtils.isValidEnum(RoutingProfilesResources.class, name.toUpperCase())){
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
name = context
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
description = context.getString(R.string.osmand_default_routing);
} else {
} else if (!Algorithms.isEmpty(e.getValue().getFilename())) {
description = e.getValue().getFilename();
}
profilesObjects
.add(new RoutingProfileDataObject(e.getKey(), name, description, iconRes, false,
e.getValue().getFilename()));
profilesObjects.add(new RoutingProfileDataObject(e.getKey(), name, description,
iconRes, false, e.getValue().getFilename()));
}
return profilesObjects;
}
@ -730,6 +729,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
CAR(R.string.rendering_value_car_name, R.drawable.ic_action_car_dark),
PEDESTRIAN(R.string.rendering_value_pedestrian_name, R.drawable.map_action_pedestrian_dark),
BICYCLE(R.string.rendering_value_bicycle_name, R.drawable.map_action_bicycle_dark),
SKI(R.string.routing_profile_ski, R.drawable.ic_plugin_skimaps),
PUBLIC_TRANSPORT(R.string.app_mode_public_transport, R.drawable.map_action_bus_dark),
BOAT(R.string.app_mode_boat, R.drawable.map_action_sail_boat_dark),
GEOCODING(R.string.routing_profile_geocoding, R.drawable.ic_action_world_globe);

View file

@ -217,6 +217,7 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
icons.add(new IconResWithDescr(R.drawable.ic_action_truck_dark, R.string.app_mode_truck,false));
icons.add(new IconResWithDescr(R.drawable.ic_action_motorcycle_dark, R.string.app_mode_motorcycle,false));
icons.add(new IconResWithDescr(R.drawable.ic_action_trekking_dark, R.string.app_mode_hiking,false));
icons.add(new IconResWithDescr(R.drawable.ic_plugin_skimaps, R.string.routing_profile_ski, false));
return icons;
}