Remove code for old android

This commit is contained in:
PavelRatushny 2017-11-28 11:15:55 +02:00
parent a3c1e42960
commit 92b431d643

View file

@ -304,12 +304,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
setViewY((int) newY, false, false); setViewY((int) newY, false, false);
menuFullHeight = view.getHeight() - (int) newY + 10; menuFullHeight = view.getHeight() - (int) newY + 10;
if (!oldAndroid()) {
ViewGroup.LayoutParams lp = mainView.getLayoutParams(); ViewGroup.LayoutParams lp = mainView.getLayoutParams();
lp.height = Math.max(menuFullHeight, menuTitleHeight); lp.height = Math.max(menuFullHeight, menuTitleHeight);
mainView.setLayoutParams(lp); mainView.setLayoutParams(lp);
mainView.requestLayout(); mainView.requestLayout();
}
velocity.addMovement(event); velocity.addMovement(event);
velocity.computeCurrentVelocity(1000); velocity.computeCurrentVelocity(1000);
@ -616,7 +614,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
updateMainViewLayout(posY); updateMainViewLayout(posY);
} }
if (!oldAndroid()) {
mainView.animate().y(posY) mainView.animate().y(posY)
.setDuration(200) .setDuration(200)
.setInterpolator(new DecelerateInterpolator()) .setInterpolator(new DecelerateInterpolator())
@ -653,17 +650,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (needMapAdjust) { if (needMapAdjust) {
adjustMapPosition(posY, true, centered, dZoom); adjustMapPosition(posY, true, centered, dZoom);
} }
} else {
setViewY(posY, false, needMapAdjust);
if (needCloseMenu) {
menu.close();
} else {
updateMainViewLayout(posY);
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
doAfterMenuStateChange(previousMenuState, newMenuState);
}
}
}
} }
} }
@ -1225,31 +1211,20 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void updateMainViewLayout(int posY) { private void updateMainViewLayout(int posY) {
if (view != null) { if (view != null) {
menuFullHeight = view.getHeight() - posY; menuFullHeight = view.getHeight() - posY;
if (!oldAndroid()) {
ViewGroup.LayoutParams lp = mainView.getLayoutParams(); ViewGroup.LayoutParams lp = mainView.getLayoutParams();
lp.height = Math.max(menuFullHeight, menuTitleHeight); lp.height = Math.max(menuFullHeight, menuTitleHeight);
mainView.setLayoutParams(lp); mainView.setLayoutParams(lp);
mainView.requestLayout(); mainView.requestLayout();
} }
} }
}
private int getViewY() { private int getViewY() {
if (!oldAndroid()) {
return (int) mainView.getY(); return (int) mainView.getY();
} else {
return mainView.getPaddingTop();
}
} }
private void setViewY(int y, boolean animated, boolean adjustMapPos) { private void setViewY(int y, boolean animated, boolean adjustMapPos) {
if (!oldAndroid()) {
mainView.setY(y); mainView.setY(y);
zoomButtonsView.setY(getZoomButtonsY(y)); zoomButtonsView.setY(getZoomButtonsY(y));
} else {
mainView.setPadding(0, y, 0, 0);
zoomButtonsView.setPadding(0, getZoomButtonsY(y), 0, 0);
}
if (!customMapCenter) { if (!customMapCenter) {
if (adjustMapPos) { if (adjustMapPos) {
adjustMapPosition(y, animated, centered, 0); adjustMapPosition(y, animated, centered, 0);
@ -1354,10 +1329,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
return y - zoomButtonsHeight - fabPaddingTopPx; return y - zoomButtonsHeight - fabPaddingTopPx;
} }
private boolean oldAndroid() {
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH);
}
private void doLayoutMenu() { private void doLayoutMenu() {
final int posY = getPosY(); final int posY = getPosY();
setViewY(posY, true, !initLayout || !centered); setViewY(posY, true, !initLayout || !centered);