diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml index ebb13a5643..46964956a4 100644 --- a/OsmAnd/res/layout/map_context_menu_fragment.xml +++ b/OsmAnd/res/layout/map_context_menu_fragment.xml @@ -602,11 +602,11 @@ + android:alpha="1"> diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index ab15c8c281..131394dd8e 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1161,6 +1161,8 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference SHOW_OSM_BUGS = new BooleanPreference("show_osm_bugs", false).makeGlobal(); + + public final CommonPreference SHOW_CLOSED_OSM_BUGS = new BooleanPreference("show_closed_osm_bugs", false).makeGlobal(); public final CommonPreference SHOW_OSM_BUGS_MIN_ZOOM = new IntPreference("show_osm_bugs_min_zoom", 8).makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index ee03e55d01..d5956608dc 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -665,6 +665,11 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } } + public boolean hasActiveToolbar() { + TopToolbarController toolbarController = mapActivity.getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU); + return toolbarController != null && toolbarController instanceof ContextMenuToolbarController; + } + public void closeActiveToolbar() { TopToolbarController toolbarController = mapActivity.getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU); if (toolbarController != null && toolbarController instanceof ContextMenuToolbarController) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 92dc422c6a..ec8c63a08e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -159,14 +159,13 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo toolbarView = view.findViewById(R.id.context_menu_toolbar); toolbarBackButton = view.findViewById(R.id.context_menu_toolbar_back); toolbarTextView = (TextView) view.findViewById(R.id.context_menu_toolbar_text); - toolbarContainer.setAlpha(0); + updateVisibility(toolbarContainer, 0); toolbarBackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openMenuHeaderOnly(); } }); - toolbarTextView.setText(menu.getTitleStr()); topButtonContainer = view.findViewById(R.id.context_menu_top_button_container); view.findViewById(R.id.context_menu_top_back).setOnClickListener(new View.OnClickListener() { @@ -175,7 +174,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo openMenuHeaderOnly(); } }); - topButtonContainer.setAlpha(0); + updateVisibility(topButtonContainer, 0); map = getMapActivity().getMapView(); RotatedTileBox box = map.getCurrentRotatedTileBox().copy(); @@ -621,12 +620,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo private void updateToolbar() { float a = getToolbarAlpha(getViewY()); - toolbarContainer.setAlpha(a); + updateVisibility(toolbarContainer, a); } private float getTopButtonAlpha(int y) { float a = 0; - if (menu != null && !menu.isLandscapeLayout()) { + if (menu != null && !menu.isLandscapeLayout() && !menu.hasActiveToolbar()) { int headerTopY = getHeaderOnlyTopY(); if (y < headerTopY) { a = 1f - (y - minHalfY) * (1f / (headerTopY - minHalfY)); @@ -642,7 +641,25 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo private void updateTopButton() { float a = getTopButtonAlpha(getViewY()); - topButtonContainer.setAlpha(a); + updateVisibility(topButtonContainer, a); + } + + private void updateVisibility(View v, float alpha) { + boolean visible = alpha > 0; + v.setAlpha(alpha); + if (visible && v.getVisibility() != View.VISIBLE) { + v.setVisibility(View.VISIBLE); + } else if (!visible && v.getVisibility() == View.VISIBLE) { + v.setVisibility(View.INVISIBLE); + } + } + + private void updateVisibility(View v, boolean visible) { + if (visible && v.getVisibility() != View.VISIBLE) { + v.setVisibility(View.VISIBLE); + } else if (!visible && v.getVisibility() == View.VISIBLE) { + v.setVisibility(View.INVISIBLE); + } } private void toggleDetailsHideButton() { @@ -788,15 +805,33 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo } final float topButtonAlpha = getTopButtonAlpha(posY); + if (topButtonAlpha > 0) { + updateVisibility(topButtonContainer, true); + } topButtonContainer.animate().alpha(topButtonAlpha) .setDuration(200) .setInterpolator(new DecelerateInterpolator()) + .setListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + updateVisibility(topButtonContainer, topButtonAlpha); + } + }) .start(); final float toolbarAlpha = getToolbarAlpha(posY); + if (toolbarAlpha > 0) { + updateVisibility(toolbarContainer, true); + } toolbarContainer.animate().alpha(toolbarAlpha) .setDuration(200) .setInterpolator(new DecelerateInterpolator()) + .setListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + updateVisibility(toolbarContainer, toolbarAlpha); + } + }) .start(); mainView.animate().y(posY) @@ -1281,6 +1316,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo // Text line 1 TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1); line1.setText(menu.getTitleStr()); + toolbarTextView.setText(menu.getTitleStr()); // Text line 2 LinearLayout line2layout = (LinearLayout) view.findViewById(R.id.context_menu_line2_layout); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java index 00baf41ec6..3165abc6c4 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java @@ -306,7 +306,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener { } } - if (startPoint != null) { + if (startPoint != null && endPoint != null) { targetPointsHelper.navigateToPoint(startPoint.point, false, -1, startPoint.getPointDescription(mapActivity)); targetPointsHelper.setStartPoint(endPoint.point, false, endPoint.getPointDescription(mapActivity)); targetPointsHelper.updateRouteAndRefresh(true); diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index 704004f8b8..a41fbfea9b 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -716,18 +716,18 @@ public class ResourceManager { int left31 = MapUtils.get31TileNumberX(leftLongitude); int bottom31 = MapUtils.get31TileNumberY(bottomLatitude); int right31 = MapUtils.get31TileNumberX(rightLongitude); - List fileNames = new ArrayList(amenityRepositories.keySet()); + List fileNames = new ArrayList<>(amenityRepositories.keySet()); Collections.sort(fileNames, Algorithms.getStringVersionComparator()); for (String name : fileNames) { - AmenityIndexRepository index = amenityRepositories.get(name); if (matcher != null && matcher.isCancelled()) { searchAmenitiesInProgress = false; break; } - if (index.checkContainsInt(top31, left31, bottom31, right31)) { + AmenityIndexRepository index = amenityRepositories.get(name); + if (index != null && index.checkContainsInt(top31, left31, bottom31, right31)) { List r = index.searchAmenities(top31, left31, bottom31, right31, zoom, filter, matcher); - if(r != null) { + if (r != null) { amenities.addAll(r); } }