Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2016-02-19 17:52:20 +02:00
commit b37a6e47bc
11 changed files with 129 additions and 40 deletions

View file

@ -444,7 +444,7 @@
<string name="routing_settings">Navigation</string>
<string name="download_files_not_enough_space">Der er ikke ledig plads nok til at hente %1$s MB (Ledig: %2$s).</string>
<string name="download_files_question_space">Ledig plads: {2} MB! Hent {0} filer ({1} MB)?</string>
<string name="download_files_question_space">Virkelig hente {0} fil(er)? Dette krævet {1} MB permanent? I øjeblikket, er der {2} MB til rådighed.</string>
<string name="use_transparent_map_theme">Gennemsigtigt tema</string>
<string name="native_library_not_supported">Indbygget bibliotek er ikke understøttet på enheden.</string>
@ -2289,4 +2289,6 @@
<string name="map_marker_2nd">Anden kortmarkør</string>
<string name="shared_string_toolbar">Værktøjslinie</string>
<string name="shared_string_widgets">Moduler</string>
<string name="download_files_error_not_enough_space">Ikke nok plads! Dette skulle {3} MB midlertidigt og {1} MB permanent. I øjeblikket, er der kun {2} MB tilgængelig.</string>
<string name="download_files_question_space_with_temp">Virkelig hente {0} fil(er)? Dette kræver {3} MB midlertidigt og {1} MB permanent? I øjeblikket, er der {2} MB til rådighed.</string>
</resources>

View file

@ -304,7 +304,7 @@
<string name="osmand_service_descr">OsmAnd läuft bei ausgeschalteter Anzeige im Hintergrund</string>
<string name="download_files_not_enough_space">Nicht genügend freier Speicher vorhanden zum Laden von %1$s MB (frei: %2$s).</string>
<string name="download_files_question_space">{2} MB freier Speicher vorhanden! {0} Datei(en) ({1} MB) herunterladen?</string>
<string name="download_files_question_space">Wirklich {0} Datei(en) herunterladen? Dies benötigt dauerhaft {1} MB. Aktuell sind {2} MB freier Speicher vorhanden.</string>
<string name="use_transparent_map_theme">Transparentes Layout</string>
<string name="native_library_not_supported">Native Bibliothek wird auf diesem Gerät nicht unterstützt.</string>
<string name="init_native_library">Native Bibliothek wird initialisiert…</string>
@ -2034,4 +2034,6 @@
<string name="consider_turning_polygons_off">Es wird empfohlen das Rendern von Polygonen zu deaktivieren.</string>
<string name="show_map_markers_topbar">Leiste mit den Kartenmarkierungen anzeigen</string>
<string name="shared_string_widgets">Widgets</string>
<string name="download_files_error_not_enough_space">Nicht genug Speicher! Es werden temporär {3} MB benötigt und {1} MB permanent. Aktuell sind nur {2} MB verfügbar.</string>
<string name="download_files_question_space_with_temp">Wirklich {0} Datei(en) herunterladen? Dies benötigt temporär {3} MB und permanent {1} MB? Aktuell sind {2} MB verfügbar.</string>
</resources>

View file

@ -1209,7 +1209,7 @@
<string name="osmand_service">Modo reposo</string>
<string name="osmand_service_descr">Ejecutar OsmAnd en segundo plano, mientras la pantalla este apagada</string>
<string name="download_files_not_enough_space">Sin espacio suficiente para descargar %1$s MB (disponible: %2$s).</string>
<string name="download_files_question_space">El espacio disponible ahora es {2} MB. ¿Descargar {0} archivo(s) ({1} MB)?</string>
<string name="download_files_question_space">¿Descargar realmente {0} archivo(s)? Se necesitará {1} MB constantemente. Actualmente, hay disponible {2} MB.</string>
<string name="use_transparent_map_theme">Tema transparente</string>
<string name="native_library_not_supported">La biblioteca nativa no está soportada en este dispositivo.</string>
<string name="init_native_library">Inicializando biblioteca nativa…</string>
@ -2100,4 +2100,6 @@
<string name="shared_string_toolbar">Barra de herramientas</string>
<string name="shared_string_widgets">Controles</string>
<string name="show_map_markers_topbar">Mostrar barra superior de Marcadores del mapa</string>
<string name="download_files_error_not_enough_space">¡Sin espacio suficiente! Se necesita {3} MB temporalmente y {1} MB constantemente. Actualmente, hay disponible sólo {2} MB.</string>
<string name="download_files_question_space_with_temp">¿Descargar realmente {0} archivo(s)? Se necesitará {3} MB temporalmente y {1} MB constantemente. Actualmente, hay disponible {2} MB.</string>
</resources>

View file

@ -1209,7 +1209,7 @@
<string name="osmand_service">Modo reposo</string>
<string name="osmand_service_descr">Ejecutar OsmAnd en segundo plano, mientras la pantalla este apagada</string>
<string name="download_files_not_enough_space">Sin espacio suficiente para descargar %1$s MB (disponible: %2$s).</string>
<string name="download_files_question_space">El espacio disponible ahora es {2} MB. ¿Descargar {0} archivo(s) ({1} MB)?</string>
<string name="download_files_question_space">¿Descargar realmente {0} archivo(s)? Se necesitará {1} MB constantemente. Actualmente, hay disponible {2} MB.</string>
<string name="use_transparent_map_theme">Tema transparente</string>
<string name="native_library_not_supported">La biblioteca nativa no está soportada en este dispositivo.</string>
<string name="init_native_library">Inicializando biblioteca nativa…</string>
@ -2100,4 +2100,6 @@
<string name="add_points_to_map_markers_q">¿Desea añadir todos los puntos a Marcadores de mapa?</string>
<string name="shared_string_add_to_map_markers">Añadir a Marcadores de mapa</string>
<string name="consider_turning_polygons_off">Se recomienda desactivar la representación de polígonos.</string>
<string name="download_files_error_not_enough_space">¡Sin espacio suficiente! Se necesitan {3} MB temporalmente y {1} MB constantemente. Actualmente, hay disponible sólo {2} MB.</string>
<string name="download_files_question_space_with_temp">¿Descargar realmente {0} archivo(s)? Se necesitará {3} MB temporalmente y {1} MB constantemente. Actualmente, hay disponible {2} MB.</string>
</resources>

View file

@ -72,7 +72,7 @@
<string name="osmand_service_descr">OsmAnd se ejecuta en segundo plano mientras la pantalla está apagada</string>
<string name="switch_to_raster_map_to_see">No hay ningún mapa vectorial presente descargado para esta ubicación. Puede descargar uno en Ajustes (Gestionar mapas), o cambiar al mapa en línea (para esto active el complemento mapas en línea).</string>
<string name="download_files_not_enough_space">No hay suficiente espacio para descargar %1$s MB (disponible: %2$s).</string>
<string name="download_files_question_space">El espacio disponible ahora es {2} MB. ¿Descargar {0} archivo(s) ({1} MB)?</string>
<string name="download_files_question_space">¿Realmente quieres descargar {0} archivos? Esto necesita {1} MB permanentemente. Actualmente, hay {2} MB disponibles.</string>
<string name="use_transparent_map_theme">Tema transparente</string>
<string name="native_library_not_supported">La biblioteca nativa no está soportada en este dispositivo.</string>
<string name="init_native_library">Inicializando biblioteca nativa…</string>
@ -2082,4 +2082,6 @@
<string name="map_marker_2nd">Segundo marcador de mapa</string>
<string name="shared_string_toolbar">Barra de herramientas</string>
<string name="shared_string_widgets">Controles</string>
<string name="download_files_error_not_enough_space">No hay suficiente espacio! Necesitaría {3} MB temporalmente y {1} MB permanentemente. Actualmente, hay solo {2} MB disponibles.</string>
<string name="download_files_question_space_with_temp">¿Realmente quieres descargar {0} archivos? Esto necesita {3} MB temporalmente y {1} MB permanentemente. Actualmente, hay {2} MB disponibles.</string>
</resources>

View file

@ -2114,4 +2114,5 @@
<string name="add_points_to_map_markers_q">Boles annanghere totu sos puntos a sos Marcadores Mapa?</string>
<string name="shared_string_add_to_map_markers">Annanghe a sos Marcadores Mapa</string>
<string name="consider_turning_polygons_off">Ti cussigiamus de istudare sa renderizatzione de sos polìgonos.</string>
<string name="shared_string_toolbar">Barra ainas</string>
</resources>

View file

@ -337,7 +337,7 @@
<string name="download_files_not_enough_space">Det finns inte tillräckligt med ledigt utrymme för att ladda ner %1$s MB (ledigt: %2$s).</string>
<string name="download_files_question_space">Tillgängligt utrymme nu {2} MB! Ladda ner {0} fil(er) ({1} MB)?</string>
<string name="download_files_question_space">Verkligen ladda ner {0} fil(er)? Detta kräver {1} MB permanent. För tillfället finns det {2} MB ledigt.</string>
<string name="use_transparent_map_theme">Genomskinligt tema</string>
@ -2102,4 +2102,6 @@
<string name="shared_string_toolbar">Verktygsfält</string>
<string name="shared_string_widgets">Widgetar</string>
<string name="show_map_markers_topbar">Visa kartmarkörsfält</string>
<string name="download_files_error_not_enough_space">Inte tillräckligt med utrymme! Detta skulle kräva {3} MB temporärt och {1} MB permanent. För tillfället finns det bara {2} MB tillgängligt.</string>
<string name="download_files_question_space_with_temp">Verkligen hämta {0} fil(er)? Detta kräver {3} MB temporärt och {1} MB permanent. För tillfället finns det bara {2} MB tillgängligt.</string>
</resources>

View file

@ -1706,7 +1706,9 @@ public class OsmandSettings {
int index = ps.indexOf(new LatLon(latitude, longitude));
ds.set(index, PointDescription.serializeToString(historyDescription));
cs.set(index, colorIndex);
ns.set(index, pos);
if (ns.size() > index) {
ns.set(index, pos);
}
if (historyDescription != null && !historyDescription.isSearchingAddress(ctx)) {
SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, historyDescription);
}

View file

@ -41,7 +41,6 @@ import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.OsmandApplication;
@ -58,6 +57,7 @@ import net.osmand.plus.dialogs.RasterMapMenu;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.MapMarkerDialogHelper;
import net.osmand.plus.helpers.MapMarkerDialogHelper.MapMarkersDialogHelperCallbacks;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointDialogHelper.WaypointDialogHelperCallbacks;
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
@ -88,7 +88,8 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
/**
*/
public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicListViewCallbacks,
IRouteInformationListener, WaypointDialogHelperCallbacks, MapMarkerChangedListener {
IRouteInformationListener, WaypointDialogHelperCallbacks, MapMarkersDialogHelperCallbacks,
MapMarkerChangedListener {
private static final org.apache.commons.logging.Log LOG =
PlatformUtil.getLog(DashboardOnMap.class);
private static final String TAG = "DashboardOnMap";
@ -190,8 +191,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
public void createDashboardView() {
baseColor = mapActivity.getResources().getColor(R.color.osmand_orange) & 0x00ffffff;
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
waypointDialogHelper.setWaypointDialogHelperCallbacks(this);
waypointDialogHelper.setHelperCallbacks(this);
mapMarkerDialogHelper = new MapMarkerDialogHelper(mapActivity);
mapMarkerDialogHelper.setHelperCallbacks(this);
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
final View.OnClickListener listener = new View.OnClickListener() {
@ -220,9 +222,14 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
public boolean canDismiss(int position) {
boolean res = false;
if (listAdapter instanceof StableArrayAdapter) {
List<Object> activeObjects = ((StableArrayAdapter) listAdapter).getActiveObjects();
Object obj = listAdapter.getItem(position);
res = activeObjects.contains(obj);
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
List<Object> activeObjects = ((StableArrayAdapter) listAdapter).getActiveObjects();
Object obj = listAdapter.getItem(position);
res = activeObjects.contains(obj);
} else if (visibleType == DashboardType.MAP_MARKERS) {
Object obj = listAdapter.getItem(position);
res = obj instanceof MapMarker;
}
}
return res;
}
@ -785,10 +792,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
listAdapter);
DynamicListView dynamicListView = (DynamicListView) listView;
dynamicListView.setItemsList(listAdapter.getObjects());
dynamicListView.setActiveItemsList(listAdapter.getActiveObjects());
setDynamicListItems((DynamicListView) listView, listAdapter);
updateListAdapter(listAdapter, listener);
} else if (DashboardType.MAP_MARKERS == visibleType) {
@ -797,10 +801,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
StableArrayAdapter listAdapter = mapMarkerDialogHelper.getMapMarkersListAdapter();
OnItemClickListener listener = mapMarkerDialogHelper.getItemClickListener(listAdapter);
DynamicListView dynamicListView = (DynamicListView) listView;
dynamicListView.setItemsList(listAdapter.getObjects());
dynamicListView.setActiveItemsList(listAdapter.getActiveObjects());
setDynamicListItems((DynamicListView) listView, listAdapter);
updateListAdapter(listAdapter, listener);
} else {
@ -852,6 +853,21 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
}
}
private void setDynamicListItems(DynamicListView listView, StableArrayAdapter listAdapter) {
listView.setItemsList(listAdapter.getObjects());
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
listView.setActiveItemsList(listAdapter.getActiveObjects());
} else if (DashboardType.MAP_MARKERS == visibleType) {
List<Object> activeMarkers = new ArrayList<>();
for (Object obj : listAdapter.getActiveObjects()) {
if (obj instanceof MapMarker && !((MapMarker) obj).history) {
activeMarkers.add(obj);
}
}
listView.setActiveItemsList(activeMarkers);
}
}
private OnItemClickListener getOptionsMenuOnClickListener(final ContextMenuAdapter cm,
final ArrayAdapter<?> listAdapter) {
@ -1288,6 +1304,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
}
}
@SuppressWarnings("unchecked")
@Override
public void onItemsSwapped(final List<Object> items) {
getMyApplication().runInUIThread(new Runnable() {
@ -1316,9 +1333,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
newRouteIsCalculated(false, new ValueHolder<Boolean>());
getMyApplication().getTargetPointsHelper().updateRouteAndRefresh(true);
if (swipeDismissListener != null) {
swipeDismissListener.setEnabled(true);
}
} else if (visibleType == DashboardType.MAP_MARKERS) {
List<MapMarker> markers = (List<MapMarker>)(Object)items;
getMyApplication().getMapMarkersHelper().saveMapMarkers(markers, null);
}
if (swipeDismissListener != null) {
swipeDismissListener.setEnabled(true);
}
}
}, 50);
@ -1355,17 +1376,24 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
mapMarkerDialogHelper.reloadListAdapter(stableAdapter);
}
if (listView instanceof DynamicListView) {
DynamicListView dynamicListView = (DynamicListView) listView;
dynamicListView.setItemsList(stableAdapter.getObjects());
dynamicListView.setActiveItemsList(stableAdapter.getActiveObjects());
setDynamicListItems((DynamicListView) listView, stableAdapter);
}
}
}
private void deleteSwipeItem(int position) {
if (swipeDismissListener != null) {
swipeDismissListener.delete(position);
}
}
@Override
public void deleteWaypoint(int position) {
if (swipeDismissListener != null) {
swipeDismissListener.delete(position);
}
deleteSwipeItem(position);
}
@Override
public void deleteMapMarker(int position) {
deleteSwipeItem(position);
}
}

View file

@ -33,11 +33,11 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.views.controls.DynamicListView;
import net.osmand.plus.views.controls.ListDividerShape;
import net.osmand.plus.views.controls.StableArrayAdapter;
import net.osmand.util.Algorithms;
@ -59,6 +59,7 @@ public class MapMarkerDialogHelper {
private MapActivity mapActivity;
private OsmandApplication app;
private MapMarkersHelper markersHelper;
private MapMarkersDialogHelperCallbacks helperCallbacks;
private boolean sorted;
private boolean nightMode;
@ -69,12 +70,21 @@ public class MapMarkerDialogHelper {
private boolean reloading;
private long lastUpdateTime;
public interface MapMarkersDialogHelperCallbacks {
void reloadAdapter();
void deleteMapMarker(int position);
}
public MapMarkerDialogHelper(MapActivity mapActivity) {
this.mapActivity = mapActivity;
app = mapActivity.getMyApplication();
markersHelper = app.getMapMarkersHelper();
}
public void setHelperCallbacks(MapMarkersDialogHelperCallbacks helperCallbacks) {
this.helperCallbacks = helperCallbacks;
}
public boolean isNightMode() {
return nightMode;
}
@ -116,7 +126,7 @@ public class MapMarkerDialogHelper {
final List<Object> objects = getListObjects();
List<Object> activeObjects = getActiveObjects(objects);
final StableArrayAdapter listAdapter = new StableArrayAdapter(mapActivity,
return new StableArrayAdapter(mapActivity,
R.layout.map_marker_item, R.id.title, objects, activeObjects) {
@Override
@ -147,14 +157,12 @@ public class MapMarkerDialogHelper {
v = mapActivity.getLayoutInflater().inflate(R.layout.card_bottom_divider, null);
} else if (obj instanceof MapMarker) {
MapMarker marker = (MapMarker) obj;
v = updateMapMarkerItemView(v, marker);
v = updateMapMarkerItemView(this, v, marker);
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
}
return v;
}
};
return listAdapter;
}
private List<Drawable> getCustomDividers(List<Object> points) {
@ -229,6 +237,8 @@ public class MapMarkerDialogHelper {
markersHelper.removeMarkersHistory();
if (markersHelper.getActiveMapMarkers().size() == 0) {
mapActivity.getDashboard().hideDashboard();
} else if (helperCallbacks != null) {
helperCallbacks.reloadAdapter();
} else {
reloadListAdapter(listAdapter);
}
@ -265,6 +275,8 @@ public class MapMarkerDialogHelper {
markersHelper.removeActiveMarkers();
if (markersHelper.getMapMarkersHistory().size() == 0) {
mapActivity.getDashboard().hideDashboard();
} else if (helperCallbacks != null) {
helperCallbacks.reloadAdapter();
} else {
reloadListAdapter(listAdapter);
}
@ -282,7 +294,11 @@ public class MapMarkerDialogHelper {
@Override
public boolean onMenuItemClick(MenuItem item) {
markersHelper.reverseActiveMarkersOrder();
reloadListAdapter(listAdapter);
if (helperCallbacks != null) {
helperCallbacks.reloadAdapter();
} else {
reloadListAdapter(listAdapter);
}
return true;
}
});
@ -308,7 +324,7 @@ public class MapMarkerDialogHelper {
return v;
}
protected View updateMapMarkerItemView(View v, final MapMarker marker) {
protected View updateMapMarkerItemView(final StableArrayAdapter adapter, View v, final MapMarker marker) {
if (v == null || v.findViewById(R.id.info_close) == null) {
v = mapActivity.getLayoutInflater().inflate(R.layout.map_marker_item, null);
}
@ -317,8 +333,38 @@ public class MapMarkerDialogHelper {
final View move = v.findViewById(R.id.info_move);
final View remove = v.findViewById(R.id.info_close);
remove.setVisibility(View.GONE);
move.setVisibility(View.GONE);
more.setVisibility(View.GONE);
if (!marker.history) {
move.setVisibility(View.VISIBLE);
((ImageView) move).setImageDrawable(app.getIconsCache().getContentIcon(
R.drawable.ic_action_reorder, !nightMode));
move.setTag(new DynamicListView.DragIcon() {
@Override
public void onClick() {
final PopupMenu optionsMenu = new PopupMenu(mapActivity, move);
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
MenuItem item;
item = optionsMenu.getMenu().add(
R.string.shared_string_remove).setIcon(app.getIconsCache().
getContentIcon(R.drawable.ic_action_remove_dark));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (helperCallbacks != null) {
int pos = adapter.getPosition(marker);
if (pos != -1) {
helperCallbacks.deleteMapMarker(pos);
}
}
return true;
}
});
optionsMenu.show();
}
});
} else {
move.setVisibility(View.GONE);
}
return v;
}
@ -633,7 +679,7 @@ public class MapMarkerDialogHelper {
}
private void generateGPX(List<MapMarker> markers) {
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/map points");
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/map markers");
if (!dir.exists()) {
dir.mkdirs();
}

View file

@ -73,7 +73,7 @@ public class WaypointDialogHelper {
}
}
public void setWaypointDialogHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
public void setHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
this.helperCallbacks = callbacks;
}