formatting

This commit is contained in:
madwasp79 2019-07-17 12:55:42 +03:00
parent a3395838df
commit 0242553eea
2 changed files with 7 additions and 11 deletions

View file

@ -85,16 +85,14 @@ public class AppModeDialog {
ApplicationMode activeMode = ((OsmandApplication) a.getApplication()).getSettings().getApplicationMode();
final int idx = values.indexOf(activeMode);
OnGlobalLayoutListener globalListener = new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
HorizontalScrollView scrollView = ll
.findViewById(R.id.app_modes_scroll_container);
HorizontalScrollView scrollView = ll.findViewById(R.id.app_modes_scroll_container);
LinearLayout container = ll.findViewById(R.id.app_modes_content);
int s = container.getChildAt(idx) != null ? container.getChildAt(idx).getRight()
: 0;
scrollView
.scrollTo(s - scrollView.getWidth() > 0 ? s - scrollView.getWidth() : 0, 0);
int s = container.getChildAt(idx) != null ? container.getChildAt(idx).getRight() : 0;
scrollView.scrollTo(s - scrollView.getWidth() > 0 ? s - scrollView.getWidth() : 0, 0);
if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
ll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
@ -103,6 +101,7 @@ public class AppModeDialog {
}
};
ll.getViewTreeObserver().addOnGlobalLayoutListener(globalListener);
return ll;
}

View file

@ -854,10 +854,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
@Override
public void onGlobalLayout() {
LinearLayout container = ll.findViewById(R.id.app_modes_content);
int s = container.getChildAt(idx) != null ? container.getChildAt(idx).getRight()
+ rightTogglePadding : 0;
scrollView
.scrollTo(s - scrollView.getWidth() > 0 ? s - scrollView.getWidth() : 0, 0);
int s = container.getChildAt(idx) != null ? container.getChildAt(idx).getRight() + rightTogglePadding : 0;
scrollView.scrollTo(s - scrollView.getWidth() > 0 ? s - scrollView.getWidth() : 0, 0);
if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
ll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
@ -867,7 +865,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
};
ll.getViewTreeObserver().addOnGlobalLayoutListener(globalListener);
}
private void updateOptionsButtons() {