refactoring 2

This commit is contained in:
madwasp79 2019-07-03 14:02:02 +03:00
parent 4b4a1ef29a
commit d628ca4c5a
2 changed files with 4 additions and 14 deletions

View file

@ -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

View file

@ -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