diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java index 4dae483949..682353bcb4 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java @@ -83,13 +83,8 @@ public class AppModeDialog { final int buttonWidth = (int) a.getResources().getDimension(R.dimen.route_info_modes_height); ApplicationMode activeMode = ((OsmandApplication) a.getApplication()).getSettings().getApplicationMode(); - int modeIndex; - try { - modeIndex = values.indexOf(activeMode); - } catch (Exception e) { - modeIndex = 0; - } - final int scrollSize = (modeIndex + 1) * buttonWidth; + + final int scrollSize = (values.indexOf(activeMode) + 1) * buttonWidth; OnGlobalLayoutListener globalListener = new OnGlobalLayoutListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 335d740515..3bf6d414e6 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -846,13 +846,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener final int buttonWidth = (int) mapActivity.getResources().getDimension(R.dimen.route_info_modes_height); final ApplicationMode activeMode = app.getSettings().getApplicationMode(); - int modeIndex; - try { - modeIndex = values.indexOf(activeMode); - } catch (Exception e) { - modeIndex = 0; - } - final int scrollSize = (modeIndex + 1) * buttonWidth + rightTogglePadding; + + final int scrollSize = (values.indexOf(activeMode) + 1) * buttonWidth + rightTogglePadding; OnGlobalLayoutListener globalListener = new OnGlobalLayoutListener() { @Override