Track details menu fixes, added to route info.
This commit is contained in:
parent
2fe5049011
commit
24742f78ce
10 changed files with 170 additions and 51 deletions
|
@ -252,6 +252,42 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/details_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/details_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:textColor="?attr/color_dialog_buttons"
|
||||||
|
android:textSize="@dimen/default_sub_text_size"
|
||||||
|
osmand:textAllCapsCompat="true"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
android:text="@string/rendering_category_details"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/list_item_divider"/>
|
<include layout="@layout/list_item_divider"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -86,8 +86,25 @@ public class GpxSelectionHelper {
|
||||||
return app.getString(resId, formatArgs);
|
return app.getString(resId, formatArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GpxDisplayGroup> collectDisplayGroups(GPXFile g) {
|
public GpxDisplayGroup buildGpxDisplayGroup(GPXFile g, int trackIndex, String name) {
|
||||||
List<GpxDisplayGroup> dg = new ArrayList<>();
|
Track t = g.tracks.get(trackIndex);
|
||||||
|
GpxDisplayGroup group = new GpxDisplayGroup(g);
|
||||||
|
group.gpxName = name;
|
||||||
|
group.color = t.getColor(g.getColor(0));
|
||||||
|
group.setType(GpxDisplayItemType.TRACK_SEGMENT);
|
||||||
|
group.setTrack(t);
|
||||||
|
String ks = (trackIndex + 1) + "";
|
||||||
|
group.setName(getString(R.string.gpx_selection_track, name, g.tracks.size() == 1 ? "" : ks));
|
||||||
|
String d = "";
|
||||||
|
if (t.name != null && t.name.length() > 0) {
|
||||||
|
d = t.name + " " + d;
|
||||||
|
}
|
||||||
|
group.setDescription(d);
|
||||||
|
processGroupTrack(app, group);
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getGroupName(GPXFile g) {
|
||||||
String name = g.path;
|
String name = g.path;
|
||||||
if (g.showCurrentTrack) {
|
if (g.showCurrentTrack) {
|
||||||
name = getString(R.string.shared_string_currently_recording_track);
|
name = getString(R.string.shared_string_currently_recording_track);
|
||||||
|
@ -105,23 +122,16 @@ public class GpxSelectionHelper {
|
||||||
}
|
}
|
||||||
name = name.replace('_', ' ');
|
name = name.replace('_', ' ');
|
||||||
}
|
}
|
||||||
if (g.tracks.size() > 0) {
|
return name;
|
||||||
int k = 1;
|
|
||||||
for (Track t : g.tracks) {
|
|
||||||
GpxDisplayGroup group = new GpxDisplayGroup(g);
|
|
||||||
group.gpxName = name;
|
|
||||||
group.color = t.getColor(g.getColor(0));
|
|
||||||
group.setType(GpxDisplayItemType.TRACK_SEGMENT);
|
|
||||||
group.setTrack(t);
|
|
||||||
String ks = (k++) + "";
|
|
||||||
group.setName(getString(R.string.gpx_selection_track, name, g.tracks.size() == 1 ? "" : ks));
|
|
||||||
String d = "";
|
|
||||||
if (t.name != null && t.name.length() > 0) {
|
|
||||||
d = t.name + " " + d;
|
|
||||||
}
|
}
|
||||||
group.setDescription(d);
|
|
||||||
|
public List<GpxDisplayGroup> collectDisplayGroups(GPXFile g) {
|
||||||
|
List<GpxDisplayGroup> dg = new ArrayList<>();
|
||||||
|
String name = getGroupName(g);
|
||||||
|
if (g.tracks.size() > 0) {
|
||||||
|
for (int i = 0; i < g.tracks.size(); i++) {
|
||||||
|
GpxDisplayGroup group = buildGpxDisplayGroup(g, i, name);
|
||||||
dg.add(group);
|
dg.add(group);
|
||||||
processGroupTrack(app, group);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g.routes.size() > 0) {
|
if (g.routes.size() > 0) {
|
||||||
|
|
|
@ -54,7 +54,6 @@ import net.osmand.plus.AppInitializer;
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.AppInitializer.InitEvents;
|
import net.osmand.plus.AppInitializer.InitEvents;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.GpxSelectionHelper;
|
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
||||||
|
@ -91,7 +90,6 @@ import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenuFragment;
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenuFragment;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenuFragment;
|
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -448,6 +446,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
if (TrackDetailsMenu.isVisible()) {
|
if (TrackDetailsMenu.isVisible()) {
|
||||||
getMapLayers().getMapControlsLayer().getTrackDetailsMenu().hide();
|
getMapLayers().getMapControlsLayer().getTrackDetailsMenu().hide();
|
||||||
|
if (prevActivityIntent == null) {
|
||||||
|
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);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
@ -30,6 +32,7 @@ import com.github.mikephil.charting.data.LineData;
|
||||||
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.GPXUtilities;
|
import net.osmand.plus.GPXUtilities;
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
|
@ -37,6 +40,8 @@ import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||||
import net.osmand.plus.GPXUtilities.Track;
|
import net.osmand.plus.GPXUtilities.Track;
|
||||||
import net.osmand.plus.GPXUtilities.TrkSegment;
|
import net.osmand.plus.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
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;
|
||||||
|
@ -44,6 +49,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||||
|
import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -68,6 +74,8 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private RouteInfoAdapter adapter;
|
private RouteInfoAdapter adapter;
|
||||||
private GPXFile gpx;
|
private GPXFile gpx;
|
||||||
|
private OrderedLineDataSet elevationDataSet;
|
||||||
|
private GpxDisplayItem gpxItem;
|
||||||
private boolean hasHeights;
|
private boolean hasHeights;
|
||||||
|
|
||||||
public ShowRouteInfoDialogFragment() {
|
public ShowRouteInfoDialogFragment() {
|
||||||
|
@ -210,6 +218,12 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
track.segments.add(seg);
|
track.segments.add(seg);
|
||||||
gpx.tracks.add(track);
|
gpx.tracks.add(track);
|
||||||
|
|
||||||
|
String groupName = getMyApplication().getString(R.string.current_route);
|
||||||
|
GpxDisplayGroup group = getMyApplication().getSelectedGpxHelper().buildGpxDisplayGroup(gpx, 0, groupName);
|
||||||
|
if (group != null && group.getModifiableList().size() > 0) {
|
||||||
|
gpxItem = group.getModifiableList().get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +242,11 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
GPXTrackAnalysis analysis = gpx.getAnalysis(0);
|
GPXTrackAnalysis analysis = gpx.getAnalysis(0);
|
||||||
if (analysis.totalDistance > 0) {
|
if (analysis.totalDistance > 0) {
|
||||||
List<ILineDataSet> dataSets = new ArrayList<>();
|
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||||
GpxUiHelper.OrderedLineDataSet elevationDataSet =
|
elevationDataSet =
|
||||||
GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis, GPXDataSetAxisType.DISTANCE, false, true);
|
GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis, GPXDataSetAxisType.DISTANCE, false, true);
|
||||||
dataSets.add(elevationDataSet);
|
dataSets.add(elevationDataSet);
|
||||||
if (analysis.elevationData.size() > 1) {
|
if (analysis.elevationData.size() > 1) {
|
||||||
GpxUiHelper.OrderedLineDataSet slopeDataSet =
|
OrderedLineDataSet slopeDataSet =
|
||||||
GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis, GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true);
|
GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis, GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true);
|
||||||
dataSets.add(slopeDataSet);
|
dataSets.add(slopeDataSet);
|
||||||
}
|
}
|
||||||
|
@ -263,6 +277,68 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_descent));
|
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_descent));
|
||||||
((ImageView) headerView.findViewById(R.id.ascent_icon))
|
((ImageView) headerView.findViewById(R.id.ascent_icon))
|
||||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_ascent));
|
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_ascent));
|
||||||
|
|
||||||
|
headerView.findViewById(R.id.details_view).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
openDetails();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void openDetails() {
|
||||||
|
if (gpxItem != null) {
|
||||||
|
LatLon location = null;
|
||||||
|
WptPt wpt = null;
|
||||||
|
gpxItem.chartType = GpxUiHelper.GPXDataSetType.ALTITUDE;
|
||||||
|
if (gpxItem.chartHighlightPos != -1) {
|
||||||
|
TrkSegment segment = gpx.tracks.get(0).segments.get(0);
|
||||||
|
if (segment != null) {
|
||||||
|
float distance = gpxItem.chartHighlightPos * elevationDataSet.getDivX();
|
||||||
|
for (WptPt p : segment.points) {
|
||||||
|
if (p.distance >= distance) {
|
||||||
|
wpt = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wpt != null) {
|
||||||
|
location = new LatLon(wpt.lat, wpt.lon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location == null) {
|
||||||
|
location = new LatLon(gpxItem.locationStart.lat, gpxItem.locationStart.lon);
|
||||||
|
}
|
||||||
|
if (wpt != null) {
|
||||||
|
gpxItem.locationOnMap = wpt;
|
||||||
|
} else {
|
||||||
|
gpxItem.locationOnMap = gpxItem.locationStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
final MapActivity activity = (MapActivity)getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
dismiss();
|
||||||
|
final MapRouteInfoMenu mapRouteInfoMenu = activity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
||||||
|
final LatLon fLocation = location;
|
||||||
|
mapRouteInfoMenu.setOnDismissListener(new OnDismissListener() {
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
mapRouteInfoMenu.setOnDismissListener(null);
|
||||||
|
|
||||||
|
final OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||||
|
settings.setMapLocationToShow(fLocation.getLatitude(), fLocation.getLongitude(),
|
||||||
|
settings.getLastKnownMapZoom(),
|
||||||
|
new PointDescription(PointDescription.POINT_TYPE_WPT, gpxItem.name),
|
||||||
|
false,
|
||||||
|
gpxItem);
|
||||||
|
|
||||||
|
MapActivity.launchMapActivityMoveToTop(activity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mapRouteInfoMenu.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildMenuButtons() {
|
private void buildMenuButtons() {
|
||||||
|
|
|
@ -1198,6 +1198,10 @@ public class GpxUiHelper {
|
||||||
for (Speed s : speedData) {
|
for (Speed s : speedData) {
|
||||||
x = axisType == GPXDataSetAxisType.TIME ? s.time : (float) s.distance;
|
x = axisType == GPXDataSetAxisType.TIME ? s.time : (float) s.distance;
|
||||||
if (x > 0) {
|
if (x > 0) {
|
||||||
|
if (axisType == GPXDataSetAxisType.TIME && x > 60) {
|
||||||
|
values.add(new Entry(nextX + 1, 0));
|
||||||
|
values.add(new Entry(nextX + x - 1, 0));
|
||||||
|
}
|
||||||
nextX += x / divX;
|
nextX += x / divX;
|
||||||
if (Float.isNaN(divSpeed)) {
|
if (Float.isNaN(divSpeed)) {
|
||||||
nextY = (float) (s.speed * mulSpeed);
|
nextY = (float) (s.speed * mulSpeed);
|
||||||
|
|
|
@ -80,9 +80,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
private AddressLookupRequest startPointRequest;
|
private AddressLookupRequest startPointRequest;
|
||||||
private AddressLookupRequest targetPointRequest;
|
private AddressLookupRequest targetPointRequest;
|
||||||
private List<LatLon> intermediateRequestsLatLon = new ArrayList<>();
|
private List<LatLon> intermediateRequestsLatLon = new ArrayList<>();
|
||||||
|
private OnDismissListener onDismissListener;
|
||||||
|
|
||||||
private OnMarkerSelectListener onMarkerSelectListener;
|
private OnMarkerSelectListener onMarkerSelectListener;
|
||||||
private OnDismissListener onDismissDialogListener;
|
|
||||||
|
|
||||||
private static final long SPINNER_MY_LOCATION_ID = 1;
|
private static final long SPINNER_MY_LOCATION_ID = 1;
|
||||||
private static final long SPINNER_FAV_ID = 2;
|
private static final long SPINNER_FAV_ID = 2;
|
||||||
|
@ -116,6 +116,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OnDismissListener getOnDismissListener() {
|
||||||
|
return onDismissListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnDismissListener(OnDismissListener onDismissListener) {
|
||||||
|
this.onDismissListener = onDismissListener;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||||
if (selectFromMapTouch) {
|
if (selectFromMapTouch) {
|
||||||
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
|
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
|
||||||
|
@ -136,10 +144,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
return onMarkerSelectListener;
|
return onMarkerSelectListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnDismissListener getOnDismissDialogListener() {
|
|
||||||
return onDismissDialogListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancelStartPointAddressRequest() {
|
private void cancelStartPointAddressRequest() {
|
||||||
if (startPointRequest != null) {
|
if (startPointRequest != null) {
|
||||||
geocodingLookupService.cancel(startPointRequest);
|
geocodingLookupService.cancel(startPointRequest);
|
||||||
|
@ -848,6 +852,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
if (getTargets().getPointToNavigate() == null && !selectFromMapTouch) {
|
if (getTargets().getPointToNavigate() == null && !selectFromMapTouch) {
|
||||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||||
}
|
}
|
||||||
|
if (onDismissListener != null) {
|
||||||
|
onDismissListener.onDismiss(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
|
|
|
@ -31,8 +31,6 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
|
import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
|
||||||
|
@ -43,18 +41,13 @@ import java.util.List;
|
||||||
public class TrackDetailsMenu {
|
public class TrackDetailsMenu {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private OsmandMapTileView mapView;
|
|
||||||
private MapControlsLayer mapControlsLayer;
|
|
||||||
private GpxDisplayItem gpxItem;
|
private GpxDisplayItem gpxItem;
|
||||||
private TrackDetailsBarController toolbarController;
|
private TrackDetailsBarController toolbarController;
|
||||||
|
|
||||||
private static boolean VISIBLE;
|
private static boolean VISIBLE;
|
||||||
private boolean nightMode;
|
|
||||||
|
|
||||||
public TrackDetailsMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
|
public TrackDetailsMenu(MapActivity mapActivity) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
this.mapControlsLayer = mapControlsLayer;
|
|
||||||
mapView = mapActivity.getMapView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GpxDisplayItem getGpxItem() {
|
public GpxDisplayItem getGpxItem() {
|
||||||
|
@ -138,7 +131,6 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInfo(final View main) {
|
public void updateInfo(final View main) {
|
||||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
|
||||||
updateView(main);
|
updateView(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +291,7 @@ public class TrackDetailsMenu {
|
||||||
yAxisArrow.setVisibility(View.VISIBLE);
|
yAxisArrow.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
yAxis.setOnClickListener(null);
|
yAxis.setOnClickListener(null);
|
||||||
|
yAxis.setBackgroundResource(0);
|
||||||
yAxisArrow.setVisibility(View.GONE);
|
yAxisArrow.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +335,7 @@ public class TrackDetailsMenu {
|
||||||
xAxisArrow.setVisibility(View.VISIBLE);
|
xAxisArrow.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
xAxis.setOnClickListener(null);
|
xAxis.setOnClickListener(null);
|
||||||
|
xAxis.setBackgroundResource(0);
|
||||||
xAxisArrow.setVisibility(View.GONE);
|
xAxisArrow.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package net.osmand.plus.mapmarkers;
|
package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -41,7 +39,6 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
||||||
private boolean target;
|
private boolean target;
|
||||||
|
|
||||||
private OnMarkerSelectListener onClickListener;
|
private OnMarkerSelectListener onClickListener;
|
||||||
private OnDismissListener onDismissListener;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,7 +59,6 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
||||||
onClickListener = routeInfoMenu.getOnMarkerSelectListener();
|
onClickListener = routeInfoMenu.getOnMarkerSelectListener();
|
||||||
onDismissListener = routeInfoMenu.getOnDismissDialogListener();
|
|
||||||
|
|
||||||
screenOrientation = DashLocationFragment.getScreenOrientation(mapActivity);
|
screenOrientation = DashLocationFragment.getScreenOrientation(mapActivity);
|
||||||
|
|
||||||
|
@ -112,14 +108,6 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDismiss(DialogInterface dialog) {
|
|
||||||
super.onDismiss(dialog);
|
|
||||||
if (onDismissListener != null) {
|
|
||||||
onDismissListener.onDismiss(dialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
|
|
@ -315,6 +315,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
menu.hide();
|
menu.hide();
|
||||||
|
|
||||||
mInGpxDetailsMode = true;
|
mInGpxDetailsMode = true;
|
||||||
|
activity.disableDrawer();
|
||||||
mark(View.INVISIBLE, R.id.map_ruler_layout,
|
mark(View.INVISIBLE, R.id.map_ruler_layout,
|
||||||
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
|
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
|
||||||
|
|
||||||
|
@ -329,6 +330,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public void exitGpxDetailsMode() {
|
public void exitGpxDetailsMode() {
|
||||||
mInGpxDetailsMode = false;
|
mInGpxDetailsMode = false;
|
||||||
|
activity.enableDrawer();
|
||||||
mark(View.VISIBLE, R.id.map_ruler_layout,
|
mark(View.VISIBLE, R.id.map_ruler_layout,
|
||||||
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
|
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
|
||||||
|
|
||||||
|
|
|
@ -282,7 +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);
|
trackDetailsMenu = new TrackDetailsMenu(mapActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRouteButtons(View main, boolean routeInfo) {
|
public void updateRouteButtons(View main, boolean routeInfo) {
|
||||||
|
@ -633,6 +633,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
||||||
|
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||||
updateMyLocation(rh, routeDialogOpened);
|
updateMyLocation(rh, routeDialogOpened);
|
||||||
|
@ -654,13 +655,13 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
mapZoomIn.updateVisibility(!routeDialogOpened);
|
mapZoomIn.updateVisibility(!routeDialogOpened);
|
||||||
mapZoomOut.updateVisibility(!routeDialogOpened);
|
mapZoomOut.updateVisibility(!routeDialogOpened);
|
||||||
compassHud.updateVisibility(!routeDialogOpened && shouldShowCompass());
|
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass());
|
||||||
|
|
||||||
if (layersHud.setIconResId(settings.getApplicationMode().getSmallIconDark())) {
|
if (layersHud.setIconResId(settings.getApplicationMode().getSmallIconDark())) {
|
||||||
layersHud.update(app, isNight);
|
layersHud.update(app, isNight);
|
||||||
}
|
}
|
||||||
layersHud.updateVisibility(!routeDialogOpened);
|
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened);
|
||||||
quickSearchHud.updateVisibility(!routeDialogOpened);
|
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened);
|
||||||
|
|
||||||
if (!routePlanningMode && !routeFollowingMode) {
|
if (!routePlanningMode && !routeFollowingMode) {
|
||||||
if (mapView.isZooming()) {
|
if (mapView.isZooming()) {
|
||||||
|
|
Loading…
Reference in a new issue