Fix review

This commit is contained in:
Dima-1 2020-07-03 16:04:54 +03:00
parent 6869639c08
commit 2aa182cf87
2 changed files with 10 additions and 9 deletions

View file

@ -255,7 +255,7 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
straightAngle.setKey(settings.ROUTE_STRAIGHT_ANGLE.getId());
straightAngle.setTitle(getString(R.string.recalc_angle_dialog_title));
straightAngle.setSummary(String.format(getString(R.string.shared_string_angle_param),
(int) am.getStrAngle() + ""));
String.valueOf((int) am.getStrAngle())));
straightAngle.setLayoutResource(R.layout.preference_with_descr);
straightAngle.setIcon(getRoutingPrefIcon("routing_recalc_distance")); //TODO change for appropriate icon when available
getPreferenceScreen().addPreference(straightAngle);

View file

@ -4,11 +4,11 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.routing.RouteProvider.RouteService;
@ -46,12 +46,13 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
if (routeService == RouteService.OSMAND) {
GeneralRouter router = app.getRouter(mode);
if (router != null) {
GeneralRouterProfile routerProfile = router.getProfile();
Map<String, RoutingParameter> parameters = router.getParameters();
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_HEIGHT));
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_WEIGHT));
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_WIDTH));
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_LENGTH));
if (router.getProfile() != GeneralRouterProfile.PUBLIC_TRANSPORT) {
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_HEIGHT), routerProfile);
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_WEIGHT), routerProfile);
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_WIDTH), routerProfile);
setupCustomRoutingPropertyPref(parameters.get(VEHICLE_LENGTH), routerProfile);
if (routerProfile != GeneralRouterProfile.PUBLIC_TRANSPORT) {
setupDefaultSpeedPref();
}
}
@ -60,8 +61,8 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
}
}
private void setupCustomRoutingPropertyPref(RoutingParameter parameter) {
GeneralRouterProfile routerProfile = app.getRouter(getSelectedAppMode()).getProfile();
private void setupCustomRoutingPropertyPref(@Nullable RoutingParameter parameter,
GeneralRouterProfile routerProfile) {
if (parameter == null) {
return;
}