Merge pull request #11354 from osmandapp/track_menu_fixes
Track menu fixes
This commit is contained in:
commit
336b2a8444
6 changed files with 71 additions and 54 deletions
|
@ -30,6 +30,21 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentManager.BackStackEntry;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
import androidx.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
@ -157,21 +172,6 @@ import java.util.TimerTask;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
import androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentManager.BackStackEntry;
|
|
||||||
import androidx.preference.Preference;
|
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
|
||||||
import androidx.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback;
|
|
||||||
|
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
||||||
|
|
||||||
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
||||||
|
@ -2074,7 +2074,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showQuickSearch(double latitude, double longitude) {
|
public void showQuickSearch(double latitude, double longitude) {
|
||||||
hideContextMenu();
|
hideVisibleMenu();
|
||||||
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.dismiss();
|
fragment.dismiss();
|
||||||
|
@ -2085,7 +2085,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showQuickSearch(String searchQuery) {
|
public void showQuickSearch(String searchQuery) {
|
||||||
hideContextMenu();
|
hideVisibleMenu();
|
||||||
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.dismiss();
|
fragment.dismiss();
|
||||||
|
@ -2096,7 +2096,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showQuickSearch(Object object) {
|
public void showQuickSearch(Object object) {
|
||||||
hideContextMenu();
|
hideVisibleMenu();
|
||||||
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.dismiss();
|
fragment.dismiss();
|
||||||
|
@ -2119,7 +2119,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
if (mode == ShowQuickSearchMode.CURRENT) {
|
if (mode == ShowQuickSearchMode.CURRENT) {
|
||||||
mapContextMenu.close();
|
mapContextMenu.close();
|
||||||
} else {
|
} else {
|
||||||
hideContextMenu();
|
hideVisibleMenu();
|
||||||
}
|
}
|
||||||
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
||||||
if (mode.isPointSelection()) {
|
if (mode.isPointSelection()) {
|
||||||
|
@ -2172,7 +2172,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
if (mode == ShowQuickSearchMode.CURRENT) {
|
if (mode == ShowQuickSearchMode.CURRENT) {
|
||||||
mapContextMenu.close();
|
mapContextMenu.close();
|
||||||
} else {
|
} else {
|
||||||
hideContextMenu();
|
hideVisibleMenu();
|
||||||
}
|
}
|
||||||
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
||||||
if (mode.isPointSelection()) {
|
if (mode.isPointSelection()) {
|
||||||
|
@ -2221,11 +2221,13 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
BaseSettingsFragment.showInstance(this, SettingsScreenType.MAIN_SETTINGS);
|
BaseSettingsFragment.showInstance(this, SettingsScreenType.MAIN_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideContextMenu() {
|
private void hideVisibleMenu() {
|
||||||
if (mapContextMenu.isVisible()) {
|
if (mapContextMenu.isVisible()) {
|
||||||
mapContextMenu.hide();
|
mapContextMenu.hide();
|
||||||
} else if (mapContextMenu.getMultiSelectionMenu().isVisible()) {
|
} else if (mapContextMenu.getMultiSelectionMenu().isVisible()) {
|
||||||
mapContextMenu.getMultiSelectionMenu().hide();
|
mapContextMenu.getMultiSelectionMenu().hide();
|
||||||
|
} else if (getTrackMenuFragment() != null) {
|
||||||
|
dismissTrackMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2277,6 +2279,13 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return getFragment(RouteLineAppearanceFragment.TAG);
|
return getFragment(RouteLineAppearanceFragment.TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dismissTrackMenu() {
|
||||||
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
if (!fragmentManager.isStateSaved()) {
|
||||||
|
fragmentManager.popBackStack(TrackMenuFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void backToConfigureProfileFragment() {
|
public void backToConfigureProfileFragment() {
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
|
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
|
||||||
|
|
|
@ -578,6 +578,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
mapActivity.dismissCardDialog();
|
mapActivity.dismissCardDialog();
|
||||||
|
mapActivity.dismissTrackMenu();
|
||||||
mapActivity.getContextMenu().hideMenues();
|
mapActivity.getContextMenu().hideMenues();
|
||||||
mapViewLocation = mapActivity.getMapLocation();
|
mapViewLocation = mapActivity.getMapLocation();
|
||||||
mapRotation = mapActivity.getMapRotate();
|
mapRotation = mapActivity.getMapRotate();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
mapContextMenu.hide(false);
|
mapContextMenu.close();
|
||||||
WptPt wptPt = selectedGpxPoint.selectedPoint;
|
WptPt wptPt = selectedGpxPoint.selectedPoint;
|
||||||
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
||||||
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
||||||
|
|
|
@ -14,6 +14,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.Metadata;
|
import net.osmand.GPXUtilities.Metadata;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
|
@ -25,6 +26,7 @@ import net.osmand.plus.myplaces.SegmentActionsListener;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import static net.osmand.AndroidUtils.dpToPx;
|
||||||
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
|
||||||
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected;
|
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected;
|
||||||
import static net.osmand.plus.track.OptionsCard.APPEARANCE_BUTTON_INDEX;
|
import static net.osmand.plus.track.OptionsCard.APPEARANCE_BUTTON_INDEX;
|
||||||
|
@ -39,6 +41,7 @@ public class OverviewCard extends BaseCard {
|
||||||
private View appearanceButton;
|
private View appearanceButton;
|
||||||
private View editButton;
|
private View editButton;
|
||||||
private View directionsButton;
|
private View directionsButton;
|
||||||
|
private TextView description;
|
||||||
private final SegmentActionsListener actionsListener;
|
private final SegmentActionsListener actionsListener;
|
||||||
private final SelectedGpxFile selectedGpxFile;
|
private final SelectedGpxFile selectedGpxFile;
|
||||||
private final GpxBlockStatisticsBuilder blockStatisticsBuilder;
|
private final GpxBlockStatisticsBuilder blockStatisticsBuilder;
|
||||||
|
@ -70,6 +73,7 @@ public class OverviewCard extends BaseCard {
|
||||||
appearanceButton = view.findViewById(R.id.appearance_button);
|
appearanceButton = view.findViewById(R.id.appearance_button);
|
||||||
editButton = view.findViewById(R.id.edit_button);
|
editButton = view.findViewById(R.id.edit_button);
|
||||||
directionsButton = view.findViewById(R.id.directions_button);
|
directionsButton = view.findViewById(R.id.directions_button);
|
||||||
|
description = view.findViewById(R.id.description);
|
||||||
RecyclerView blocksView = view.findViewById(R.id.recycler_overview);
|
RecyclerView blocksView = view.findViewById(R.id.recycler_overview);
|
||||||
blockStatisticsBuilder.setBlocksView(blocksView);
|
blockStatisticsBuilder.setBlocksView(blocksView);
|
||||||
|
|
||||||
|
@ -81,6 +85,10 @@ public class OverviewCard extends BaseCard {
|
||||||
initDirectionsButton(iconColorDef, iconColorPres);
|
initDirectionsButton(iconColorDef, iconColorPres);
|
||||||
}
|
}
|
||||||
blockStatisticsBuilder.initStatBlocks(actionsListener, getActiveColor());
|
blockStatisticsBuilder.initStatBlocks(actionsListener, getActiveColor());
|
||||||
|
|
||||||
|
if (blocksView.getVisibility() == View.VISIBLE && description.getVisibility() == View.VISIBLE) {
|
||||||
|
AndroidUtils.setPadding(description, 0, 0, 0, dpToPx(app, 12));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private GPXFile getGPXFile() {
|
private GPXFile getGPXFile() {
|
||||||
|
@ -142,7 +150,6 @@ public class OverviewCard extends BaseCard {
|
||||||
gpxFile.metadata = new Metadata();
|
gpxFile.metadata = new Metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView description = view.findViewById(R.id.description);
|
|
||||||
final String descriptionHtml = gpxFile.metadata.getDescription();
|
final String descriptionHtml = gpxFile.metadata.getDescription();
|
||||||
if (Algorithms.isBlank(descriptionHtml)) {
|
if (Algorithms.isBlank(descriptionHtml)) {
|
||||||
AndroidUiHelper.updateVisibility(description, false);
|
AndroidUiHelper.updateVisibility(description, false);
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -270,8 +269,9 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
||||||
if (contextMenu.isActive() && contextMenu.getPointDescription() != null
|
PointDescription pointDescription = contextMenu.getPointDescription();
|
||||||
&& contextMenu.getPointDescription().isGpxPoint()) {
|
if (pointDescription != null && pointDescription.isGpxPoint()) {
|
||||||
|
contextMenu.init(contextMenu.getLatLon(), pointDescription, contextMenu.getObject());
|
||||||
contextMenu.show();
|
contextMenu.show();
|
||||||
} else if (Algorithms.objectEquals(callingFragmentTag, QuickSearchDialogFragment.TAG)) {
|
} else if (Algorithms.objectEquals(callingFragmentTag, QuickSearchDialogFragment.TAG)) {
|
||||||
mapActivity.showQuickSearch(ShowQuickSearchMode.CURRENT, false);
|
mapActivity.showQuickSearch(ShowQuickSearchMode.CURRENT, false);
|
||||||
|
@ -296,6 +296,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
: app.getResources().getString(R.string.shared_string_currently_recording_track);
|
: app.getResources().getString(R.string.shared_string_currently_recording_track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LatLon getLatLon() {
|
||||||
|
return latLon;
|
||||||
|
}
|
||||||
|
|
||||||
public GPXFile getGpx() {
|
public GPXFile getGpx() {
|
||||||
return displayHelper.getGpx();
|
return displayHelper.getGpx();
|
||||||
}
|
}
|
||||||
|
@ -746,19 +750,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStatusBarColorId() {
|
public int getStatusBarColorId() {
|
||||||
View view = getView();
|
if (getViewY() <= getFullScreenTopPosY() || !isPortrait()) {
|
||||||
if (view != null) {
|
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||||
boolean nightMode = isNightMode();
|
|
||||||
if (getViewY() <= getFullScreenTopPosY() || !isPortrait()) {
|
|
||||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
|
||||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
|
||||||
}
|
|
||||||
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
|
||||||
} else {
|
|
||||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
|
||||||
view.setSystemUiVisibility(view.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -827,7 +820,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
segment = segments.get(0);
|
segment = segments.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT};
|
GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT};
|
||||||
List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes));
|
List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes));
|
||||||
if (segment != null && !Algorithms.isEmpty(items)) {
|
if (segment != null && !Algorithms.isEmpty(items)) {
|
||||||
SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment);
|
SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment);
|
||||||
|
@ -1220,7 +1213,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
@Override
|
@Override
|
||||||
public void gpxSavingFinished(Exception errorMessage) {
|
public void gpxSavingFinished(Exception errorMessage) {
|
||||||
if (selectedGpxFile != null) {
|
if (selectedGpxFile != null) {
|
||||||
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT});
|
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT});
|
||||||
selectedGpxFile.setDisplayGroups(groups, app);
|
selectedGpxFile.setDisplayGroups(groups, app);
|
||||||
selectedGpxFile.processPoints(app);
|
selectedGpxFile.processPoints(app);
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,12 +268,19 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
canvas.translate(box.getPixWidth() / 2 - contextMarker.getWidth() / 2, box.getPixHeight() / 2 - contextMarker.getHeight());
|
canvas.translate(box.getPixWidth() / 2 - contextMarker.getWidth() / 2, box.getPixHeight() / 2 - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
mAddGpxPointBottomSheetHelper.onDraw(box);
|
mAddGpxPointBottomSheetHelper.onDraw(box);
|
||||||
} else if (menu.isActive() && !markerCustomized) {
|
} else if (!markerCustomized) {
|
||||||
LatLon latLon = menu.getLatLon();
|
LatLon latLon = null;
|
||||||
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
if (menu.isActive()) {
|
||||||
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
latLon = menu.getLatLon();
|
||||||
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
} else if (activity.getTrackMenuFragment() != null) {
|
||||||
contextMarker.draw(canvas);
|
latLon = activity.getTrackMenuFragment().getLatLon();
|
||||||
|
}
|
||||||
|
if (latLon != null) {
|
||||||
|
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
||||||
|
contextMarker.draw(canvas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +290,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public void updateContextMenu() {
|
public void updateContextMenu() {
|
||||||
for (OsmandMapLayer layer : view.getLayers()) {
|
for (OsmandMapLayer layer : view.getLayers()) {
|
||||||
if (layer instanceof ContextMenuLayer.IMoveObjectProvider && ((ContextMenuLayer.IMoveObjectProvider) layer).isObjectMovable(selectedObject)) {
|
if (layer instanceof IMoveObjectProvider && ((IMoveObjectProvider) layer).isObjectMovable(selectedObject)) {
|
||||||
selectedObjectContextMenuProvider = (IContextMenuProvider) layer;
|
selectedObjectContextMenuProvider = (IContextMenuProvider) layer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -361,8 +368,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public boolean isObjectMoveable(Object o) {
|
public boolean isObjectMoveable(Object o) {
|
||||||
if (o != null && selectedObjectContextMenuProvider != null
|
if (o != null && selectedObjectContextMenuProvider != null
|
||||||
&& selectedObjectContextMenuProvider instanceof ContextMenuLayer.IMoveObjectProvider) {
|
&& selectedObjectContextMenuProvider instanceof IMoveObjectProvider) {
|
||||||
final IMoveObjectProvider l = (ContextMenuLayer.IMoveObjectProvider) selectedObjectContextMenuProvider;
|
final IMoveObjectProvider l = (IMoveObjectProvider) selectedObjectContextMenuProvider;
|
||||||
if (l.isObjectMovable(o)) {
|
if (l.isObjectMovable(o)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -860,7 +867,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
if (((IContextMenuProvider) lt).disableSingleTap()) {
|
if (((IContextMenuProvider) lt).disableSingleTap()) {
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
|
@ -878,7 +885,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
if (((IContextMenuProvider) lt).disableLongPressOnMap()) {
|
if (((IContextMenuProvider) lt).disableLongPressOnMap()) {
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
|
@ -924,9 +931,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
||||||
List<Object> s = new ArrayList<>();
|
List<Object> s = new ArrayList<>();
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
s.clear();
|
s.clear();
|
||||||
final IContextMenuProvider l = (ContextMenuLayer.IContextMenuProvider) lt;
|
final IContextMenuProvider l = (IContextMenuProvider) lt;
|
||||||
l.collectObjectsFromPoint(point, tileBox, s, unknownLocation);
|
l.collectObjectsFromPoint(point, tileBox, s, unknownLocation);
|
||||||
for (Object o : s) {
|
for (Object o : s) {
|
||||||
selectedObjects.put(o, l);
|
selectedObjects.put(o, l);
|
||||||
|
|
Loading…
Reference in a new issue