This commit is contained in:
Dmitry 2020-07-27 11:59:35 +03:00
commit b1cd7a2dab
22 changed files with 593 additions and 275 deletions

View file

@ -249,51 +249,14 @@
</LinearLayout> </LinearLayout>
<LinearLayout <include
android:id="@+id/map_hud_controls" layout="@layout/map_hud_controls"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|bottom" android:layout_gravity="end|bottom"
android:layout_marginLeft="@dimen/fab_margin_right"
android:layout_marginRight="@dimen/fab_margin_right"
android:layout_marginStart="@dimen/fab_margin_right" android:layout_marginStart="@dimen/fab_margin_right"
android:layout_marginEnd="@dimen/fab_margin_right"> android:layout_marginLeft="@dimen/fab_margin_right"
android:layout_marginEnd="@dimen/fab_margin_right"
<ImageButton android:layout_marginRight="@dimen/fab_margin_right" />
android:id="@+id/map_my_location_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="bottom"
android:background="@drawable/btn_circle"
android:contentDescription="@string/shared_string_my_location"
tools:src="@drawable/ic_action_remove_dark" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/map_button_spacing"
android:layout_marginLeft="@dimen/map_button_spacing"
android:orientation="vertical">
<ImageButton
android:id="@+id/map_zoom_in_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomIn"
tools:src="@drawable/ic_action_remove_dark" />
<ImageButton
android:id="@+id/map_zoom_out_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_marginTop="@dimen/map_button_spacing"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomOut"
tools:src="@drawable/ic_action_remove_dark" />
</LinearLayout>
</LinearLayout>
</FrameLayout> </FrameLayout>

View file

@ -145,94 +145,18 @@
tools:src="@drawable/ic_action_remove_dark" tools:src="@drawable/ic_action_remove_dark"
android:contentDescription="@string/snap_to_road" /> android:contentDescription="@string/snap_to_road" />
<FrameLayout <include layout="@layout/map_ruler" />
android:id="@+id/map_ruler_layout"
android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginStart="@dimen/map_button_margin">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin">
<TextView
android:id="@+id/map_ruler_text_shadow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m"/>
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m"/>
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/map_ruler_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/ruler"/>
</FrameLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <include
android:layout_width="wrap_content" layout="@layout/map_hud_controls"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="bottom|end" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/map_button_margin" android:layout_gravity="bottom|end"
android:layout_marginRight="@dimen/map_button_margin" android:layout_marginEnd="@dimen/map_button_margin"
android:layout_marginEnd="@dimen/map_button_margin"> android:layout_marginRight="@dimen/map_button_margin"
android:layout_marginBottom="@dimen/map_button_margin" />
<ImageButton
android:id="@+id/map_my_location_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="bottom"
android:background="@drawable/btn_circle"
android:contentDescription="@string/shared_string_my_location"
tools:src="@drawable/ic_action_remove_dark"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_spacing"
android:layout_marginStart="@dimen/map_button_spacing"
android:orientation="vertical">
<ImageButton
android:id="@+id/map_zoom_in_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomIn"
tools:src="@drawable/ic_action_remove_dark"/>
<ImageButton
android:id="@+id/map_zoom_out_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_marginTop="@dimen/map_button_spacing"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomOut"
tools:src="@drawable/ic_action_remove_dark"/>
</LinearLayout>
</LinearLayout>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/map_horizontal_progress" android:id="@+id/map_horizontal_progress"

View file

@ -0,0 +1,44 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_hud_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom">
<ImageButton
android:id="@+id/map_my_location_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="bottom"
android:background="@drawable/btn_circle"
android:contentDescription="@string/shared_string_my_location"
tools:src="@drawable/ic_action_remove_dark" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/map_button_spacing"
android:layout_marginLeft="@dimen/map_button_spacing"
android:orientation="vertical">
<ImageButton
android:id="@+id/map_zoom_in_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomIn"
tools:src="@drawable/ic_action_remove_dark" />
<ImageButton
android:id="@+id/map_zoom_out_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_marginTop="@dimen/map_button_spacing"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomOut"
tools:src="@drawable/ic_action_remove_dark" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,44 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_ruler_layout"
android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/map_button_margin"
android:layout_marginLeft="@dimen/map_button_margin">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin">
<TextView
android:id="@+id/map_ruler_text_shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m" />
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m" />
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/map_ruler_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/ruler" />
</FrameLayout>

View file

@ -90,6 +90,17 @@
</net.osmand.plus.mapcontextmenu.InterceptorLinearLayout> </net.osmand.plus.mapcontextmenu.InterceptorLinearLayout>
<include
layout="@layout/map_hud_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginStart="@dimen/fab_margin_right"
android:layout_marginLeft="@dimen/fab_margin_right"
android:layout_marginEnd="@dimen/fab_margin_right"
android:layout_marginRight="@dimen/fab_margin_right"
tools:visibility="invisible" />
<LinearLayout <LinearLayout
android:id="@+id/control_buttons" android:id="@+id/control_buttons"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -188,7 +188,7 @@ public class GPXDatabase {
private boolean showAsMarkers; private boolean showAsMarkers;
private boolean joinSegments; private boolean joinSegments;
private boolean showArrows; private boolean showArrows;
private boolean showStartFinish; private boolean showStartFinish = true;
public GpxDataItem(File file, GPXTrackAnalysis analysis) { public GpxDataItem(File file, GPXTrackAnalysis analysis) {
this.file = file; this.file = file;

View file

@ -134,12 +134,13 @@ public class UiUtilities {
public Drawable getLayeredIcon(@DrawableRes int bgIconId, @DrawableRes int foregroundIconId, public Drawable getLayeredIcon(@DrawableRes int bgIconId, @DrawableRes int foregroundIconId,
@ColorRes int bgColorId, @ColorRes int foregroundColorId) { @ColorRes int bgColorId, @ColorRes int foregroundColorId) {
Drawable b = getDrawable(bgIconId, bgColorId); Drawable background = getDrawable(bgIconId, bgColorId);
Drawable f = getDrawable(foregroundIconId, foregroundColorId); Drawable foreground = getDrawable(foregroundIconId, foregroundColorId);
Drawable[] layers = new Drawable[2]; return getLayeredIcon(background, foreground);
layers[0] = b; }
layers[1] = f;
return new LayerDrawable(layers); public static Drawable getLayeredIcon(Drawable... icons) {
return new LayerDrawable(icons);
} }
public Drawable getThemedIcon(@DrawableRes int id) { public Drawable getThemedIcon(@DrawableRes int id) {
@ -214,13 +215,11 @@ public class UiUtilities {
@ColorInt @ColorInt
public static int getColorWithAlpha(@ColorInt int color, float ratio) { public static int getColorWithAlpha(@ColorInt int color, float ratio) {
int newColor = 0;
int alpha = Math.round(Color.alpha(color) * ratio); int alpha = Math.round(Color.alpha(color) * ratio);
int r = Color.red(color); int r = Color.red(color);
int g = Color.green(color); int g = Color.green(color);
int b = Color.blue(color); int b = Color.blue(color);
newColor = Color.argb(alpha, r, g, b); return Color.argb(alpha, r, g, b);
return newColor;
} }
@ColorInt @ColorInt

View file

@ -1244,6 +1244,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapRouteInfoMenu.updateMenu(); mapRouteInfoMenu.updateMenu();
MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude()); MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude());
} else if (toShow instanceof GPXFile) { } else if (toShow instanceof GPXFile) {
hideContextAndRouteInfoMenues();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(TRACK_FILE_PATH, ((GPXFile) toShow).path); args.putString(TRACK_FILE_PATH, ((GPXFile) toShow).path);
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuController.MenuState.HALF_SCREEN); args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuController.MenuState.HALF_SCREEN);

View file

@ -8,6 +8,7 @@ import android.util.Log;
import android.view.Surface; import android.view.Surface;
import android.view.View; import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
@ -92,6 +93,15 @@ public class AndroidUiHelper {
} }
return false; return false;
} }
public static void setVisibility(@NonNull Activity activity, int visibility, @IdRes int... widgets) {
for (int widget : widgets) {
View view = activity.findViewById(widget);
if (view != null && view.getVisibility() != visibility) {
view.setVisibility(visibility);
}
}
}
public static boolean isXLargeDevice(@NonNull Activity ctx) { public static boolean isXLargeDevice(@NonNull Activity ctx) {
int lt = (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK); int lt = (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK);

View file

@ -38,13 +38,11 @@ import net.osmand.TspAnt;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPoint;
@ -57,6 +55,8 @@ import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter;
import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment; import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment;
import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener; import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.MapMarkersLayer; import net.osmand.plus.views.MapMarkersLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
@ -623,11 +623,11 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
markersLayer.setInPlanRouteMode(true); markersLayer.setInPlanRouteMode(true);
mapActivity.disableDrawer(); mapActivity.disableDrawer();
mark(portrait ? View.INVISIBLE : View.GONE, AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE,
R.id.map_left_widgets_panel, R.id.map_left_widgets_panel,
R.id.map_right_widgets_panel, R.id.map_right_widgets_panel,
R.id.map_center_info); R.id.map_center_info);
mark(View.GONE, AndroidUiHelper.setVisibility(mapActivity, View.GONE,
R.id.map_route_info_button, R.id.map_route_info_button,
R.id.map_menu_button, R.id.map_menu_button,
R.id.map_compass_button, R.id.map_compass_button,
@ -694,7 +694,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
mapActivity.hideTopToolbar(toolbarController); mapActivity.hideTopToolbar(toolbarController);
} }
mark(View.VISIBLE, AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
R.id.map_left_widgets_panel, R.id.map_left_widgets_panel,
R.id.map_right_widgets_panel, R.id.map_right_widgets_panel,
R.id.map_center_info, R.id.map_center_info,
@ -778,18 +778,6 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
} }
} }
private void mark(int status, int... widgets) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
for (int widget : widgets) {
View v = mapActivity.findViewById(widget);
if (v != null) {
v.setVisibility(status);
}
}
}
}
private void showHideMarkersList() { private void showHideMarkersList() {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null && portrait) { if (mapActivity != null && portrait) {

View file

@ -1124,7 +1124,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
mapActivity.showTopToolbar(toolBarController); mapActivity.showTopToolbar(toolBarController);
} }
markGeneralComponents(enable ? View.GONE : View.VISIBLE); markGeneralComponents(enable ? View.GONE : View.VISIBLE);
mark(enable ? View.VISIBLE : View.GONE, AndroidUiHelper.setVisibility(mapActivity, enable ? View.VISIBLE : View.GONE,
R.id.move_point_text, R.id.move_point_text,
R.id.move_point_controls); R.id.move_point_controls);
mainIcon.setImageDrawable(getActiveIcon(enable mainIcon.setImageDrawable(getActiveIcon(enable
@ -1144,7 +1144,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
mapActivity.showTopToolbar(toolBarController); mapActivity.showTopToolbar(toolBarController);
} }
markGeneralComponents(enable ? View.GONE : View.VISIBLE); markGeneralComponents(enable ? View.GONE : View.VISIBLE);
mark(enable ? View.VISIBLE : View.GONE, AndroidUiHelper.setVisibility(mapActivity,enable ? View.VISIBLE : View.GONE,
R.id.add_point_before_after_text, R.id.add_point_before_after_text,
R.id.add_point_before_after_controls); R.id.add_point_before_after_controls);
if (!enable) { if (!enable) {
@ -1153,12 +1153,15 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
} }
private void markGeneralComponents(int status) { private void markGeneralComponents(int status) {
mark(status, MapActivity mapActivity = getMapActivity();
R.id.measurement_distance_text_view, if (mapActivity != null) {
R.id.measurement_points_text_view, AndroidUiHelper.setVisibility(mapActivity, status,
R.id.distance_to_center_text_view, R.id.measurement_distance_text_view,
R.id.up_down_button, R.id.measurement_points_text_view,
R.id.measure_mode_controls); R.id.distance_to_center_text_view,
R.id.up_down_button,
R.id.measure_mode_controls);
}
} }
private void addInitialPoint() { private void addInitialPoint() {
@ -1635,11 +1638,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
mapActivity.refreshMap(); mapActivity.refreshMap();
mapActivity.disableDrawer(); mapActivity.disableDrawer();
mark(portrait ? View.INVISIBLE : View.GONE, AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE,
R.id.map_left_widgets_panel, R.id.map_left_widgets_panel,
R.id.map_right_widgets_panel, R.id.map_right_widgets_panel,
R.id.map_center_info); R.id.map_center_info);
mark(View.GONE, AndroidUiHelper.setVisibility(mapActivity, View.GONE,
R.id.map_route_info_button, R.id.map_route_info_button,
R.id.map_menu_button, R.id.map_menu_button,
R.id.map_compass_button, R.id.map_compass_button,
@ -1669,7 +1672,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
measurementLayer.setInMeasurementMode(false); measurementLayer.setInMeasurementMode(false);
mapActivity.enableDrawer(); mapActivity.enableDrawer();
mark(View.VISIBLE, AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
R.id.map_left_widgets_panel, R.id.map_left_widgets_panel,
R.id.map_right_widgets_panel, R.id.map_right_widgets_panel,
R.id.map_center_info, R.id.map_center_info,
@ -1689,18 +1692,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
} }
} }
private void mark(int status, int... widgets) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
for (int widget : widgets) {
View v = mapActivity.findViewById(widget);
if (v != null) {
v.setVisibility(status);
}
}
}
}
public void quit(boolean hidePointsListFirst) { public void quit(boolean hidePointsListFirst) {
if (editingCtx.getOriginalPointToMove() != null) { if (editingCtx.getOriginalPointToMove() != null) {
cancelMovePointMode(); cancelMovePointMode();

View file

@ -53,17 +53,21 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.dialogs.GpxAppearanceAdapter;
import net.osmand.plus.measurementtool.NewGpxData; import net.osmand.plus.measurementtool.NewGpxData;
import net.osmand.plus.track.SplitTrackAsyncTask;
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener; import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
import net.osmand.plus.track.GpxSplitType; import net.osmand.plus.track.GpxSplitType;
import net.osmand.plus.track.SplitIntervalCard;
import net.osmand.plus.track.SplitTrackAsyncTask;
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
import net.osmand.plus.widgets.tools.CropCircleTransformation; import net.osmand.plus.widgets.tools.CropCircleTransformation;
import net.osmand.plus.wikipedia.WikiArticleHelper; import net.osmand.plus.wikipedia.WikiArticleHelper;
import net.osmand.plus.wikivoyage.WikivoyageUtils; import net.osmand.plus.wikivoyage.WikivoyageUtils;
import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment; import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment;
import net.osmand.plus.wikivoyage.data.TravelArticle; import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.render.RenderingRulesStorage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -71,6 +75,8 @@ import java.util.Map;
import gnu.trove.list.array.TIntArrayList; import gnu.trove.list.array.TIntArrayList;
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener { public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
private OsmandApplication app; private OsmandApplication app;
@ -308,9 +314,9 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
} }
}); });
splitColorView.setVisibility(View.GONE);
if (showMapOnly) { if (showMapOnly) {
splitIntervalView.setVisibility(View.GONE); splitIntervalView.setVisibility(View.GONE);
splitColorView.setVisibility(View.GONE);
appearanceView.setVisibility(View.GONE); appearanceView.setVisibility(View.GONE);
divider.setVisibility(View.GONE); divider.setVisibility(View.GONE);
bottomDivider.setVisibility(View.VISIBLE); bottomDivider.setVisibility(View.VISIBLE);
@ -354,17 +360,16 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
} }
}); });
appearanceView.setVisibility(View.VISIBLE); appearanceView.setVisibility(View.VISIBLE);
splitColorView.setVisibility(View.VISIBLE);
divider.setVisibility(View.VISIBLE); divider.setVisibility(View.VISIBLE);
} else { } else {
appearanceView.setVisibility(View.GONE); appearanceView.setVisibility(View.GONE);
splitColorView.setVisibility(View.GONE);
divider.setVisibility(View.GONE); divider.setVisibility(View.GONE);
} }
} }
updateTrackColor();
} }
private void showTemporaryObjectOnMap(Object toShow){ private void showTemporaryObjectOnMap(Object toShow) {
TrackActivity activity = getTrackActivity(); TrackActivity activity = getTrackActivity();
GpxDataItem gpxDataItem = getGpxDataItem(); GpxDataItem gpxDataItem = getGpxDataItem();
GPXFile gpx = getGpx(); GPXFile gpx = getGpx();
@ -708,6 +713,27 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
return Math.max(position, 0); return Math.max(position, 0);
} }
private void updateTrackColor() {
int color = getGpxDataItem() != null ? getGpxDataItem().getColor() : 0;
GPXFile gpxFile = getGpx();
if (color == 0 && gpxFile != null) {
if (gpxFile.showCurrentTrack) {
color = app.getSettings().CURRENT_TRACK_COLOR.get();
} else {
color = gpxFile.getColor(0);
}
}
if (color == 0) {
RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer();
CommonPreference<String> prefColor = app.getSettings().getCustomRenderProperty(CURRENT_TRACK_COLOR_ATTR);
color = GpxAppearanceAdapter.parseTrackColor(renderer, prefColor.get());
}
TrackBitmapDrawer trackDrawer = getTrackBitmapDrawer();
if (trackDrawer != null) {
trackDrawer.setTrackColor(color);
}
}
public List<GpxSelectionHelper.GpxDisplayItem> flatten(List<GpxDisplayGroup> groups) { public List<GpxSelectionHelper.GpxDisplayItem> flatten(List<GpxDisplayGroup> groups) {
ArrayList<GpxSelectionHelper.GpxDisplayItem> list = new ArrayList<>(); ArrayList<GpxSelectionHelper.GpxDisplayItem> list = new ArrayList<>();
for (GpxDisplayGroup g : groups) { for (GpxDisplayGroup g : groups) {
@ -756,7 +782,7 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
if (activity != null && gpxSplitType != null && gpxFile != null) { if (activity != null && gpxSplitType != null && gpxFile != null) {
int timeSplit = 0; int timeSplit = 0;
double distanceSplit = 0; double distanceSplit = 0;
if (!gpxFile.showCurrentTrack) { if (gpxSplitType != GpxSplitType.NO_SPLIT && !gpxFile.showCurrentTrack) {
timeSplit = this.timeSplit.get(selectedSplitInterval); timeSplit = this.timeSplit.get(selectedSplitInterval);
distanceSplit = this.distanceSplit.get(selectedSplitInterval); distanceSplit = this.distanceSplit.get(selectedSplitInterval);
} }
@ -804,20 +830,14 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
if (model.size() > 0) { if (model.size() > 0) {
if (distance) { if (distance) {
double dvalue = OsmAndFormatter.calculateRoundedDist(value, app); double dvalue = OsmAndFormatter.calculateRoundedDist(value, app);
options.add(OsmAndFormatter.getFormattedDistance((float) dvalue, app)); options.add(SplitIntervalCard.getFormattedDistanceInterval(app, value));
distanceSplit.add(dvalue); distanceSplit.add(dvalue);
timeSplit.add(-1); timeSplit.add(-1);
if (Math.abs(model.get(0).getSplitDistance() - dvalue) < 1) { if (Math.abs(model.get(0).getSplitDistance() - dvalue) < 1) {
selectedSplitInterval = distanceSplit.size() - 1; selectedSplitInterval = distanceSplit.size() - 1;
} }
} else { } else {
if (value < 60) { options.add(SplitIntervalCard.getFormattedTimeInterval(app, value));
options.add(value + " " + app.getString(R.string.int_seconds));
} else if (value % 60 == 0) {
options.add((value / 60) + " " + app.getString(R.string.int_min));
} else {
options.add((value / 60f) + " " + app.getString(R.string.int_min));
}
distanceSplit.add(-1d); distanceSplit.add(-1d);
timeSplit.add(value); timeSplit.add(value);
if (model.get(0).getSplitTime() == value) { if (model.get(0).getSplitTime() == value) {

View file

@ -42,6 +42,11 @@ public class DirectionArrowsCard extends BaseCard {
compoundButton.setChecked(checked); compoundButton.setChecked(checked);
trackDrawInfo.setShowArrows(checked); trackDrawInfo.setShowArrows(checked);
mapActivity.refreshMap(); mapActivity.refreshMap();
CardListener listener = getListener();
if (listener != null) {
listener.onCardPressed(DirectionArrowsCard.this);
}
} }
}); });
} }

View file

@ -1,6 +1,5 @@
package net.osmand.plus.track; package net.osmand.plus.track;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -27,7 +26,6 @@ import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -190,7 +188,7 @@ public class SplitIntervalBottomSheet extends MenuBottomSheetDialogFragment {
private void addDistanceOptionSplit(int value, @NonNull List<GpxDisplayGroup> displayGroups) { private void addDistanceOptionSplit(int value, @NonNull List<GpxDisplayGroup> displayGroups) {
if (displayGroups.size() > 0) { if (displayGroups.size() > 0) {
double dvalue = OsmAndFormatter.calculateRoundedDist(value, app); double dvalue = OsmAndFormatter.calculateRoundedDist(value, app);
String formattedDist = OsmAndFormatter.getFormattedDistance((float) dvalue, app); String formattedDist = SplitIntervalCard.getFormattedDistanceInterval(app, value);
distanceSplitOptions.put(formattedDist, dvalue); distanceSplitOptions.put(formattedDist, dvalue);
if (Math.abs(displayGroups.get(0).getSplitDistance() - dvalue) < 1) { if (Math.abs(displayGroups.get(0).getSplitDistance() - dvalue) < 1) {
selectedDistanceSplitInterval = distanceSplitOptions.size() - 1; selectedDistanceSplitInterval = distanceSplitOptions.size() - 1;
@ -200,14 +198,7 @@ public class SplitIntervalBottomSheet extends MenuBottomSheetDialogFragment {
private void addTimeOptionSplit(int value, @NonNull List<GpxDisplayGroup> model) { private void addTimeOptionSplit(int value, @NonNull List<GpxDisplayGroup> model) {
if (model.size() > 0) { if (model.size() > 0) {
String time; String time = SplitIntervalCard.getFormattedTimeInterval(app, value);
if (value < 60) {
time = value + " " + getString(R.string.int_seconds);
} else if (value % 60 == 0) {
time = (value / 60) + " " + getString(R.string.int_min);
} else {
time = (value / 60f) + " " + getString(R.string.int_min);
}
timeSplitOptions.put(time, value); timeSplitOptions.put(time, value);
if (model.get(0).getSplitTime() == value) { if (model.get(0).getSplitTime() == value) {
selectedTimeSplitInterval = timeSplitOptions.size() - 1; selectedTimeSplitInterval = timeSplitOptions.size() - 1;
@ -311,24 +302,10 @@ public class SplitIntervalBottomSheet extends MenuBottomSheetDialogFragment {
int timeSplit = new ArrayList<>(timeSplitOptions.values()).get(selectedTimeSplitInterval); int timeSplit = new ArrayList<>(timeSplitOptions.values()).get(selectedTimeSplitInterval);
double distanceSplit = new ArrayList<>(distanceSplitOptions.values()).get(selectedDistanceSplitInterval); double distanceSplit = new ArrayList<>(distanceSplitOptions.values()).get(selectedDistanceSplitInterval);
SplitTrackListener splitTrackListener = new SplitTrackListener() { Fragment target = getTargetFragment();
if (target instanceof TrackAppearanceFragment) {
@Override ((TrackAppearanceFragment) target).applySplit(selectedSplitType, timeSplit, distanceSplit);
public void trackSplittingStarted() { }
}
@Override
public void trackSplittingFinished() {
if (selectedGpxFile != null) {
List<GpxDisplayGroup> groups = getDisplayGroups();
selectedGpxFile.setDisplayGroups(groups, app);
}
}
};
List<GpxDisplayGroup> groups = getDisplayGroups();
new SplitTrackAsyncTask(app, selectedSplitType, groups, splitTrackListener, trackDrawInfo.isJoinSegments(),
timeSplit, distanceSplit).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@NonNull @NonNull

View file

@ -1,19 +1,31 @@
package net.osmand.plus.track; package net.osmand.plus.track;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
public class SplitIntervalCard extends BaseCard { public class SplitIntervalCard extends BaseCard {
public SplitIntervalCard(@NonNull MapActivity mapActivity) { private TrackDrawInfo trackDrawInfo;
public SplitIntervalCard(@NonNull MapActivity mapActivity, @NonNull TrackDrawInfo trackDrawInfo) {
super(mapActivity); super(mapActivity);
this.trackDrawInfo = trackDrawInfo;
} }
@Override @Override
@ -28,6 +40,17 @@ public class SplitIntervalCard extends BaseCard {
TextView titleView = view.findViewById(R.id.title); TextView titleView = view.findViewById(R.id.title);
titleView.setText(R.string.gpx_split_interval); titleView.setText(R.string.gpx_split_interval);
Typeface typeface = FontCache.getFont(app, app.getString(R.string.font_roboto_medium));
int secondaryTextColor = AndroidUtils.getColorFromAttr(view.getContext(), R.attr.active_color_basic);
String splitInterval = getSplitInterval();
SpannableStringBuilder spannableSplitInterval = new SpannableStringBuilder(splitInterval);
spannableSplitInterval.setSpan(new ForegroundColorSpan(secondaryTextColor), 0, spannableSplitInterval.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableSplitInterval.setSpan(new CustomTypefaceSpan(typeface), 0, spannableSplitInterval.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
TextView descriptionView = view.findViewById(R.id.description);
descriptionView.setText(spannableSplitInterval);
view.setOnClickListener(new View.OnClickListener() { view.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -38,4 +61,32 @@ public class SplitIntervalCard extends BaseCard {
} }
}); });
} }
private String getSplitInterval() {
String intervalStr = "";
int splitInterval = (int) trackDrawInfo.getSplitInterval();
if (splitInterval == 0) {
intervalStr = GpxSplitType.NO_SPLIT.getHumanString(app);
} else if (trackDrawInfo.getSplitType() == GpxSplitType.DISTANCE.getType()) {
intervalStr = getFormattedDistanceInterval(app, trackDrawInfo.getSplitInterval());
} else if (trackDrawInfo.getSplitType() == GpxSplitType.TIME.getType()) {
intervalStr = getFormattedTimeInterval(app, splitInterval);
}
return intervalStr;
}
public static String getFormattedTimeInterval(OsmandApplication app, double interval) {
if (interval < 60) {
return interval + " " + app.getString(R.string.int_seconds);
} else if (interval % 60 == 0) {
return (interval / 60) + " " + app.getString(R.string.int_min);
} else {
return (interval / 60f) + " " + app.getString(R.string.int_min);
}
}
public static String getFormattedDistanceInterval(OsmandApplication app, double interval) {
double roundedDist = OsmAndFormatter.calculateRoundedDist(interval, app);
return OsmAndFormatter.getFormattedDistance((float) roundedDist, app);
}
} }

View file

@ -1,5 +1,7 @@
package net.osmand.plus.track; package net.osmand.plus.track;
import android.Manifest;
import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
@ -9,29 +11,41 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
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.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.UiUtilities.DialogButtonType; import net.osmand.plus.UiUtilities.DialogButtonType;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.ContextMenuFragment; import net.osmand.plus.base.ContextMenuFragment;
import net.osmand.plus.base.ContextMenuFragment.ContextMenuFragmentListener;
import net.osmand.plus.dialogs.GpxAppearanceAdapter; import net.osmand.plus.dialogs.GpxAppearanceAdapter;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -42,9 +56,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR; import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD;
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM;
import static net.osmand.plus.track.TrackDrawInfo.TRACK_FILE_PATH; import static net.osmand.plus.track.TrackDrawInfo.TRACK_FILE_PATH;
public class TrackAppearanceFragment extends ContextMenuFragment implements CardListener { public class TrackAppearanceFragment extends ContextMenuFragment implements CardListener, ContextMenuFragmentListener {
public static final String TAG = TrackAppearanceFragment.class.getName(); public static final String TAG = TrackAppearanceFragment.class.getName();
@ -57,12 +73,15 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
private SelectedGpxFile selectedGpxFile; private SelectedGpxFile selectedGpxFile;
private List<GpxDisplayGroup> displayGroups; private List<GpxDisplayGroup> displayGroups;
private ImageView appearanceIcon;
private int menuTitleHeight; private int menuTitleHeight;
private long modifiedTime = -1; private long modifiedTime = -1;
private TrackWidthCard trackWidthCard; private TrackWidthCard trackWidthCard;
private SplitIntervalCard splitIntervalCard;
private ImageView appearanceIcon;
private View zoomButtonsView;
private ImageButton myLocButtonView;
@Override @Override
public int getMainLayoutId() { public int getMainLayoutId() {
@ -136,6 +155,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
if (view != null) { if (view != null) {
appearanceIcon = view.findViewById(R.id.appearance_icon); appearanceIcon = view.findViewById(R.id.appearance_icon);
setListener(this);
if (isPortrait()) { if (isPortrait()) {
updateCardsLayout(); updateCardsLayout();
@ -149,6 +169,8 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
params.gravity = Gravity.BOTTOM | Gravity.START; params.gravity = Gravity.BOTTOM | Gravity.START;
view.findViewById(R.id.control_buttons).setLayoutParams(params); view.findViewById(R.id.control_buttons).setLayoutParams(params);
} }
buildZoomButtons(view);
enterTrackAppearanceMode();
runLayoutListener(); runLayoutListener();
} }
return view; return view;
@ -174,6 +196,21 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
updateStatusBarColor(); updateStatusBarColor();
} }
@Override
public void onContextMenuYPosChanged(@NonNull ContextMenuFragment fragment, int y, boolean needMapAdjust, boolean animated) {
updateZoomButtonsPos(fragment, y, animated);
}
@Override
public void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState) {
updateZoomButtonsVisibility(menuState);
}
@Override
public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) {
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -192,6 +229,40 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
} }
} }
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
adjustMapPosition(getHeight());
}
@Override
public void onDestroyView() {
super.onDestroyView();
exitTrackAppearanceMode();
}
private void enterTrackAppearanceMode() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE,
R.id.map_left_widgets_panel,
R.id.map_right_widgets_panel,
R.id.map_center_info);
}
}
private void exitTrackAppearanceMode() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
R.id.map_left_widgets_panel,
R.id.map_right_widgets_panel,
R.id.map_center_info,
R.id.map_search_button);
}
}
@Override @Override
public void onSaveInstanceState(@NonNull Bundle outState) { public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
@ -240,6 +311,10 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
if (trackWidthCard != null) { if (trackWidthCard != null) {
trackWidthCard.updateItems(); trackWidthCard.updateItems();
} }
} else if (card instanceof TrackWidthCard) {
updateAppearanceIcon();
} else if (card instanceof DirectionArrowsCard) {
updateAppearanceIcon();
} }
} }
} }
@ -249,11 +324,183 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
} }
@Override
protected int applyPosY(int currentY, boolean needCloseMenu, boolean needMapAdjust, int previousMenuState, int newMenuState, int dZoom, boolean animated) {
int y = super.applyPosY(currentY, needCloseMenu, needMapAdjust, previousMenuState, newMenuState, dZoom, animated);
if (needMapAdjust) {
adjustMapPosition(y);
}
return y;
}
private void buildZoomButtons(@NonNull View view) {
OsmandApplication app = requireMyApplication();
this.zoomButtonsView = view.findViewById(R.id.map_hud_controls);
ImageButton zoomInButtonView = (ImageButton) view.findViewById(R.id.map_zoom_in_button);
ImageButton zoomOutButtonView = (ImageButton) view.findViewById(R.id.map_zoom_out_button);
AndroidUtils.updateImageButton(app, zoomInButtonView, R.drawable.ic_zoom_in, R.drawable.ic_zoom_in,
R.drawable.btn_circle_trans, R.drawable.btn_circle_night, isNightMode());
AndroidUtils.updateImageButton(app, zoomOutButtonView, R.drawable.ic_zoom_out, R.drawable.ic_zoom_out,
R.drawable.btn_circle_trans, R.drawable.btn_circle_night, isNightMode());
zoomInButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
doZoomIn();
}
});
zoomOutButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
doZoomOut();
}
});
myLocButtonView = (ImageButton) view.findViewById(R.id.map_my_location_button);
myLocButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)) {
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
} else {
ActivityCompat.requestPermissions(mapActivity,
new String[] {Manifest.permission.ACCESS_FINE_LOCATION},
OsmAndLocationProvider.REQUEST_LOCATION_PERMISSION);
}
}
}
});
updateMyLocation();
zoomButtonsView.setVisibility(View.VISIBLE);
}
private void updateMyLocation() {
MapActivity mapActivity = getMapActivity();
if (mapActivity == null) {
return;
}
OsmandApplication app = mapActivity.getMyApplication();
Location lastKnownLocation = app.getLocationProvider().getLastKnownLocation();
boolean enabled = lastKnownLocation != null;
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
ImageButton myLocButtonView = this.myLocButtonView;
if (myLocButtonView != null) {
if (!enabled) {
myLocButtonView.setImageDrawable(getIcon(R.drawable.ic_my_location, R.color.icon_color_default_light));
AndroidUtils.setBackground(app, myLocButtonView, isNightMode(), R.drawable.btn_circle, R.drawable.btn_circle_night);
myLocButtonView.setContentDescription(mapActivity.getString(R.string.unknown_location));
} else if (tracked) {
myLocButtonView.setImageDrawable(getIcon(R.drawable.ic_my_location, R.color.color_myloc_distance));
AndroidUtils.setBackground(app, myLocButtonView, isNightMode(), R.drawable.btn_circle, R.drawable.btn_circle_night);
} else {
myLocButtonView.setImageResource(R.drawable.ic_my_location);
AndroidUtils.setBackground(app, myLocButtonView, isNightMode(), R.drawable.btn_circle_blue, R.drawable.btn_circle_blue);
myLocButtonView.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc));
}
if (app.accessibilityEnabled()) {
myLocButtonView.setClickable(enabled && !tracked && app.getRoutingHelper().isFollowingMode());
}
}
}
public void updateZoomButtonsPos(@NonNull ContextMenuFragment fragment, int y, boolean animated) {
View zoomButtonsView = this.zoomButtonsView;
if (zoomButtonsView != null) {
int zoomY = y - getZoomButtonsHeight();
if (animated) {
fragment.animateView(zoomButtonsView, zoomY);
} else {
zoomButtonsView.setY(zoomY);
}
}
}
private int getZoomButtonsHeight() {
View zoomButtonsView = this.zoomButtonsView;
return zoomButtonsView != null ? zoomButtonsView.getHeight() : 0;
}
public void doZoomIn() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
OsmandMapTileView map = mapActivity.getMapView();
if (map.isZooming() && map.hasCustomMapRatio()) {
mapActivity.changeZoom(2, System.currentTimeMillis());
} else {
mapActivity.changeZoom(1, System.currentTimeMillis());
}
}
}
public void doZoomOut() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.changeZoom(-1, System.currentTimeMillis());
}
}
private void updateZoomButtonsVisibility(int menuState) {
View zoomButtonsView = this.zoomButtonsView;
if (zoomButtonsView != null) {
if (menuState == MenuState.HEADER_ONLY) {
if (zoomButtonsView.getVisibility() != View.VISIBLE) {
zoomButtonsView.setVisibility(View.VISIBLE);
}
} else {
if (zoomButtonsView.getVisibility() == View.VISIBLE) {
zoomButtonsView.setVisibility(View.INVISIBLE);
}
}
}
}
private void updateAppearanceIcon() { private void updateAppearanceIcon() {
Drawable icon = getPaintedContentIcon(R.drawable.ic_action_gpx_width_bold, trackDrawInfo.getColor()); Drawable icon = getTrackIcon(app, trackDrawInfo.getWidth(), trackDrawInfo.isShowArrows(), trackDrawInfo.getColor());
appearanceIcon.setImageDrawable(icon); appearanceIcon.setImageDrawable(icon);
} }
private void adjustMapPosition(int y) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && mapActivity.getMapView() != null) {
GPXFile gpxFile = selectedGpxFile.getGpxFile();
QuadRect r = gpxFile.getRect();
RotatedTileBox tb = mapActivity.getMapView().getCurrentRotatedTileBox().copy();
int tileBoxWidthPx = 0;
int tileBoxHeightPx = 0;
if (!isPortrait()) {
tileBoxWidthPx = tb.getPixWidth() - getWidth();
} else {
int fHeight = getViewHeight() - y - AndroidUtils.getStatusBarHeight(mapActivity);
tileBoxHeightPx = tb.getPixHeight() - fHeight;
}
if (r.left != 0 && r.right != 0) {
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0);
}
}
}
public Drawable getTrackIcon(OsmandApplication app, String widthAttr, boolean showArrows, @ColorInt int color) {
int widthIconId = getWidthIconId(widthAttr);
Drawable widthIcon = app.getUIUtilities().getPaintedIcon(widthIconId, color);
int strokeIconId = getStrokeIconId(widthAttr);
int strokeColor = UiUtilities.getColorWithAlpha(Color.BLACK, 0.7f);
Drawable strokeIcon = app.getUIUtilities().getPaintedIcon(strokeIconId, strokeColor);
Drawable arrows = null;
if (showArrows) {
int arrowsIconId = getArrowsIconId(widthAttr);
int contrastColor = UiUtilities.getContrastColor(app, color, false);
arrows = app.getUIUtilities().getPaintedIcon(arrowsIconId, contrastColor);
}
return UiUtilities.getLayeredIcon(widthIcon, strokeIcon, arrows);
}
private void updateCardsLayout() { private void updateCardsLayout() {
View mainView = getMainView(); View mainView = getMainView();
if (mainView != null) { if (mainView != null) {
@ -289,7 +536,10 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
@Override @Override
public void onClick(View v) { public void onClick(View v) {
discardChanges(); discardChanges();
dismiss(); FragmentActivity activity = getActivity();
if (activity != null) {
activity.onBackPressed();
}
} }
}); });
@ -336,27 +586,38 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
if (splitType == null) { if (splitType == null) {
splitType = GpxSplitType.NO_SPLIT; splitType = GpxSplitType.NO_SPLIT;
} }
SplitTrackAsyncTask.SplitTrackListener splitTrackListener = new SplitTrackAsyncTask.SplitTrackListener() { applySplit(splitType, timeSplit, distanceSplit);
@Override
public void trackSplittingStarted() {
}
@Override
public void trackSplittingFinished() {
if (selectedGpxFile != null) {
List<GpxDisplayGroup> groups = getGpxDisplayGroups();
selectedGpxFile.setDisplayGroups(groups, app);
}
}
};
List<GpxDisplayGroup> groups = getGpxDisplayGroups();
new SplitTrackAsyncTask(app, splitType, groups, splitTrackListener, trackDrawInfo.isJoinSegments(),
timeSplit, distanceSplit).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
} }
void applySplit(GpxSplitType splitType, int timeSplit, double distanceSplit) {
if (splitIntervalCard != null) {
splitIntervalCard.updateContent();
}
SplitTrackListener splitTrackListener = new SplitTrackListener() {
@Override
public void trackSplittingStarted() {
}
@Override
public void trackSplittingFinished() {
if (selectedGpxFile != null) {
List<GpxDisplayGroup> groups = getGpxDisplayGroups();
selectedGpxFile.setDisplayGroups(groups, app);
}
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {
mapActivity.refreshMap();
}
}
};
List<GpxDisplayGroup> groups = getGpxDisplayGroups();
new SplitTrackAsyncTask(app, splitType, groups, splitTrackListener, trackDrawInfo.isJoinSegments(),
timeSplit, distanceSplit).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void saveGpx(final GPXFile gpxFile) { private void saveGpx(final GPXFile gpxFile) {
new SaveGpxAsyncTask(gpxFile, new SaveGpxAsyncTask.SaveGpxListener() { new SaveGpxAsyncTask(gpxFile, new SaveGpxAsyncTask.SaveGpxListener() {
@Override @Override
@ -379,11 +640,12 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
ViewGroup cardsContainer = getCardsContainer(); ViewGroup cardsContainer = getCardsContainer();
cardsContainer.removeAllViews(); cardsContainer.removeAllViews();
SplitIntervalCard splitIntervalCard = new SplitIntervalCard(mapActivity); splitIntervalCard = new SplitIntervalCard(mapActivity, trackDrawInfo);
splitIntervalCard.setListener(this); splitIntervalCard.setListener(this);
cardsContainer.addView(splitIntervalCard.build(mapActivity)); cardsContainer.addView(splitIntervalCard.build(mapActivity));
DirectionArrowsCard directionArrowsCard = new DirectionArrowsCard(mapActivity, trackDrawInfo); DirectionArrowsCard directionArrowsCard = new DirectionArrowsCard(mapActivity, trackDrawInfo);
directionArrowsCard.setListener(this);
cardsContainer.addView(directionArrowsCard.build(mapActivity)); cardsContainer.addView(directionArrowsCard.build(mapActivity));
TrackColoringCard trackColoringCard = new TrackColoringCard(mapActivity, trackDrawInfo); TrackColoringCard trackColoringCard = new TrackColoringCard(mapActivity, trackDrawInfo);
@ -391,6 +653,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
cardsContainer.addView(trackColoringCard.build(mapActivity)); cardsContainer.addView(trackColoringCard.build(mapActivity));
trackWidthCard = new TrackWidthCard(mapActivity, trackDrawInfo); trackWidthCard = new TrackWidthCard(mapActivity, trackDrawInfo);
trackWidthCard.setListener(this);
cardsContainer.addView(trackWidthCard.build(mapActivity)); cardsContainer.addView(trackWidthCard.build(mapActivity));
} }
} }
@ -433,4 +696,34 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
return false; return false;
} }
} }
public static int getWidthIconId(String widthAttr) {
if (TRACK_WIDTH_BOLD.equals(widthAttr)) {
return R.drawable.ic_action_track_line_bold_color;
} else if (TRACK_WIDTH_MEDIUM.equals(widthAttr)) {
return R.drawable.ic_action_track_line_medium_color;
} else {
return R.drawable.ic_action_track_line_thin_color;
}
}
public static int getStrokeIconId(String widthAttr) {
if (TRACK_WIDTH_BOLD.equals(widthAttr)) {
return R.drawable.ic_action_track_line_bold_stroke;
} else if (TRACK_WIDTH_MEDIUM.equals(widthAttr)) {
return R.drawable.ic_action_track_line_medium_stroke;
} else {
return R.drawable.ic_action_track_line_thin_stroke;
}
}
public static int getArrowsIconId(String widthAttr) {
if (TRACK_WIDTH_BOLD.equals(widthAttr)) {
return R.drawable.ic_action_track_line_bold_direction;
} else if (TRACK_WIDTH_MEDIUM.equals(widthAttr)) {
return R.drawable.ic_action_track_line_medium_direction;
} else {
return R.drawable.ic_action_track_line_thin_direction;
}
}
} }

View file

@ -195,6 +195,11 @@ public class TrackWidthCard extends BaseCard {
updateHeader(); updateHeader();
updateCustomWidthSlider(); updateCustomWidthSlider();
CardListener listener = getListener();
if (listener != null) {
listener.onCardPressed(TrackWidthCard.this);
}
} }
}); });
} }
@ -207,7 +212,7 @@ public class TrackWidthCard extends BaseCard {
iconId = R.drawable.ic_action_settings; iconId = R.drawable.ic_action_settings;
color = AndroidUtils.getColorFromAttr(holder.itemView.getContext(), R.attr.active_color_basic); color = AndroidUtils.getColorFromAttr(holder.itemView.getContext(), R.attr.active_color_basic);
} else { } else {
iconId = GpxAppearanceAdapter.getWidthIconId(item.getValue()); iconId = TrackAppearanceFragment.getWidthIconId(item.getValue());
} }
holder.icon.setImageDrawable(app.getUIUtilities().getPaintedIcon(iconId, color)); holder.icon.setImageDrawable(app.getUIUtilities().getPaintedIcon(iconId, color));
} }

View file

@ -57,6 +57,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityActions; import net.osmand.plus.activities.MapActivityActions;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController; import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
@ -454,7 +455,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
mInGpxDetailsMode = true; mInGpxDetailsMode = true;
activity.disableDrawer(); activity.disableDrawer();
mark(View.INVISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(activity, 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);
View collapseButton = activity.findViewById(R.id.map_collapse_button); View collapseButton = activity.findViewById(R.id.map_collapse_button);
@ -469,7 +470,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
public void exitGpxDetailsMode() { public void exitGpxDetailsMode() {
mInGpxDetailsMode = false; mInGpxDetailsMode = false;
activity.enableDrawer(); activity.enableDrawer();
mark(View.VISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(activity, 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);
View collapseButton = activity.findViewById(R.id.map_collapse_button); View collapseButton = activity.findViewById(R.id.map_collapse_button);
@ -480,7 +481,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
private void quitMovingMarker() { private void quitMovingMarker() {
mInChangeMarkerPositionMode = false; mInChangeMarkerPositionMode = false;
mark(View.VISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(activity, 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);
View collapseButton = activity.findViewById(R.id.map_collapse_button); View collapseButton = activity.findViewById(R.id.map_collapse_button);
@ -491,7 +492,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
public void quitAddGpxPoint() { public void quitAddGpxPoint() {
mInAddGpxPointMode = false; mInAddGpxPointMode = false;
mark(View.VISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(activity, 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);
View collapseButton = activity.findViewById(R.id.map_collapse_button); View collapseButton = activity.findViewById(R.id.map_collapse_button);
@ -508,7 +509,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
mInAddGpxPointMode = true; mInAddGpxPointMode = true;
mAddGpxPointBottomSheetHelper.show(newGpxPoint); mAddGpxPointBottomSheetHelper.show(newGpxPoint);
mark(View.INVISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(activity, 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);
View collapseButton = activity.findViewById(R.id.map_collapse_button); View collapseButton = activity.findViewById(R.id.map_collapse_button);
@ -541,7 +542,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
mInChangeMarkerPositionMode = true; mInChangeMarkerPositionMode = true;
mMoveMarkerBottomSheetHelper.show(menu.getRightIcon()); mMoveMarkerBottomSheetHelper.show(menu.getRightIcon());
mark(View.INVISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(activity, 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);
View collapseButton = activity.findViewById(R.id.map_collapse_button); View collapseButton = activity.findViewById(R.id.map_collapse_button);
@ -555,15 +556,6 @@ public class ContextMenuLayer extends OsmandMapLayer {
view.refreshMap(); view.refreshMap();
} }
private void mark(int status, int... widgets) {
for (int widget : widgets) {
View v = activity.findViewById(widget);
if (v != null) {
v.setVisibility(status);
}
}
}
public void cancelMovingMarker() { public void cancelMovingMarker() {
cancelApplyingNewMarkerPosition = true; cancelApplyingNewMarkerPosition = true;
quitMovingMarker(); quitMovingMarker();

View file

@ -94,6 +94,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
private Drawable startPointIcon; private Drawable startPointIcon;
private Drawable finishPointIcon; private Drawable finishPointIcon;
private Drawable startAndFinishIcon;
private LayerDrawable selectedPoint; private LayerDrawable selectedPoint;
private TrackDrawInfo trackDrawInfo; private TrackDrawInfo trackDrawInfo;
private TrackChartPoints trackChartPoints; private TrackChartPoints trackChartPoints;
@ -190,6 +191,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
UiUtilities iconsCache = view.getApplication().getUIUtilities(); UiUtilities iconsCache = view.getApplication().getUIUtilities();
startPointIcon = iconsCache.getIcon(R.drawable.map_track_point_start); startPointIcon = iconsCache.getIcon(R.drawable.map_track_point_start);
finishPointIcon = iconsCache.getIcon(R.drawable.map_track_point_finish); finishPointIcon = iconsCache.getIcon(R.drawable.map_track_point_finish);
startAndFinishIcon = iconsCache.getIcon(R.drawable.map_track_point_start_finish);
contextMenuLayer = view.getLayerByClass(ContextMenuLayer.class); contextMenuLayer = view.getLayerByClass(ContextMenuLayer.class);
@ -545,8 +547,12 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
WptPt start = segment.points.get(0); WptPt start = segment.points.get(0);
WptPt end = segment.points.get(segment.points.size() - 1); WptPt end = segment.points.get(segment.points.size() - 1);
drawPoint(canvas, tileBox, start, startPointIcon); if (start.equals(end)) {
drawPoint(canvas, tileBox, end, finishPointIcon); drawPoint(canvas, tileBox, start, startAndFinishIcon);
} else {
drawPoint(canvas, tileBox, start, startPointIcon);
drawPoint(canvas, tileBox, end, finishPointIcon);
}
} }
} }
} }

View file

@ -311,7 +311,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
view.setLatLon(lat, lon); view.setLatLon(lat, lon);
inMovingMarkerMode = true; inMovingMarkerMode = true;
mark(View.INVISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(mapActivity, 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);
View collapseButton = mapActivity.findViewById(R.id.map_collapse_button); View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
@ -349,7 +349,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
} }
inMovingMarkerMode = false; inMovingMarkerMode = false;
mark(View.VISIBLE, R.id.map_ruler_layout, AndroidUiHelper.setVisibility(mapActivity, 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);
View collapseButton = mapActivity.findViewById(R.id.map_collapse_button); View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
@ -359,15 +359,6 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
view.refreshMap(); view.refreshMap();
} }
private void mark(int status, int... widgets) {
for (int widget : widgets) {
View v = mapActivity.findViewById(widget);
if (v != null) {
v.setVisibility(status);
}
}
}
@Override @Override
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
if (isInMovingMarkerMode() && !pressedQuickActionWidget(point.x, point.y)) { if (isInMovingMarkerMode() && !pressedQuickActionWidget(point.x, point.y)) {

View file

@ -1275,6 +1275,7 @@ public class MapInfoWidgetsFactory {
public boolean updateInfo() { public boolean updateInfo() {
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls() boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls()
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive() && map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible; && !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible;
updateVisibility(visible); updateVisibility(visible);

View file

@ -191,6 +191,7 @@ public class MapMarkersWidgetsFactory {
|| addressTopBar.getVisibility() == View.VISIBLE || addressTopBar.getVisibility() == View.VISIBLE
|| map.isTopToolbarActive() || map.isTopToolbarActive()
|| !map.getContextMenu().shouldShowTopControls() || !map.getContextMenu().shouldShowTopControls()
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) { || map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
updateVisibility(false); updateVisibility(false);
return; return;