Fixed add/edit wpt without monitoring plugin activated. Work on track details.
This commit is contained in:
parent
3245f5f186
commit
5566745949
7 changed files with 341 additions and 36 deletions
|
@ -48,6 +48,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||||
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
|
@ -275,6 +276,36 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||||
|
|
||||||
|
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked) {
|
||||||
|
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||||
|
mapActivity.getContextMenu().addWptPt();
|
||||||
|
} else if (resId == R.string.context_menu_item_edit_waypoint) {
|
||||||
|
mapActivity.getContextMenu().editWptPt();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles().isEmpty()
|
||||||
|
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
|
||||||
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
|
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
|
||||||
|
.setIcon(R.drawable.ic_action_gnew_label_dark)
|
||||||
|
.setListener(listener).createItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedObj instanceof GPXUtilities.WptPt) {
|
||||||
|
GPXUtilities.WptPt pt = (GPXUtilities.WptPt) selectedObj;
|
||||||
|
if (getMyApplication().getSelectedGpxHelper().getSelectedGPXFile(pt) != null) {
|
||||||
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
|
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
|
||||||
|
.setIcon(R.drawable.ic_action_edit_dark)
|
||||||
|
.setListener(listener).createItem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||||
final ArrayAdapter<ContextMenuItem> listAdapter =
|
final ArrayAdapter<ContextMenuItem> listAdapter =
|
||||||
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent());
|
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent());
|
||||||
|
|
|
@ -65,6 +65,7 @@ import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.ActivityResultListener;
|
import net.osmand.plus.activities.ActivityResultListener;
|
||||||
|
@ -74,6 +75,7 @@ import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
|
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
|
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
|
||||||
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.render.RenderingRuleProperty;
|
import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -225,12 +227,15 @@ public class GpxUiHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog selectSingleGPXFile(final Activity activity,
|
public static AlertDialog selectSingleGPXFile(final Activity activity, boolean showCurrentGpx,
|
||||||
final boolean showCurrentGpx, final CallbackWithObject<GPXFile[]> callbackWithObject) {
|
final CallbackWithObject<GPXFile[]> callbackWithObject) {
|
||||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
int gpxDirLength = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath().length();
|
int gpxDirLength = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath().length();
|
||||||
List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
|
List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
|
||||||
final List<GPXInfo> list = new ArrayList<>(selectedGpxFiles.size() + 1);
|
final List<GPXInfo> list = new ArrayList<>(selectedGpxFiles.size() + 1);
|
||||||
|
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {
|
||||||
|
showCurrentGpx = false;
|
||||||
|
}
|
||||||
if (!selectedGpxFiles.isEmpty() || showCurrentGpx) {
|
if (!selectedGpxFiles.isEmpty() || showCurrentGpx) {
|
||||||
if (showCurrentGpx) {
|
if (showCurrentGpx) {
|
||||||
list.add(new GPXInfo(activity.getString(R.string.shared_string_currently_recording_track), 0, 0));
|
list.add(new GPXInfo(activity.getString(R.string.shared_string_currently_recording_track), 0, 0));
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
@ -42,6 +43,7 @@ import net.osmand.plus.mapcontextmenu.editors.PointEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||||
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.ContextMenuLayer;
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
@ -767,7 +769,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
|
|
||||||
final List<SelectedGpxFile> list
|
final List<SelectedGpxFile> list
|
||||||
= mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles();
|
= mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles();
|
||||||
if (list.isEmpty() || (list.size() == 1 && list.get(0).getGpxFile().showCurrentTrack)) {
|
if ((list.isEmpty() || (list.size() == 1 && list.get(0).getGpxFile().showCurrentTrack))
|
||||||
|
&& OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||||
GPXFile gpxFile = mapActivity.getMyApplication().getSavingTrackHelper().getCurrentGpx();
|
GPXFile gpxFile = mapActivity.getMyApplication().getSavingTrackHelper().getCurrentGpx();
|
||||||
getWptPtPointEditor().add(gpxFile, latLon, title);
|
getWptPtPointEditor().add(gpxFile, latLon, title);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
public class TrackDetailsMenu {
|
||||||
|
|
||||||
|
private MapActivity mapActivity;
|
||||||
|
private OsmandMapTileView mapView;
|
||||||
|
private MapControlsLayer mapControlsLayer;
|
||||||
|
|
||||||
|
private static boolean VISIBLE;
|
||||||
|
private boolean nightMode;
|
||||||
|
|
||||||
|
public TrackDetailsMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
|
||||||
|
this.mapActivity = mapActivity;
|
||||||
|
this.mapControlsLayer = mapControlsLayer;
|
||||||
|
mapView = mapActivity.getMapView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
if (!VISIBLE) {
|
||||||
|
VISIBLE = true;
|
||||||
|
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
|
if (!portrait) {
|
||||||
|
mapActivity.getMapView().setMapPositionX(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
mapActivity.refreshMap();
|
||||||
|
|
||||||
|
TrackDetailsMenuFragment.showInstance(mapActivity);
|
||||||
|
|
||||||
|
if (!AndroidUiHelper.isXLargeDevice(mapActivity)) {
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), false);
|
||||||
|
}
|
||||||
|
if (!portrait) {
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hide() {
|
||||||
|
WeakReference<TrackDetailsMenuFragment> fragmentRef = findMenuFragment();
|
||||||
|
if (fragmentRef != null) {
|
||||||
|
fragmentRef.get().dismiss();
|
||||||
|
} else {
|
||||||
|
VISIBLE = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public WeakReference<TrackDetailsMenuFragment> findMenuFragment() {
|
||||||
|
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(TrackDetailsMenuFragment.TAG);
|
||||||
|
if (fragment != null && !fragment.isDetached()) {
|
||||||
|
return new WeakReference<>((TrackDetailsMenuFragment) fragment);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDismiss() {
|
||||||
|
VISIBLE = false;
|
||||||
|
mapActivity.getMapView().setMapPositionX(0);
|
||||||
|
mapActivity.getMapView().refreshMap();
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false);
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateInfo(final View main) {
|
||||||
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
|
updateView(main);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateView(final View parentView) {
|
||||||
|
/*
|
||||||
|
String via = generateViaDescription();
|
||||||
|
View viaLayout = parentView.findViewById(R.id.ViaLayout);
|
||||||
|
if (via.length() == 0) {
|
||||||
|
viaLayout.setVisibility(View.GONE);
|
||||||
|
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
viaLayout.setVisibility(View.VISIBLE);
|
||||||
|
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE);
|
||||||
|
((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
|
||||||
|
}
|
||||||
|
|
||||||
|
viaLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (getTargets().checkPointToNavigateShort()) {
|
||||||
|
mapActivity.getMapActions().openIntermediatePointsDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
|
||||||
|
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,183 @@
|
||||||
|
package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
||||||
|
public class TrackDetailsMenuFragment extends Fragment {
|
||||||
|
public static final String TAG = "TrackDetailsMenuFragment";
|
||||||
|
|
||||||
|
private TrackDetailsMenu menu;
|
||||||
|
private View mainView;
|
||||||
|
|
||||||
|
private MapActivity getMapActivity() {
|
||||||
|
return (MapActivity) getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
|
||||||
|
menu = mapActivity.getMapLayers().getMapControlsLayer().getTrackDetailsMenu();
|
||||||
|
View view = inflater.inflate(R.layout.plan_route_info, container, false);
|
||||||
|
if (menu == null) {
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainView = view.findViewById(R.id.main_view);
|
||||||
|
updateInfo();
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (menu == null) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
if (menu != null) {
|
||||||
|
menu.onDismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
if (mainView != null) {
|
||||||
|
return mainView.getHeight();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
if (mainView != null) {
|
||||||
|
return mainView.getWidth();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateInfo() {
|
||||||
|
menu.updateInfo(mainView);
|
||||||
|
applyDayNightMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(MapActivity mapActivity) {
|
||||||
|
int slideInAnim = R.anim.slide_in_bottom;
|
||||||
|
int slideOutAnim = R.anim.slide_out_bottom;
|
||||||
|
|
||||||
|
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||||
|
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||||
|
.add(R.id.routeMenuContainer, this, TAG)
|
||||||
|
.addToBackStack(TAG)
|
||||||
|
.commitAllowingStateLoss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismiss() {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
try {
|
||||||
|
activity.getSupportFragmentManager().popBackStack(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyDayNightMode() {
|
||||||
|
MapActivity ctx = getMapActivity();
|
||||||
|
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
||||||
|
boolean landscapeLayout = !portraitMode;
|
||||||
|
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
|
if (!landscapeLayout) {
|
||||||
|
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||||
|
}
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerModesLayout), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn1), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn2), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn3), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
|
||||||
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaView), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaSubView), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.toTitle), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.fromTitle), nightMode);
|
||||||
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.InfoTextView), nightMode);
|
||||||
|
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.FromLayout), nightMode);
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ViaLayout), nightMode);
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ToLayout), nightMode);
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Info), nightMode);
|
||||||
|
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Next), nightMode);
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Prev), nightMode);
|
||||||
|
|
||||||
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceText), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceTitle), nightMode);
|
||||||
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationTitle), nightMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showInstance(final MapActivity mapActivity) {
|
||||||
|
try {
|
||||||
|
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
|
int slideInAnim;
|
||||||
|
int slideOutAnim;
|
||||||
|
if (portrait) {
|
||||||
|
slideInAnim = R.anim.slide_in_bottom;
|
||||||
|
slideOutAnim = R.anim.slide_out_bottom;
|
||||||
|
} else {
|
||||||
|
slideInAnim = R.anim.slide_in_left;
|
||||||
|
slideOutAnim = R.anim.slide_out_left;
|
||||||
|
}
|
||||||
|
|
||||||
|
MapRouteInfoMenuFragment fragment = new MapRouteInfoMenuFragment();
|
||||||
|
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||||
|
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||||
|
.add(R.id.routeMenuContainer, fragment, TAG)
|
||||||
|
.addToBackStack(TAG).commitAllowingStateLoss();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,6 @@ import android.support.v7.app.AlertDialog;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
@ -21,9 +20,6 @@ import android.widget.TextView;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
|
||||||
import net.osmand.plus.ContextMenuItem;
|
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable;
|
import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable;
|
||||||
|
@ -132,35 +128,6 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude,
|
|
||||||
ContextMenuAdapter adapter, Object selectedObj) {
|
|
||||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked) {
|
|
||||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
|
||||||
mapActivity.getContextMenu().addWptPt();
|
|
||||||
} else if (resId == R.string.context_menu_item_edit_waypoint) {
|
|
||||||
mapActivity.getContextMenu().editWptPt();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
|
||||||
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
|
|
||||||
.setIcon(R.drawable.ic_action_gnew_label_dark)
|
|
||||||
.setListener(listener).createItem());
|
|
||||||
if (selectedObj instanceof WptPt) {
|
|
||||||
WptPt pt = (WptPt) selectedObj;
|
|
||||||
if (app.getSelectedGpxHelper().getSelectedGPXFile(pt) != null) {
|
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
|
||||||
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
|
|
||||||
.setIcon(R.drawable.ic_action_edit_dark)
|
|
||||||
.setListener(listener).createItem());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90};
|
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90};
|
||||||
public static final int[] MINUTES = new int[] {2, 3, 5};
|
public static final int[] MINUTES = new int[] {2, 3, 5};
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||||
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
|
||||||
private MapRouteInfoMenu mapRouteInfoMenu;
|
private MapRouteInfoMenu mapRouteInfoMenu;
|
||||||
|
private TrackDetailsMenu trackDetailsMenu;
|
||||||
private MapHudButton backToLocationControl;
|
private MapHudButton backToLocationControl;
|
||||||
private MapHudButton menuControl;
|
private MapHudButton menuControl;
|
||||||
private MapHudButton compassHud;
|
private MapHudButton compassHud;
|
||||||
|
@ -114,6 +116,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
return mapRouteInfoMenu;
|
return mapRouteInfoMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TrackDetailsMenu getTrackDetailsMenu() {
|
||||||
|
return trackDetailsMenu;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean drawInScreenPixels() {
|
public boolean drawInScreenPixels() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -276,6 +282,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private void initRouteControls() {
|
private void initRouteControls() {
|
||||||
mapRouteInfoMenu = new MapRouteInfoMenu(mapActivity, this);
|
mapRouteInfoMenu = new MapRouteInfoMenu(mapActivity, this);
|
||||||
|
trackDetailsMenu = new TrackDetailsMenu(mapActivity, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRouteButtons(View main, boolean routeInfo) {
|
public void updateRouteButtons(View main, boolean routeInfo) {
|
||||||
|
|
Loading…
Reference in a new issue