My Place: GPX Context menu
This commit is contained in:
parent
37972b1be5
commit
f81673d047
4 changed files with 36 additions and 7 deletions
|
@ -140,6 +140,7 @@ import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenTyp
|
|||
import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
|
||||
import net.osmand.plus.settings.fragments.DataStorageFragment;
|
||||
import net.osmand.plus.track.TrackAppearanceFragment;
|
||||
import net.osmand.plus.track.TrackMenuFragment;
|
||||
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.OsmAndMapLayersView;
|
||||
|
@ -2222,6 +2223,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return getFragment(SnapTrackWarningFragment.TAG);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public TrackMenuFragment getTrackMenuFragment() {
|
||||
return getFragment(TrackMenuFragment.TAG);
|
||||
}
|
||||
|
||||
public void backToConfigureProfileFragment() {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
|
||||
|
|
|
@ -58,6 +58,7 @@ import net.osmand.plus.myplaces.TrackActivityFragmentAdapter;
|
|||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
||||
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
|
||||
import net.osmand.plus.views.layers.MapControlsLayer;
|
||||
import net.osmand.plus.widgets.IconPopupMenu;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -84,6 +85,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
private BottomNavigationView bottomNav;
|
||||
private TrackMenuType menuType = TrackMenuType.TRACK;
|
||||
private SegmentsCard segmentsCard;
|
||||
private MapControlsLayer.MapHudButton layersHud;
|
||||
|
||||
private int menuTitleHeight;
|
||||
|
||||
|
@ -170,6 +172,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view != null) {
|
||||
view.setOnLongClickListener(closeOnLongTap);
|
||||
bottomNav = view.findViewById(R.id.bottom_navigation);
|
||||
routeMenuTopShadowAll = view.findViewById(R.id.route_menu_top_shadow_all);
|
||||
TextView title = view.findViewById(R.id.title);
|
||||
|
@ -179,6 +182,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
if (isPortrait()) {
|
||||
updateCardsLayout();
|
||||
}
|
||||
|
||||
setupCards();
|
||||
setupButtons(view);
|
||||
enterTrackAppearanceMode();
|
||||
|
@ -187,6 +191,15 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
return view;
|
||||
}
|
||||
|
||||
private View.OnLongClickListener closeOnLongTap = new View.OnLongClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private void setupCards() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
|
@ -237,6 +250,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
exitTrackAppearanceMode();
|
||||
updateStatusBarColor();
|
||||
}
|
||||
|
||||
private void enterTrackAppearanceMode() {
|
||||
|
@ -550,7 +564,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
@Override
|
||||
public void gpxSavingFinished(Exception errorMessage) {
|
||||
if (selectedGpxFile != null) {
|
||||
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT});
|
||||
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT});
|
||||
if (groups != null) {
|
||||
selectedGpxFile.setDisplayGroups(groups, app);
|
||||
selectedGpxFile.processPoints(app);
|
||||
|
|
|
@ -805,6 +805,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
return true;
|
||||
|
||||
} else if (selectedObjects.size() > 1) {
|
||||
hideVisibleMenues();
|
||||
selectedObjectContextMenuProvider = null;
|
||||
showContextMenuForSelectedObjects(pointLatLon, selectedObjects);
|
||||
return true;
|
||||
|
@ -1036,6 +1037,10 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private boolean hideVisibleMenues() {
|
||||
if (activity.getTrackMenuFragment() != null) {
|
||||
activity.getTrackMenuFragment().dismiss();
|
||||
return true;
|
||||
}
|
||||
if (multiSelectionMenu.isVisible()) {
|
||||
multiSelectionMenu.hide();
|
||||
return true;
|
||||
|
|
|
@ -44,10 +44,6 @@ import net.osmand.plus.OsmAndLocationProvider;
|
|||
import net.osmand.plus.OsmAndLocationSimulation;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
|
@ -60,13 +56,17 @@ import net.osmand.plus.dialogs.DirectionsDialogs;
|
|||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
|
||||
import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode;
|
||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||
|
@ -859,6 +859,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||
boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible();
|
||||
boolean trackMenuFragmentOpened = false;
|
||||
if (mapActivity.getTrackMenuFragment() != null && mapActivity.getTrackMenuFragment().isVisible()) {
|
||||
trackMenuFragmentOpened = true;
|
||||
}
|
||||
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
||||
boolean showRouteCalculationControls = routePlanningMode ||
|
||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||
|
@ -881,7 +885,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
mapZoomIn.updateVisibility(showZoomButtons);
|
||||
mapZoomOut.updateVisibility(showZoomButtons);
|
||||
|
||||
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode()
|
||||
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || trackMenuFragmentOpened || isInMeasurementToolMode()
|
||||
|| isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode()
|
||||
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode();
|
||||
compassHud.forceHideCompass = forceHideCompass;
|
||||
|
@ -892,7 +896,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
if (layersHud.setIconResId(appMode.getIconRes())) {
|
||||
layersHud.update(app, isNight);
|
||||
}
|
||||
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !contextMenuOpened
|
||||
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !trackMenuFragmentOpened && !contextMenuOpened
|
||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode()
|
||||
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode();
|
||||
layersHud.updateVisibility(showTopButtons);
|
||||
|
|
Loading…
Reference in a new issue