Merge pull request #7220 from osmandapp/collapsable_glitch
fix for context menu scroll glich
This commit is contained in:
commit
386041950c
8 changed files with 36 additions and 34 deletions
|
@ -309,6 +309,9 @@ public class MenuBuilder {
|
||||||
buildPlainMenuItems(view);
|
buildPlainMenuItems(view);
|
||||||
}
|
}
|
||||||
buildInternal(view);
|
buildInternal(view);
|
||||||
|
if (needBuildCoordinatesRow()) {
|
||||||
|
buildCoordinatesRow(view);
|
||||||
|
}
|
||||||
if (showOnlinePhotos) {
|
if (showOnlinePhotos) {
|
||||||
buildNearestPhotosRow(view);
|
buildNearestPhotosRow(view);
|
||||||
}
|
}
|
||||||
|
@ -354,6 +357,10 @@ public class MenuBuilder {
|
||||||
protected boolean needBuildPlainMenuItems() {
|
protected boolean needBuildPlainMenuItems() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean needBuildCoordinatesRow() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected void buildPluginRows(View view) {
|
protected void buildPluginRows(View view) {
|
||||||
for (OsmandPlugin plugin : menuPlugins) {
|
for (OsmandPlugin plugin : menuPlugins) {
|
||||||
|
@ -412,6 +419,15 @@ public class MenuBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildCoordinatesRow(View view) {
|
||||||
|
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, latLon.getLatitude(), latLon.getLongitude(), true);
|
||||||
|
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
|
||||||
|
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
|
||||||
|
CollapsableView cv = getLocationCollapsableView(locationData);
|
||||||
|
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv, false, 1,
|
||||||
|
false, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
private void startLoadingImages() {
|
private void startLoadingImages() {
|
||||||
if (onlinePhotoCardsRow == null) {
|
if (onlinePhotoCardsRow == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -282,18 +282,6 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
||||||
addAltitudeToPlainItems();
|
addAltitudeToPlainItems();
|
||||||
addPrecisionToPlainItems();
|
addPrecisionToPlainItems();
|
||||||
}
|
}
|
||||||
addMyLocationToPlainItems(latLon);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addMyLocationToPlainItems(LatLon latlon) {
|
|
||||||
final MapActivity mapActivity = getMapActivity();
|
|
||||||
if (mapActivity != null) {
|
|
||||||
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, latlon.getLatitude(), latlon.getLongitude(), true);
|
|
||||||
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
|
|
||||||
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
|
|
||||||
CollapsableView cv = builder.getLocationCollapsableView(locationData);
|
|
||||||
addPlainMenuItem(R.drawable.ic_action_get_my_location, title, false, false, true, cv, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addSpeedToPlainItems() {
|
protected void addSpeedToPlainItems() {
|
||||||
|
|
|
@ -672,15 +672,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
buildRow(view, R.drawable.ic_action_openstreetmap_logo, null, link + (amenity.getId() >> 1),
|
buildRow(view, R.drawable.ic_action_openstreetmap_logo, null, link + (amenity.getId() >> 1),
|
||||||
0, false, null, true, 0, true, null, false);
|
0, false, null, true, 0, true, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true);
|
|
||||||
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
|
|
||||||
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
|
|
||||||
CollapsableView cv = getLocationCollapsableView(locationData);
|
|
||||||
|
|
||||||
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv,
|
|
||||||
true, 1, false, null, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFormattedInt(String value) {
|
private String getFormattedInt(String value) {
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package net.osmand.plus.mapcontextmenu.builders;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
|
|
||||||
|
public class MapDataMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
|
public MapDataMenuBuilder(@NonNull MapActivity mapActivity) {
|
||||||
|
super(mapActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean needBuildCoordinatesRow() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -166,8 +166,6 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
if (originObject instanceof Amenity) {
|
if (originObject instanceof Amenity) {
|
||||||
AmenityMenuController.addTypeMenuItem((Amenity) originObject, builder);
|
AmenityMenuController.addTypeMenuItem((Amenity) originObject, builder);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
addMyLocationToPlainItems(latLon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.liveupdates.LiveUpdatesHelper;
|
import net.osmand.plus.liveupdates.LiveUpdatesHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
import net.osmand.plus.mapcontextmenu.builders.MapDataMenuBuilder;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
||||||
import net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject;
|
import net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject;
|
||||||
|
@ -57,7 +57,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
private DownloadIndexesThread downloadThread;
|
private DownloadIndexesThread downloadThread;
|
||||||
|
|
||||||
public MapDataMenuController(@NonNull MapActivity mapActivity, @NonNull PointDescription pointDescription, final @NonNull DownloadMapObject mapObject) {
|
public MapDataMenuController(@NonNull MapActivity mapActivity, @NonNull PointDescription pointDescription, final @NonNull DownloadMapObject mapObject) {
|
||||||
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
super(new MapDataMenuBuilder(mapActivity), pointDescription, mapActivity);
|
||||||
this.mapObject = mapObject;
|
this.mapObject = mapObject;
|
||||||
indexItem = mapObject.getIndexItem();
|
indexItem = mapObject.getIndexItem();
|
||||||
localIndexInfo = mapObject.getLocalIndexInfo();
|
localIndexInfo = mapObject.getLocalIndexInfo();
|
||||||
|
|
|
@ -126,7 +126,6 @@ public class RenderedObjectMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
addPlainMenuItem(R.drawable.ic_action_info_dark, null, link + (renderedObject.getId() >> MapObject.NON_AMENITY_ID_RIGHT_SHIFT), true, true, null);
|
addPlainMenuItem(R.drawable.ic_action_info_dark, null, link + (renderedObject.getId() >> MapObject.NON_AMENITY_ID_RIGHT_SHIFT), true, true, null);
|
||||||
}
|
}
|
||||||
addMyLocationToPlainItems(latLon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,12 +71,5 @@ public class EditPOIMenuBuilder extends MenuBuilder {
|
||||||
buildRow(view, R.drawable.ic_action_info_dark, null, text, 0, false, null, false, 0, false, null, false);
|
buildRow(view, R.drawable.ic_action_info_dark, null, text, 0, false, null, false, 0, false, null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, osmPoint.getLatitude(), osmPoint.getLongitude(), true);
|
|
||||||
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
|
|
||||||
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
|
|
||||||
CollapsableView cv = getLocationCollapsableView(locationData);
|
|
||||||
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv,
|
|
||||||
true, 1, false, null, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue