Fix transport context menu
This commit is contained in:
parent
1a9df71765
commit
e7b7a98266
4 changed files with 35 additions and 20 deletions
|
@ -498,6 +498,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
|
||||||
|
mapContextMenu.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
||||||
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
LatLon loc = getMapLocation();
|
LatLon loc = getMapLocation();
|
||||||
|
|
|
@ -379,15 +379,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||||
init(latLon, pointDescription, object, true, false);
|
init(latLon, pointDescription, object, true, false);
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
fragmentRef.get().rebuildMenu();
|
fragmentRef.get().rebuildMenu(centerMarker);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void rebuildMenu() {
|
|
||||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
|
||||||
if (fragmentRef != null) {
|
|
||||||
fragmentRef.get().rebuildMenu();
|
|
||||||
}
|
}
|
||||||
|
centerMarker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showOrUpdate(LatLon latLon, PointDescription pointDescription, Object object) {
|
public void showOrUpdate(LatLon latLon, PointDescription pointDescription, Object object) {
|
||||||
|
|
|
@ -792,7 +792,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
menu.setMapZoom(0);
|
menu.setMapZoom(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildMenu() {
|
public void rebuildMenu(boolean centered) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (app != null && view != null) {
|
if (app != null && view != null) {
|
||||||
IconsCache iconsCache = app.getIconsCache();
|
IconsCache iconsCache = app.getIconsCache();
|
||||||
|
@ -807,6 +807,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
bottomLayout.removeAllViews();
|
bottomLayout.removeAllViews();
|
||||||
buildBottomView();
|
buildBottomView();
|
||||||
|
|
||||||
|
if (centered) {
|
||||||
|
this.initLayout = true;
|
||||||
|
this.centered = true;
|
||||||
|
}
|
||||||
runLayoutListener();
|
runLayoutListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1284,7 +1288,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
public void downloadHasFinished() {
|
public void downloadHasFinished() {
|
||||||
updateOnDownload();
|
updateOnDownload();
|
||||||
if (menu != null && menu.isVisible() && menu.isMapDownloaded()) {
|
if (menu != null && menu.isVisible() && menu.isMapDownloaded()) {
|
||||||
rebuildMenu();
|
rebuildMenu(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,13 @@ public class TransportRouteController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
return getPointDescription().getTypeName();
|
if (transportRoute.refStop != null) {
|
||||||
|
return transportRoute.refStop.getName();
|
||||||
|
} else if (transportRoute.stop != null) {
|
||||||
|
return transportRoute.stop.getName();
|
||||||
|
} else {
|
||||||
|
return getPointDescription().getTypeName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -159,16 +165,23 @@ public class TransportRouteController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View arg0) {
|
public void onClick(View arg0) {
|
||||||
MapContextMenu menu = getMapActivity().getContextMenu();
|
if (mapContextMenu != null) {
|
||||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
|
transportRoute.stop = stop;
|
||||||
getMapActivity().getString(R.string.transport_Stop), name);
|
transportRoute.refStop = stop;
|
||||||
|
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
|
||||||
|
transportRoute.getDescription(getMapActivity().getMyApplication(), false));
|
||||||
|
|
||||||
//resetRoute();
|
LatLon stopLocation = stop.getLocation();
|
||||||
LatLon stopLocation = stop.getLocation();
|
if (mapContextMenu.isVisible()) {
|
||||||
getMapActivity().getMyApplication().getSettings()
|
mapContextMenu.updateMapCenter(stopLocation);
|
||||||
.setMapLocationToShow(stopLocation.getLatitude(), stopLocation.getLongitude(),
|
} else {
|
||||||
15, pd, false, stop);
|
mapContextMenu.setMapCenter(stopLocation);
|
||||||
MapActivity.launchMapActivityMoveToTop(getMapActivity());
|
mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition());
|
||||||
|
}
|
||||||
|
mapContextMenu.setCenterMarker(true);
|
||||||
|
mapContextMenu.setMapZoom(15);
|
||||||
|
mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue