Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-02 18:20:48 +02:00
commit f3e3755eb5
27 changed files with 1081 additions and 614 deletions

View file

@ -143,7 +143,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@null" android:background="@null"
tools:src="@drawable/ic_sort_waypoint_dark"/> tools:src="@drawable/ic_action_list_sort"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -530,7 +530,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@ -539,6 +538,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:layout_marginTop="14dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -570,7 +570,6 @@
style="@style/Widget.AppCompat.ActionButton" style="@style/Widget.AppCompat.ActionButton"
android:layout_width="44dp" android:layout_width="44dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="-14dp"
android:contentDescription="@string/shared_string_cancel" android:contentDescription="@string/shared_string_cancel"
android:src="@drawable/ic_action_refresh_dark" android:src="@drawable/ic_action_refresh_dark"
android:tint="@color/map_widget_blue" android:tint="@color/map_widget_blue"
@ -648,7 +647,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@ -657,6 +655,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:layout_marginTop="14dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -688,7 +687,6 @@
style="@style/Widget.AppCompat.ActionButton" style="@style/Widget.AppCompat.ActionButton"
android:layout_width="44dp" android:layout_width="44dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="-14dp"
android:contentDescription="@string/shared_string_cancel" android:contentDescription="@string/shared_string_cancel"
android:src="@drawable/ic_action_refresh_dark" android:src="@drawable/ic_action_refresh_dark"
android:tint="@color/map_widget_blue" android:tint="@color/map_widget_blue"

View file

@ -165,7 +165,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:text="@string/build_route" android:text="@string/plan_route"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout> </LinearLayout>
@ -194,7 +194,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:text="@string/shared_string_save_as_gpx" android:text="@string/marker_save_as_track"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout> </LinearLayout>

View file

@ -17,7 +17,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"> android:paddingBottom="@dimen/dialog_content_margin">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/save_as_track_title" android:id="@+id/save_as_track_title"

View file

@ -161,7 +161,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@null" android:background="@null"
tools:src="@drawable/ic_sort_waypoint_dark"/> tools:src="@drawable/ic_action_list_sort"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<ScrollView
android:id="@+id/sort_by_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding"
android:text="@string/sort_by"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/door_to_door_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding">
<ImageView
android:id="@+id/door_to_door_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_door_to_door"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/intermediate_items_sort_by_distance"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/reverse_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding">
<ImageView
android:id="@+id/reverse_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_reverse_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_reverse_order"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/cancel_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_cancel"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,17 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:orientation="vertical"
android:background="?attr/bg_color"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<net.osmand.plus.widgets.TextViewEx <FrameLayout
android:id="@+id/show_hide_history_title"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp">
<net.osmand.plus.widgets.TextViewEx
android:background="?attr/bg_color"
android:id="@+id/show_hide_history_title"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="56dp" android:paddingLeft="56dp"
android:paddingStart="56dp" android:paddingStart="56dp"
@ -22,4 +26,12 @@
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textColor="@color/dashboard_blue"/> android:textColor="@color/dashboard_blue"/>
</FrameLayout>
<include
android:id="@+id/bottom_shadow"
layout="@layout/card_bottom_divider"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout> </LinearLayout>

View file

@ -4,6 +4,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/name_text_box"
android:paddingEnd="@dimen/bottom_sheet_content_padding" android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding" android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding" android:paddingRight="@dimen/bottom_sheet_content_padding"

View file

@ -4,7 +4,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes <net.osmand.plus.OsmandTextFieldBoxes
android:id="@+id/name_text_box"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingEnd="@dimen/bottom_sheet_content_padding" android:paddingEnd="@dimen/bottom_sheet_content_padding"
@ -18,6 +19,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes> </net.osmand.plus.OsmandTextFieldBoxes>
</LinearLayout> </LinearLayout>

View file

@ -54,7 +54,6 @@
<!-- string name="widget">Widget</string if needed should be shared_string_widget --> <!-- string name="widget">Widget</string if needed should be shared_string_widget -->
<!-- string name="top_bar">Top bar</string use shared_string_topbar --> <!-- string name="top_bar">Top bar</string use shared_string_topbar -->
<string name="move_all_to_history">Move all to history</string> <string name="move_all_to_history">Move all to history</string>
<string name="build_route">Build route</string>
<string name="show_direction">Distance indication</string> <string name="show_direction">Distance indication</string>
<string name="sort_by">Sort by</string> <string name="sort_by">Sort by</string>
<string name="do_not_use_animations">Do not use animations</string> <string name="do_not_use_animations">Do not use animations</string>

View file

@ -1012,7 +1012,6 @@ public class GPXUtilities {
} }
private void removeGeneralTrackIfExists() { private void removeGeneralTrackIfExists() {
Track generalTrack = getGeneralTrack();
if (generalTrack != null) { if (generalTrack != null) {
tracks.remove(generalTrack); tracks.remove(generalTrack);
this.generalTrack = null; this.generalTrack = null;
@ -1202,6 +1201,7 @@ public class GPXUtilities {
"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"); "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
for (Track track : file.tracks) { for (Track track : file.tracks) {
if (!track.generalTrack) {
serializer.startTag(null, "trk"); //$NON-NLS-1$ serializer.startTag(null, "trk"); //$NON-NLS-1$
writeNotNullText(serializer, "name", track.name); writeNotNullText(serializer, "name", track.name);
writeNotNullText(serializer, "desc", track.desc); writeNotNullText(serializer, "desc", track.desc);
@ -1217,6 +1217,7 @@ public class GPXUtilities {
writeExtensions(serializer, track); writeExtensions(serializer, track);
serializer.endTag(null, "trk"); //$NON-NLS-1$ serializer.endTag(null, "trk"); //$NON-NLS-1$
} }
}
for (Route track : file.routes) { for (Route track : file.routes) {
serializer.startTag(null, "rte"); //$NON-NLS-1$ serializer.startTag(null, "rte"); //$NON-NLS-1$

View file

@ -255,7 +255,7 @@ public class MapMarkersHelper {
List<MapMarker> activeMarkers = markersDbHelper.getActiveMarkers(); List<MapMarker> activeMarkers = markersDbHelper.getActiveMarkers();
mapMarkers.addAll(activeMarkers); mapMarkers.addAll(activeMarkers);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
List<MapMarker> markersHistory = markersDbHelper.getMarkersHistory(); List<MapMarker> markersHistory = markersDbHelper.getMarkersHistory();
sortMarkers(markersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(markersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
@ -266,7 +266,7 @@ public class MapMarkersHelper {
} }
} }
public void checkAndFixActiveMarkersOrderIfNeeded() { public void reorderActiveMarkersIfNeeded() {
if (!mapMarkers.isEmpty()) { if (!mapMarkers.isEmpty()) {
if (mapMarkers.size() > 1) { if (mapMarkers.size() > 1) {
for (int i = 0; i < mapMarkers.size() - 1; i++) { for (int i = 0; i < mapMarkers.size() - 1; i++) {
@ -322,7 +322,7 @@ public class MapMarkersHelper {
public void orderMarkers(OsmandSettings.MapMarkersOrderByMode orderByMode) { public void orderMarkers(OsmandSettings.MapMarkersOrderByMode orderByMode) {
sortMarkers(getMapMarkers(), false, orderByMode); sortMarkers(getMapMarkers(), false, orderByMode);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
} }
private void lookupAddress(final MapMarker mapMarker) { private void lookupAddress(final MapMarker mapMarker) {
@ -445,7 +445,7 @@ public class MapMarkersHelper {
} }
} }
if (needRefresh) { if (needRefresh) {
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
refresh(); refresh();
} }
} }
@ -459,7 +459,7 @@ public class MapMarkersHelper {
marker.history = true; marker.history = true;
marker.nextKey = MapMarkersDbHelper.HISTORY_NEXT_VALUE; marker.nextKey = MapMarkersDbHelper.HISTORY_NEXT_VALUE;
mapMarkersHistory.add(marker); mapMarkersHistory.add(marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
refresh(); refresh();
} }
@ -473,7 +473,7 @@ public class MapMarkersHelper {
sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
} else { } else {
mapMarkers.add(marker); mapMarkers.add(marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
} }
addMarkerToGroup(marker); addMarkerToGroup(marker);
refresh(); refresh();
@ -488,7 +488,7 @@ public class MapMarkersHelper {
sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
} else { } else {
mapMarkers.add(position, marker); mapMarkers.add(position, marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
} }
addMarkerToGroup(marker); addMarkerToGroup(marker);
refresh(); refresh();
@ -501,7 +501,7 @@ public class MapMarkersHelper {
mapMarkersHistory.remove(marker); mapMarkersHistory.remove(marker);
marker.history = false; marker.history = false;
mapMarkers.add(position, marker); mapMarkers.add(position, marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
refresh(); refresh();
} }
@ -515,8 +515,9 @@ public class MapMarkersHelper {
marker.history = false; marker.history = false;
mapMarkers.add(marker); mapMarkers.add(marker);
} }
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
updateGroups();
refresh(); refresh();
} }
} }
@ -579,6 +580,36 @@ public class MapMarkersHelper {
return list; return list;
} }
public int getSelectedMarkersCount() {
int res = 0;
for (MapMarker m : this.mapMarkers) {
if (m.selected) {
res++;
}
}
return res;
}
public void addSelectedMarkersToTop(@NonNull List<MapMarker> markers) {
List<MapMarker> markersToRemove = new LinkedList<>();
for (MapMarker m : mapMarkers) {
if (m.selected) {
if (!markers.contains(m)) {
return;
}
markersToRemove.add(m);
}
}
if (markersToRemove.size() != markers.size()) {
return;
}
mapMarkers.removeAll(markersToRemove);
mapMarkers.addAll(0, markers);
reorderActiveMarkersIfNeeded();
ctx.getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
}
public List<LatLon> getActiveMarkersLatLon() { public List<LatLon> getActiveMarkersLatLon() {
List<LatLon> list = new ArrayList<>(); List<LatLon> list = new ArrayList<>();
for (MapMarker m : this.mapMarkers) { for (MapMarker m : this.mapMarkers) {
@ -608,7 +639,8 @@ public class MapMarkersHelper {
public void reverseActiveMarkersOrder() { public void reverseActiveMarkersOrder() {
cancelAddressRequests(); cancelAddressRequests();
Collections.reverse(mapMarkers); Collections.reverse(mapMarkers);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
ctx.getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
} }
public void moveAllActiveMarkersToHistory() { public void moveAllActiveMarkersToHistory() {
@ -623,6 +655,7 @@ public class MapMarkersHelper {
mapMarkersHistory.addAll(mapMarkers); mapMarkersHistory.addAll(mapMarkers);
mapMarkers.clear(); mapMarkers.clear();
sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC); sortMarkers(mapMarkersHistory, true, OsmandSettings.MapMarkersOrderByMode.DATE_ADDED_DESC);
updateGroups();
refresh(); refresh();
} }
@ -675,7 +708,7 @@ public class MapMarkersHelper {
iterator.remove(); iterator.remove();
} }
} }
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
refresh(); refresh();
} }
} }
@ -727,7 +760,7 @@ public class MapMarkersHelper {
markersDbHelper.addMarker(marker); markersDbHelper.addMarker(marker);
mapMarkers.add(0, marker); mapMarkers.add(0, marker);
addMarkerToGroup(marker); addMarkerToGroup(marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
} }
} }
} }
@ -750,7 +783,7 @@ public class MapMarkersHelper {
} }
marker.point = point; marker.point = point;
markersDbHelper.updateMarker(marker); markersDbHelper.updateMarker(marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
refresh(); refresh();
lookupAddress(marker); lookupAddress(marker);
} }
@ -761,7 +794,7 @@ public class MapMarkersHelper {
if (i != -1 && mapMarkers.size() > 1) { if (i != -1 && mapMarkers.size() > 1) {
mapMarkers.remove(i); mapMarkers.remove(i);
mapMarkers.add(0, marker); mapMarkers.add(0, marker);
checkAndFixActiveMarkersOrderIfNeeded(); reorderActiveMarkersIfNeeded();
refresh(); refresh();
} }
} }
@ -897,6 +930,12 @@ public class MapMarkersHelper {
} }
} }
public void updateGroups() {
for (MapMarkersGroup group : mapMarkersGroups) {
updateGroup(group);
}
}
public void updateGroup(MapMarkersGroup mapMarkersGroup) { public void updateGroup(MapMarkersGroup mapMarkersGroup) {
if (mapMarkersGroup.getMarkers().size() == 0) { if (mapMarkersGroup.getMarkers().size() == 0) {
mapMarkersGroups.remove(mapMarkersGroup); mapMarkersGroups.remove(mapMarkersGroup);
@ -957,7 +996,7 @@ public class MapMarkersHelper {
GroupHeader header = new GroupHeader(); GroupHeader header = new GroupHeader();
int type = group.getType(); int type = group.getType();
if (type != -1) { if (type != -1) {
header.setIconRes(type == MapMarkersHelper.MarkersSyncGroup.FAVORITES_TYPE ? R.drawable.ic_action_fav_dark : R.drawable.ic_action_track_16); header.setIconRes(type == MapMarkersHelper.MarkersSyncGroup.FAVORITES_TYPE ? R.drawable.ic_action_fav_dark : R.drawable.ic_action_polygom_dark);
} }
header.setGroup(group); header.setGroup(group);
group.setGroupHeader(header); group.setGroupHeader(header);

View file

@ -20,6 +20,8 @@ import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData; import net.osmand.plus.dashboard.tools.DashFragmentData;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**
@ -80,6 +82,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
return; return;
} else { } else {
mainView.setVisibility(View.VISIBLE); mainView.setVisibility(View.VISIBLE);
sortItemsDescending(notes);
} }
LinearLayout notesLayout = (LinearLayout) mainView.findViewById(R.id.items); LinearLayout notesLayout = (LinearLayout) mainView.findViewById(R.id.items);
@ -115,6 +118,23 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
} }
} }
private void sortItemsDescending(List<AudioVideoNotesPlugin.Recording> items) {
Collections.sort(items, new Comparator<AudioVideoNotesPlugin.Recording>() {
@Override
public int compare(AudioVideoNotesPlugin.Recording first, AudioVideoNotesPlugin.Recording second) {
long firstTime = first.getLastModified();
long secondTime = second.getLastModified();
if (firstTime < secondTime) {
return 1;
} else if (firstTime == secondTime) {
return 0;
} else {
return -1;
}
}
});
}
public static Drawable getNoteView(final AudioVideoNotesPlugin.Recording recording, View view, public static Drawable getNoteView(final AudioVideoNotesPlugin.Recording recording, View view,
final OsmandApplication ctx) { final OsmandApplication ctx) {
String name = recording.getName(ctx, true); String name = recording.getName(ctx, true);

View file

@ -368,6 +368,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
fragmentRef.get().centerMarkerLocation(); fragmentRef.get().centerMarkerLocation();
} }
} }
updateWidgetsVisibility(false);
} }
public void show(@NonNull LatLon latLon, public void show(@NonNull LatLon latLon,
@ -388,6 +389,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
} }
centerMarker = false; centerMarker = false;
autoHide = false; autoHide = false;
updateWidgetsVisibility(false);
} }
public void update(LatLon latLon, PointDescription pointDescription, Object object) { public void update(LatLon latLon, PointDescription pointDescription, Object object) {
@ -446,6 +448,15 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (fragmentRef != null) { if (fragmentRef != null) {
fragmentRef.get().dismissMenu(); fragmentRef.get().dismissMenu();
} }
updateWidgetsVisibility(true);
}
private void updateWidgetsVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
mapActivity.findViewById(R.id.map_center_info).setVisibility(visibility);
mapActivity.findViewById(R.id.map_left_widgets_panel).setVisibility(visibility);
mapActivity.findViewById(R.id.map_right_widgets_panel).setVisibility(visibility);
mapActivity.refreshMap();
} }
// timeout in msec // timeout in msec
@ -713,7 +724,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
} }
public void buttonFavoritePressed() { public void buttonFavoritePressed() {
if (object != null && object instanceof FavouritePoint) { if (object != null && object instanceof FavouritePoint) {
getFavoritePointEditor().edit((FavouritePoint) object); getFavoritePointEditor().edit((FavouritePoint) object);

View file

@ -76,7 +76,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
toPosition = holder.getAdapterPosition(); toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) {
hideSnackbar(); hideSnackbar();
mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
} }

View file

@ -141,6 +141,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
case R.id.action_active: case R.id.action_active:
activeFragment.startLocationUpdate(); activeFragment.startLocationUpdate();
if (viewPager.getCurrentItem() != 0) { if (viewPager.getCurrentItem() != 0) {
hideSnackbar();
activeFragment.updateAdapter(); activeFragment.updateAdapter();
historyFragment.hideSnackbar(); historyFragment.hideSnackbar();
groupsFragment.hideSnackbar(); groupsFragment.hideSnackbar();
@ -151,6 +152,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
case R.id.action_groups: case R.id.action_groups:
activeFragment.stopLocationUpdate(); activeFragment.stopLocationUpdate();
if (viewPager.getCurrentItem() != 1) { if (viewPager.getCurrentItem() != 1) {
hideSnackbar();
groupsFragment.updateAdapter(); groupsFragment.updateAdapter();
activeFragment.hideSnackbar(); activeFragment.hideSnackbar();
historyFragment.hideSnackbar(); historyFragment.hideSnackbar();
@ -161,6 +163,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
case R.id.action_history: case R.id.action_history:
activeFragment.stopLocationUpdate(); activeFragment.stopLocationUpdate();
if (viewPager.getCurrentItem() != 2) { if (viewPager.getCurrentItem() != 2) {
hideSnackbar();
historyFragment.updateAdapter(); historyFragment.updateAdapter();
groupsFragment.hideSnackbar(); groupsFragment.hideSnackbar();
activeFragment.hideSnackbar(); activeFragment.hideSnackbar();
@ -296,6 +299,12 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
} }
} }
private void hideSnackbar() {
if (snackbar != null && snackbar.isShown()) {
snackbar.dismiss();
}
}
private MapActivity getMapActivity() { private MapActivity getMapActivity() {
return (MapActivity) getActivity(); return (MapActivity) getActivity();
} }

View file

@ -1,6 +1,8 @@
package net.osmand.plus.mapmarkers; package net.osmand.plus.mapmarkers;
import android.app.ProgressDialog;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
@ -23,6 +25,7 @@ import android.widget.Toast;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.TspAnt;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
@ -31,11 +34,13 @@ 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.OsmandSettings; import net.osmand.plus.OsmandSettings;
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.base.MapViewTrackingUtilities; import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.PlanRouteSortByBottomSheetDialogFragment.PlanRouteSortByFragmentListener;
import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback; import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback;
import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter; import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter;
import net.osmand.plus.measurementtool.RecyclerViewFragment; import net.osmand.plus.measurementtool.RecyclerViewFragment;
@ -47,6 +52,7 @@ import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT; import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
@ -92,6 +98,10 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
if (snapToRoadFragment != null) { if (snapToRoadFragment != null) {
((SnapToRoadBottomSheetDialogFragment) snapToRoadFragment).setListener(createSnapToRoadFragmentListener()); ((SnapToRoadBottomSheetDialogFragment) snapToRoadFragment).setListener(createSnapToRoadFragmentListener());
} }
Fragment sortByFragment = fragmentManager.findFragmentByTag(PlanRouteSortByBottomSheetDialogFragment.TAG);
if (sortByFragment != null) {
((PlanRouteSortByBottomSheetDialogFragment) sortByFragment).setListener(createSortByFragmentListener());
}
// If rotate the screen from landscape to portrait when the list of markers is displayed then // If rotate the screen from landscape to portrait when the list of markers is displayed then
// the RecyclerViewFragment will exist without view. This is necessary to remove it. // the RecyclerViewFragment will exist without view. This is necessary to remove it.
if (!portrait) { if (!portrait) {
@ -125,7 +135,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
upDownIconIv = (ImageView) mainView.findViewById(R.id.up_down_icon); upDownIconIv = (ImageView) mainView.findViewById(R.id.up_down_icon);
upDownIconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up)); upDownIconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up));
((ImageView) mainView.findViewById(R.id.sort_icon)).setImageDrawable(getContentIcon(R.drawable.ic_sort_waypoint_dark)); ((ImageView) mainView.findViewById(R.id.sort_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_list_sort));
mainView.findViewById(R.id.up_down_row).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.up_down_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -162,7 +172,9 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
mainView.findViewById(R.id.sort_button).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.sort_button).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Toast.makeText(mapActivity, "Sort", Toast.LENGTH_SHORT).show(); PlanRouteSortByBottomSheetDialogFragment fragment = new PlanRouteSortByBottomSheetDialogFragment();
fragment.setListener(createSortByFragmentListener());
fragment.show(mapActivity.getSupportFragmentManager(), PlanRouteSortByBottomSheetDialogFragment.TAG);
} }
}); });
@ -203,6 +215,9 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override @Override
public void onItemClick(View view) { public void onItemClick(View view) {
int pos = markersRv.getChildAdapterPosition(view); int pos = markersRv.getChildAdapterPosition(view);
if (pos == RecyclerView.NO_POSITION) {
return;
}
if (pos == 0) { if (pos == 0) {
markersHelper.setStartFromMyLocation(!mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get()); markersHelper.setStartFromMyLocation(!mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get());
} else { } else {
@ -227,7 +242,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
public void onDragEnded(RecyclerView.ViewHolder holder) { public void onDragEnded(RecyclerView.ViewHolder holder) {
toPosition = holder.getAdapterPosition(); toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) {
mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded();
mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
mapActivity.refreshMap(); mapActivity.refreshMap();
try { try {
@ -345,6 +360,33 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}; };
} }
private PlanRouteSortByFragmentListener createSortByFragmentListener() {
return new PlanRouteSortByFragmentListener() {
private MapActivity mapActivity = getMapActivity();
@Override
public void doorToDoorOnClick() {
if (mapActivity != null) {
OsmandApplication app = mapActivity.getMyApplication();
Location myLoc = app.getLocationProvider().getLastStaleKnownLocation();
boolean startFromLocation = app.getMapMarkersHelper().isStartFromMyLocation() && myLoc != null;
if (selectedCount > (startFromLocation ? 0 : 1)) {
sortSelectedMarkersDoorToDoor(mapActivity, startFromLocation, myLoc);
}
}
}
@Override
public void reverseOrderOnClick() {
if (mapActivity != null) {
markersHelper.reverseActiveMarkersOrder();
adapter.notifyDataSetChanged();
}
}
};
}
private void enterPlanRouteMode() { private void enterPlanRouteMode() {
final MapActivity mapActivity = getMapActivity(); final MapActivity mapActivity = getMapActivity();
MapMarkersLayer markersLayer = getMapMarkersLayer(); MapMarkersLayer markersLayer = getMapMarkersLayer();
@ -377,6 +419,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
} }
setupAppModesBtn(); setupAppModesBtn();
selectedCount = mapActivity.getMyApplication().getMapMarkersHelper().getSelectedMarkersCount();
showMarkersRouteOnMap(); showMarkersRouteOnMap();
mapActivity.refreshMap(); mapActivity.refreshMap();
updateText(); updateText();
@ -672,6 +715,68 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
} }
} }
private void sortSelectedMarkersDoorToDoor(final MapActivity mapActivity, final boolean startFromLoc, final Location myLoc) {
new AsyncTask<Void, Void, List<MapMarker>>() {
private ProgressDialog dialog;
private long startDialogTime;
@Override
protected void onPreExecute() {
startDialogTime = System.currentTimeMillis();
dialog = new ProgressDialog(mapActivity);
dialog.setTitle("");
dialog.setMessage(mapActivity.getString(R.string.intermediate_items_sort_by_distance));
dialog.setCancelable(false);
dialog.show();
}
@Override
protected List<MapMarker> doInBackground(Void... voids) {
MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
List<MapMarker> selectedMarkers = markersHelper.getSelectedMarkers();
List<LatLon> selectedLatLon = markersHelper.getSelectedMarkersLatLon();
LatLon start = startFromLoc ? new LatLon(myLoc.getLatitude(), myLoc.getLongitude()) : selectedLatLon.remove(0);
LatLon end = selectedLatLon.remove(selectedLatLon.size() - 1);
int[] sequence = new TspAnt().readGraph(selectedLatLon, start, end).solve();
List<MapMarker> res = new ArrayList<>();
for (int i = 0; i < sequence.length; i++) {
if (i == 0 && startFromLoc) {
continue;
}
int index = sequence[startFromLoc ? i - 1 : i];
res.add(selectedMarkers.get(index));
}
return res;
}
@Override
protected void onPostExecute(List<MapMarker> res) {
if (dialog != null) {
long t = System.currentTimeMillis();
if (t - startDialogTime < 500) {
mapActivity.getMyApplication().runInUIThread(new Runnable() {
@Override
public void run() {
dialog.dismiss();
}
}, 500 - (t - startDialogTime));
} else {
dialog.dismiss();
}
}
mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res);
adapter.notifyDataSetChanged();
}
}.execute();
}
private class PlanRouteToolbarController extends TopToolbarController { private class PlanRouteToolbarController extends TopToolbarController {
PlanRouteToolbarController() { PlanRouteToolbarController() {

View file

@ -0,0 +1,142 @@
package net.osmand.plus.mapmarkers;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
public class PlanRouteSortByBottomSheetDialogFragment extends BottomSheetDialogFragment {
public final static String TAG = "PlanRouteSortByBottomSheetDialogFragment";
private boolean portrait;
private boolean night;
private PlanRouteSortByFragmentListener listener;
public void setListener(PlanRouteSortByFragmentListener listener) {
this.listener = listener;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_plan_route_sort_by_bottom_sheet_dialog, container);
if (portrait) {
AndroidUtils.setBackground(getActivity(), mainView, night, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
}
if (night) {
((TextView) mainView.findViewById(R.id.title)).setTextColor(ContextCompat.getColor(getActivity(), R.color.ctx_menu_info_text_dark));
}
((ImageView) mainView.findViewById(R.id.door_to_door_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_door_to_door));
((ImageView) mainView.findViewById(R.id.reverse_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_reverse_order));
mainView.findViewById(R.id.door_to_door_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.doorToDoorOnClick();
dismiss();
}
}
});
mainView.findViewById(R.id.reverse_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.reverseOrderOnClick();
dismiss();
}
}
});
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
final int screenHeight = AndroidUtils.getScreenHeight(getActivity());
final int statusBarHeight = AndroidUtils.getStatusBarHeight(getActivity());
final int navBarHeight = AndroidUtils.getNavBarHeight(getActivity());
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
final View scrollView = mainView.findViewById(R.id.sort_by_scroll_view);
int scrollViewHeight = scrollView.getHeight();
int dividerHeight = AndroidUtils.dpToPx(getContext(), 1);
int cancelButtonHeight = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
int spaceForScrollView = screenHeight - statusBarHeight - navBarHeight - dividerHeight - cancelButtonHeight;
if (scrollViewHeight > spaceForScrollView) {
scrollView.getLayoutParams().height = spaceForScrollView;
scrollView.requestLayout();
}
if (!portrait) {
if (screenHeight - statusBarHeight - mainView.getHeight() >= AndroidUtils.dpToPx(getActivity(), 8)) {
AndroidUtils.setBackground(getActivity(), mainView, false,
R.drawable.bg_bottom_sheet_topsides_landscape_light, R.drawable.bg_bottom_sheet_topsides_landscape_dark);
} else {
AndroidUtils.setBackground(getActivity(), mainView, false,
R.drawable.bg_bottom_sheet_sides_landscape_light, R.drawable.bg_bottom_sheet_sides_landscape_dark);
}
}
ViewTreeObserver obs = mainView.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
return mainView;
}
@Override
public void onStart() {
super.onStart();
if (!portrait) {
final Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
window.setAttributes(params);
}
}
@Override
protected Drawable getContentIcon(@DrawableRes int id) {
return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
}
interface PlanRouteSortByFragmentListener {
void doorToDoorOnClick();
void reverseOrderOnClick();
}
}

View file

@ -18,6 +18,7 @@ import android.widget.LinearLayout;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.plus.OsmandTextFieldBoxes;
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.base.BottomSheetDialogFragment; import net.osmand.plus.base.BottomSheetDialogFragment;
@ -79,7 +80,10 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
} }
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
nameEditText.setText(displayedName); nameEditText.setText(displayedName);
nameEditText.requestFocus(); View textBox = mainView.findViewById(R.id.name_text_box);
if (textBox instanceof OsmandTextFieldBoxes) {
((OsmandTextFieldBoxes) textBox).activate(true);
}
mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -394,6 +394,11 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final MapMarkersShowHideHistoryViewHolder showHideHistoryViewHolder = (MapMarkersShowHideHistoryViewHolder) holder; final MapMarkersShowHideHistoryViewHolder showHideHistoryViewHolder = (MapMarkersShowHideHistoryViewHolder) holder;
final ShowHideHistoryButton showHideHistoryButton = (ShowHideHistoryButton) getItem(position); final ShowHideHistoryButton showHideHistoryButton = (ShowHideHistoryButton) getItem(position);
final boolean showHistory = showHideHistoryButton.isShowHistory(); final boolean showHistory = showHideHistoryButton.isShowHistory();
if (position == getItemCount() - 1) {
showHideHistoryViewHolder.bottomShadow.setVisibility(View.VISIBLE);
} else {
showHideHistoryViewHolder.bottomShadow.setVisibility(View.GONE);
}
showHideHistoryViewHolder.title.setText(app.getString(showHistory ? R.string.hide_passed : R.string.show_passed)); showHideHistoryViewHolder.title.setText(app.getString(showHistory ? R.string.hide_passed : R.string.show_passed));
showHideHistoryViewHolder.itemView.setOnClickListener(new View.OnClickListener() { showHideHistoryViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -7,10 +7,13 @@ import android.widget.TextView;
import net.osmand.plus.R; import net.osmand.plus.R;
public class MapMarkersShowHideHistoryViewHolder extends RecyclerView.ViewHolder { public class MapMarkersShowHideHistoryViewHolder extends RecyclerView.ViewHolder {
final TextView title; final TextView title;
final View bottomShadow;
public MapMarkersShowHideHistoryViewHolder(View itemView) { public MapMarkersShowHideHistoryViewHolder(View itemView) {
super(itemView); super(itemView);
title = (TextView) itemView.findViewById(R.id.show_hide_history_title); title = (TextView) itemView.findViewById(R.id.show_hide_history_title);
bottomShadow = itemView.findViewById(R.id.bottom_shadow);
} }
} }

View file

@ -708,11 +708,12 @@ 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 trackDialogOpened = TrackDetailsMenu.isVisible();
boolean contextMenuOpened = mapActivity.getContextMenu().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 || trackDialogOpened); updateMyLocation(rh, routeDialogOpened || trackDialogOpened || contextMenuOpened);
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode) boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode(); && !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened;
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions); //routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
if (rh.isFollowingMode()) { if (rh.isFollowingMode()) {
routePlanningBtn.setIconResId(R.drawable.map_start_navigation); routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
@ -727,16 +728,16 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningBtn.updateVisibility(showButtons); routePlanningBtn.updateVisibility(showButtons);
menuControl.updateVisibility(showButtons); menuControl.updateVisibility(showButtons);
mapZoomIn.updateVisibility(!routeDialogOpened); mapZoomIn.updateVisibility(!routeDialogOpened && !contextMenuOpened);
mapZoomOut.updateVisibility(!routeDialogOpened); mapZoomOut.updateVisibility(!routeDialogOpened && !contextMenuOpened);
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass() compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
&& !isInMeasurementToolMode() && !isInPlanRouteMode()); && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) { if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
layersHud.update(app, isNight); layersHud.update(app, isNight);
} }
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()); layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()); quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
if (!routePlanningMode && !routeFollowingMode) { if (!routePlanningMode && !routeFollowingMode) {
if (mapView.isZooming()) { if (mapView.isZooming()) {

View file

@ -210,7 +210,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override @Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) { public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
OsmandSettings settings = map.getMyApplication().getSettings();
Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers(); List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
@ -237,7 +236,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
if (settings.SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { if (markersHelper.isStartFromMyLocation() && myLoc != null) {
lineAttrs.updatePaints(view, nightMode, tileBox); lineAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.paint.setStyle(Paint.Style.FILL); textAttrs.paint.setStyle(Paint.Style.FILL);

View file

@ -577,7 +577,7 @@ public class MapInfoWidgetsFactory {
initToolbar(defaultController); initToolbar(defaultController);
defaultController.updateToolbar(this); defaultController.updateToolbar(this);
} }
updateVisibility(controller != null); updateVisibility(controller != null && (!map.getContextMenu().isVisible() || controller.getType() == TopToolbarControllerType.CONTEXT_MENU));
} }
public void updateColors(TopToolbarController controller) { public void updateColors(TopToolbarController controller) {
@ -801,7 +801,7 @@ public class MapInfoWidgetsFactory {
} }
} }
} }
if (map.isTopToolbarActive()) { if (map.isTopToolbarActive() || map.getContextMenu().isVisible()) {
updateVisibility(false); updateVisibility(false);
} else if (!showNextTurn && updateWaypoint()) { } else if (!showNextTurn && updateWaypoint()) {
updateVisibility(true); updateVisibility(true);

View file

@ -197,7 +197,8 @@ public class MapMarkersWidgetsFactory {
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode() || map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|| MapRouteInfoMenu.isVisible() || MapRouteInfoMenu.isVisible()
|| addressTopBar.getVisibility() == View.VISIBLE || addressTopBar.getVisibility() == View.VISIBLE
|| map.isTopToolbarActive()) { || map.isTopToolbarActive()
|| map.getContextMenu().isVisible()) {
updateVisibility(false); updateVisibility(false);
return; return;
} }