diff --git a/OsmAnd/res/layout/map_hud_bottom.xml b/OsmAnd/res/layout/map_hud_bottom.xml
index 6088fe7e4c..5c084fffdb 100644
--- a/OsmAnd/res/layout/map_hud_bottom.xml
+++ b/OsmAnd/res/layout/map_hud_bottom.xml
@@ -62,29 +62,6 @@
android:textSize="@dimen/map_button_text_size"/>
-
-
-
-
-
-
-
diff --git a/OsmAnd/res/values-ca/phrases.xml b/OsmAnd/res/values-ca/phrases.xml
index 3b8ce3ffcd..eda6a808ed 100644
--- a/OsmAnd/res/values-ca/phrases.xml
+++ b/OsmAnd/res/values-ca/phrases.xml
@@ -1,4 +1,4 @@
-
+
Jaciment paleontològic
Fleca
@@ -2095,4 +2095,15 @@
Motiu de l\'explosió: aplicació industrial, moviment de terres
Hora de la explosió (UTC)
Cràter de l\'explosió
+ Codi de referència del pont
+ Codi de referència del túnel
+
+ Codi de referència
+
+ Càrrega: passatgers
+ Càrrega: vehicles
+ Càrrega: bicicletes
+ Càrrega: contenidors
+ Càrrega: vehicles pesants
+
diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml
index 6d3e6d78bc..0a4f41138f 100644
--- a/OsmAnd/res/values-ca/strings.xml
+++ b/OsmAnd/res/values-ca/strings.xml
@@ -1,4 +1,4 @@
-
+
Mostra els missatges d\'avís…
@@ -1929,4 +1929,7 @@ Per retornar a l\'estil habitual dels mapes d\'OsmAnd, només cal desactivar aqu
Desa els canvis
Adreça de correu electrònic
" OsmAnd Mapes i Navegació - confecciona rutes i situa ubicacions al mapa sense connexió a Internet. Baixeu un mapa d\'un país abans de viatjar-hi per trobar llocs i rutes en una zona que no us sigui familiar. Opcions bàsiques: • Mapes detallats de 200 països • Navegador sense connexió amb guiatge de veu • Cerca d\'adreces en mode desconnexió • Informació sobre ubicacions al mapa: llocs d\'interès, cafeteries, aparcaments, botigues • Podeu afegir ubicacions als vostres preferits • Opcions addicionals de navegació en els modes Cotxe, Bicicleta i Vianant : • Capacitat de mostrar i gravar traces GPX • Descripcions a la Vikipèdia dels PDI • Afegiu fotografies, àudios i vídeos al mapa • Modes de mapa diurn i nocturn per una conducció més convenient • Informació sobre rutes i parades de transport públic • Rutes ciclistes i camins • Pistes de senderisme per fer turisme a tot el món • Mapes en connexió de nombroses fonts • Informació sobre qualitat del paviment i il·luminació dels carrers • Addició, edició i eliminació de PDI (per usuaris de Openstreetmap.org) • OsMo - monitorització en temps real d\'altres dispositius Aconsegiu un navegador fiable pel vostre país - ja sigui França, Alemanya, Mèxic, Regne Unit, Espanya, Holanda, EE.UU., Rússia, Brasil o qualsevol altre estat. Extensions: • Mapes de contorn i ombrejat del terreny https://goo.gl/7mojP8 Dades de corbes de nivell i visualització de terreny afegits al mapa bàsic OsmAnd . • Mapes d\'esquí https://goo.gl/pX6DxJ La informació sobre pistes d\'esquí, pistes d\'esquí de fons, telecabines i ascensors d\'esquí. • Mapa nàutic https://goo.gl/0hEdxm Estil de mapa especial per veure senyals de navegació nàutica pers fluvials i navegació costera. • Posició de l\'aparcament https://goo.gl/6jxQXF Us ajuda a marcar l\'ubicació del vostre vehícle aparcat i controlar el temps que queda si l\'aparcament té limitació de temps. ¡Manteniu-vos informat! Twitter: https://twitter.com/osmandapp Facebook: https://www.facebook.com/osmandapp Lloc: http://osmand.net Si us cal ajut per l\'aplicació OsmAnd, contacteu amb el nostre equip de suport: support@osmand.net. "
+ Mostra els polígons
+ Transparència de la capa inferior
+ Troba un aparcament
diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml
index 15ced70bd9..dcccb17563 100644
--- a/OsmAnd/res/values-de/phrases.xml
+++ b/OsmAnd/res/values-de/phrases.xml
@@ -1,4 +1,4 @@
-
+
Bowling
Kegeln
@@ -2586,4 +2586,11 @@
Geschütztes Objekt: Lebensraum
Explosion: Land
Hausname
+ Explosion: Seite
+ Explosionsart: Untergrund, Tunnel
+ Explosionsart: atmosphärische
+ Explosionsart: atmosphärische, Oberfläche
+ Explosionsart: Untergrund
+ Explosionsart: Weltall (Höhe über 80km)
+ Explosionsart: unter Wasser
diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml
index 3dcfe5703c..6bafbbfa46 100644
--- a/OsmAnd/res/values-de/strings.xml
+++ b/OsmAnd/res/values-de/strings.xml
@@ -1,4 +1,4 @@
-
+
Entfernen
Eintrag entfernt
@@ -2015,4 +2015,6 @@
Änderungen speichern
E-Mail-Adresse speichern
Parkplatz finden
+ Polygone anzeigen
+ Underlay-Karte Transparenz
diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml
index e1a98b2b52..dd56a4f322 100644
--- a/OsmAnd/res/values-es-rAR/strings.xml
+++ b/OsmAnd/res/values-es-rAR/strings.xml
@@ -1,4 +1,4 @@
-
+
Ocultar números de casa
@@ -1720,7 +1720,7 @@
Profundidad de campo extendido (EDOF)
Enfoque al infinito
Modo de enfoque macro (primer plano)
- La cámara intenta enfocar continuamente
+ Enfoque continuo
Sonido al fotografiar
Elige si reproducir sonido al fotografiar
Tamaño de foto
diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml
index 90e27ec07a..9d69925397 100644
--- a/OsmAnd/res/values-nl/strings.xml
+++ b/OsmAnd/res/values-nl/strings.xml
@@ -1,4 +1,4 @@
-
+
Configureer scherm
@@ -2179,4 +2179,7 @@
Status
Wijzigingen opslaan
Emailadres
+ Toon polygonen
+ Underlay transparantie
+ Zoek parkeerplaats
diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml
index b85d3b0686..d6dab1f43b 100644
--- a/OsmAnd/res/values-sk/strings.xml
+++ b/OsmAnd/res/values-sk/strings.xml
@@ -1,4 +1,4 @@
-
+
Zobraziť
@@ -1938,4 +1938,6 @@
Skryť podzemné objekty
Prečítať viac
Nájsť parkovanie
+ Zobraziť polygóny
+ Priehľadnosť v podkladovej vrstve
diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml
index 1d3dcf633c..050d20c5aa 100644
--- a/OsmAnd/res/values-tr/strings.xml
+++ b/OsmAnd/res/values-tr/strings.xml
@@ -1,4 +1,4 @@
-
+
Değişiklik listesini kapat
ZXing Barcode Scanner uygulaması kurulu değil. Uygulama marketinde aramak ister misiniz?
Yol renk şemasını seç:
@@ -2048,4 +2048,7 @@
Yeraltı nesneleri gizle
Daha fazla bilgi edinin
" OsmAnd haritalar ve navigasyon - güzergah ve internet bağlantısı olmadan harita üzerinde konumları bulmak. Yerler ve yolları içinde yabancı bir alan bulmak için bir geziye gitmeden önce bir ülkenin bir harita yükleme. Temel seçenekleri: • 200 ülkenin detaylı haritaları • çevrimdışı Navigasyon ses ile ister çevrimdışı modu • bilgi haritada konumları hakkında • adres arama: faiz, kafeterya, otoparklar, Sık Kullanılanlar •, Bisiklet yaya sürüş için mağazaları • ekleme konumları yerlerin gezinti ek seçenekleri: • Beceri görüntülemek ve GPX kaydetmek için parça • Wikipedia açıklaması POI • ekleme fotoğraf, ses, ve harita • gündüz ve gece için video notları göster modları için daha uygun sürüş • toplu taşıma hakkında bilgi yönlendirir ve • bisiklet yolları ve patikalar • yürüyüş parkurları turizm Dünya • Online haritalar çok sayıda kaynakları • yol kaldırım kalite ve sokak aydınlatma • hakkında bilgi: her yerinde durur ekleme, düzenleme ve silme OsMo - canlı izleme diğer cihazlar olsun güvenilir bir navigasyon POI (OpenStreetMap.org kullanıcılar için) • senin ülke - Fransa olmak , Almanya, Meksika, İngiltere, İspanya, Hollanda, ABD, Rusya, Brezilya veya başka bir devlet. Eklentiler: • kontur haritaları ve arazi gölgelendirme https://goo.gl/7mojP8 kontur satır veri ve arazi görselleştirme temel OsmAnd harita ekledi. • Kayak https://goo.gl/pX6DxJ Kayak pistes, Kayak parça, kablo demiryolları ve teleferik hakkında bilgi: eşler. • Deniz harita https://goo.gl/0hEdxm kullan görüntülemek için özel harita stil arter ve nearshore deniz navigasyon için imzalar. • Https://goo.gl/6JxQXF Park pozisyonu park edilmiş aracınızın konumunu işaretlemek ve sol ne kadar zaman zaman sınırlı park yeri görmek yardımcı olur. Bizi izlemeye devam edin! Twitter: https://twitter.com/osmandapp Facebook: https://www.facebook.com/osmandapp Site: http://osmand.net OsmAnd uygulama, yardıma ihtiyacınız varsa lütfen destek ekibimizle iletişime geçin: support@osmand.net. "
+ Çokgenleri göster
+ Şeffaflık altına koymak
+ Bir park yeri bulmak
diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
index fd19a1a540..08a0084a7c 100644
--- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
@@ -12,6 +12,7 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.ProgressBar;
+import android.widget.SeekBar;
import android.widget.TextView;
import net.osmand.AndroidUtils;
@@ -37,6 +38,10 @@ public class ContextMenuAdapter {
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked);
}
+ public interface OnIntegerValueChangedListener {
+ public boolean onIntegerValueChangedListener(int newValue);
+ }
+
public static abstract class OnRowItemClick implements OnContextMenuClick {
public OnRowItemClick() {
@@ -73,8 +78,10 @@ public class ContextMenuAdapter {
final TIntArrayList items = new TIntArrayList();
final TIntArrayList isCategory = new TIntArrayList();
final ArrayList itemNames = new ArrayList();
- final ArrayList checkListeners = new ArrayList();
+ final ArrayList checkListeners = new ArrayList<>();
+ final ArrayList integerListeners = new ArrayList<>();
final TIntArrayList selectedList = new TIntArrayList();
+ final TIntArrayList progressList = new TIntArrayList();
final TIntArrayList loadingList = new TIntArrayList();
final TIntArrayList layoutIds = new TIntArrayList();
final TIntArrayList iconList = new TIntArrayList();
@@ -114,6 +121,10 @@ public class ContextMenuAdapter {
return checkListeners.get(i);
}
+ public OnIntegerValueChangedListener getIntegerLister(int i) {
+ return integerListeners.get(i);
+ }
+
public String getItemName(int pos) {
return itemNames.get(pos);
}
@@ -134,6 +145,10 @@ public class ContextMenuAdapter {
return selectedList.get(pos);
}
+ public int getProgress(int pos) {
+ return progressList.get(pos);
+ }
+
public int getLoading(int pos) {
return loadingList.get(pos);
}
@@ -142,6 +157,10 @@ public class ContextMenuAdapter {
selectedList.set(pos, s);
}
+ public void setProgress(int pos, int s) {
+ progressList.set(pos, s);
+ }
+
public Drawable getImage(OsmandApplication ctx, int pos, boolean light) {
int lst = iconList.get(pos);
@@ -189,12 +208,14 @@ public class ContextMenuAdapter {
int id;
String name;
int selected = -1;
+ int progress = -1;
int layout = -1;
int loading = -1;
boolean cat;
int pos = -1;
String description = "";
private OnContextMenuClick checkBoxListener;
+ private OnIntegerValueChangedListener integerListener;
private Item() {
}
@@ -220,6 +241,11 @@ public class ContextMenuAdapter {
return this;
}
+ public Item progress(int progress) {
+ this.progress = progress;
+ return this;
+ }
+
public Item loading(int loading) {
this.loading = loading;
return this;
@@ -240,6 +266,11 @@ public class ContextMenuAdapter {
return this;
}
+ public Item listenInteger(OnIntegerValueChangedListener l) {
+ this.integerListener = l;
+ return this;
+ }
+
public void reg() {
if (pos >= items.size() || pos < 0) {
pos = items.size();
@@ -248,11 +279,13 @@ public class ContextMenuAdapter {
itemNames.add(pos, name);
itemDescription.add(pos, description);
selectedList.insert(pos, selected);
+ progressList.insert(pos, progress);
loadingList.insert(pos, loading);
layoutIds.insert(pos, layout);
iconList.insert(pos, icon);
iconListLight.insert(pos, lightIcon);
checkListeners.add(pos, checkBoxListener);
+ integerListeners.add(pos, integerListener);
isCategory.insert(pos, cat ? 1 : 0);
}
@@ -276,9 +309,11 @@ public class ContextMenuAdapter {
items.removeAt(pos);
itemNames.remove(pos);
selectedList.removeAt(pos);
+ progressList.removeAt(pos);
iconList.removeAt(pos);
iconListLight.removeAt(pos);
checkListeners.remove(pos);
+ integerListeners.remove(pos);
isCategory.removeAt(pos);
layoutIds.removeAt(pos);
loadingList.removeAt(pos);
@@ -408,6 +443,34 @@ public class ContextMenuAdapter {
}
}
+ if (convertView.findViewById(R.id.seekbar) != null) {
+ SeekBar seekBar = (SeekBar) convertView.findViewById(R.id.seekbar);
+ if(progressList.get(position) != -1) {
+ seekBar.setProgress(getProgress(position));
+ seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ OnIntegerValueChangedListener listener = getIntegerLister(position);
+ progressList.set(position, progress);
+ if (listener != null && fromUser) {
+ listener.onIntegerValueChangedListener(progress);
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ });
+ seekBar.setVisibility(View.VISIBLE);
+ } else if (seekBar != null) {
+ seekBar.setVisibility(View.GONE);
+ }
+ }
+
if (convertView.findViewById(R.id.ProgressBar) != null) {
ProgressBar bar = (ProgressBar) convertView.findViewById(R.id.ProgressBar);
if (loadingList.get(position) == 1) {
@@ -424,4 +487,4 @@ public class ContextMenuAdapter {
return convertView;
}
}
-}
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index e064478d03..507593ef14 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -113,6 +113,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
private static MapViewTrackingUtilities mapViewTrackingUtilities;
private static MapContextMenu mapContextMenu = new MapContextMenu();
+ private static Intent prevActivityIntent = null;
private BroadcastReceiver screenOffReceiver;
@@ -408,7 +409,11 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
setIntent(intent);
}
- private static Intent prevActivityIntent = null;
+ @Override
+ public void startActivity(Intent intent) {
+ clearPrevActivityIntent();
+ super.startActivity(intent);
+ }
@Override
public void onBackPressed() {
@@ -1036,7 +1041,9 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
}
}
-
+ public static void clearPrevActivityIntent() {
+ prevActivityIntent = null;
+ }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index f26d933829..9bfed42b40 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -559,6 +559,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
+ MapActivity.clearPrevActivityIntent();
mapActivity.closeDrawer();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
return true;
@@ -568,17 +569,16 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
- Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
- .getMapMarkersActivity());
- newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
- mapActivity.startActivity(newIntent);
- return true;
+ MapActivity.clearPrevActivityIntent();
+ mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
+ return false;
}
}).reg();
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
+ MapActivity.clearPrevActivityIntent();
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
enterRoutePlanningMode(null, null);
} else {
@@ -625,6 +625,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
+ MapActivity.clearPrevActivityIntent();
mapActivity.getMapLayers().getContextMenuLayer().showContextMenu(mapView.getLatitude(), mapView.getLongitude(), true);
return true;
}
@@ -634,6 +635,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
+ MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
return false;
}
@@ -643,6 +645,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
+ MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN);
return false;
}
@@ -661,7 +664,7 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadActivity());
- // causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
return true;
}
@@ -672,6 +675,7 @@ public class MapActivityActions implements DialogProvider {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(intent);
return false;
}
@@ -683,7 +687,7 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getPluginsActivity());
- // causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
return true;
}
@@ -696,6 +700,7 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
.getSettingsActivity());
+ settings.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(settings);
return true;
}
@@ -704,7 +709,9 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
- mapActivity.startActivity(new Intent(mapActivity, HelpActivity.class));
+ Intent intent = new Intent(mapActivity, HelpActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ mapActivity.startActivity(intent);
return true;
}
}).reg();
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
index 6d725d1fdf..8c2b27749f 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
@@ -51,7 +51,7 @@ import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
import net.osmand.plus.dashboard.tools.TransactionBuilder;
import net.osmand.plus.dialogs.ConfigureMapMenu;
-import net.osmand.plus.dialogs.UnderlayMapMenu;
+import net.osmand.plus.dialogs.RasterMapMenu;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.WaypointDialogHelper;
@@ -59,6 +59,7 @@ import net.osmand.plus.helpers.WaypointDialogHelper.WaypointDialogHelperCallback
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter;
+import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
import net.osmand.plus.views.DownloadedRegionsLayer;
@@ -157,6 +158,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
LIST_MENU,
ROUTE_PREFERENCES,
DASHBOARD,
+ OVERLAY_MAP,
UNDERLAY_MAP
}
@@ -354,6 +356,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
tv.setText(R.string.shared_string_settings);
} else if (visibleType == DashboardType.UNDERLAY_MAP) {
tv.setText(R.string.map_underlay);
+ } else if (visibleType == DashboardType.OVERLAY_MAP) {
+ tv.setText(R.string.map_overlay);
}
ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit);
edit.setVisibility(View.GONE);
@@ -723,7 +727,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
OnItemClickListener listener = routePreferencesMenu.getItemClickListener(listAdapter);
updateListAdapter(listAdapter, listener);
} else if (DashboardType.UNDERLAY_MAP == visibleType) {
- cm = UnderlayMapMenu.createListAdapter(mapActivity);
+ cm = RasterMapMenu.createListAdapter(mapActivity, OsmandRasterMapsPlugin.RasterMapType.UNDERLAY);
+ } else if (DashboardType.OVERLAY_MAP == visibleType) {
+ cm = RasterMapMenu.createListAdapter(mapActivity, OsmandRasterMapsPlugin.RasterMapType.OVERLAY);
}
if (cm != null) {
updateListAdapter(cm);
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java
new file mode 100644
index 0000000000..ab6f817357
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java
@@ -0,0 +1,75 @@
+package net.osmand.plus.dialogs;
+
+import android.util.Log;
+import android.view.View;
+import android.widget.ArrayAdapter;
+
+import net.osmand.plus.ContextMenuAdapter;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandPlugin;
+import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
+import net.osmand.plus.views.MapTileLayer;
+
+public class RasterMapMenu {
+ private static final String TAG = "RasterMapMenu";
+
+ public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
+ final OsmandRasterMapsPlugin.RasterMapType type) {
+ ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity, false);
+ adapter.setDefaultLayoutId(R.layout.drawer_list_material_item);
+ createLayersItems(adapter, mapActivity, type);
+ return adapter;
+ }
+
+ private static void createLayersItems(ContextMenuAdapter adapter,
+ final MapActivity mapActivity,
+ final OsmandRasterMapsPlugin.RasterMapType type) {
+ OsmandApplication app = mapActivity.getMyApplication();
+ final OsmandSettings settings = app.getSettings();
+ final OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class);
+ final MapTileLayer rasterMapLayer;
+ final OsmandSettings.CommonPreference mapTransparencyPreference;
+ if (type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY) {
+ rasterMapLayer = plugin.getOverlayLayer();
+ mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY;
+ } else {
+ rasterMapLayer = plugin.getUnderlayLayer();
+ mapTransparencyPreference = settings.MAP_TRANSPARENCY;
+ }
+ ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
+ @Override
+ public boolean onRowItemClick(ArrayAdapter> adapter, View view, int itemId, int pos) {
+ Log.v(TAG, "onRowItemClick(" + "adapter=" + adapter + ", view=" + view + ", itemId=" + itemId + ", pos=" + pos + ")");
+ return super.onRowItemClick(adapter, view, itemId, pos);
+ }
+
+ @Override
+ public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
+ Log.v(TAG, "onContextMenuClick(" + "adapter=" + adapter + ", itemId=" + itemId + ", pos=" + pos + ", isChecked=" + isChecked + ")");
+ if (itemId == R.string.shared_string_show) {
+ plugin.toggleUnderlayState(mapActivity, type);
+ }
+ return false;
+ }
+ };
+ adapter.item(R.string.shared_string_show).listen(l).selected(rasterMapLayer != null && rasterMapLayer.getMap() != null ? 1 : 0).reg();
+ // String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
+ ContextMenuAdapter.OnIntegerValueChangedListener integerListener =
+ new ContextMenuAdapter.OnIntegerValueChangedListener() {
+ @Override
+ public boolean onIntegerValueChangedListener(int newValue) {
+ mapTransparencyPreference.set(newValue);
+ mapActivity.getMapView().refreshMap();
+ return false;
+ }
+ };
+ // android:max="255" in layout is expected
+ adapter.item(R.string.underlay_transparency).layout(R.layout.progress_list_item)
+ .progress(mapTransparencyPreference.get()).listenInteger(integerListener).reg();
+ adapter.item(R.string.map_underlay).layout(R.layout.two_line_list_item).listen(l).reg();
+ adapter.item(R.string.show_polygons).listen(l).reg();
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/UnderlayMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/UnderlayMapMenu.java
deleted file mode 100644
index db298af65e..0000000000
--- a/OsmAnd/src/net/osmand/plus/dialogs/UnderlayMapMenu.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package net.osmand.plus.dialogs;
-
-import android.util.Log;
-import android.view.View;
-import android.widget.ArrayAdapter;
-
-import net.osmand.plus.ContextMenuAdapter;
-import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.OsmandSettings;
-import net.osmand.plus.R;
-import net.osmand.plus.activities.MapActivity;
-
-public class UnderlayMapMenu {
- private static final String TAG = "UnderlayMapMenu";
-
- public static ContextMenuAdapter createListAdapter(final MapActivity ma) {
- ContextMenuAdapter adapter = new ContextMenuAdapter(ma, false);
- adapter.setDefaultLayoutId(R.layout.drawer_list_material_item);
- createLayersItems(adapter, ma);
- return adapter;
- }
-
- private static void createLayersItems(ContextMenuAdapter adapter , MapActivity activity) {
- OsmandApplication app = activity.getMyApplication();
- OsmandSettings settings = app.getSettings();
- ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
- @Override
- public boolean onRowItemClick(ArrayAdapter> adapter, View view, int itemId, int pos) {
- Log.v(TAG, "onRowItemClick(" + "adapter=" + adapter + ", view=" + view + ", itemId=" + itemId + ", pos=" + pos + ")");
- return super.onRowItemClick(adapter, view, itemId, pos);
- }
-
- @Override
- public boolean onContextMenuClick(ArrayAdapter> adapter, int itemId, int pos, boolean isChecked) {
- Log.v(TAG, "onContextMenuClick(" + "adapter=" + adapter + ", itemId=" + itemId + ", pos=" + pos + ", isChecked=" + isChecked + ")");
- return false;
- }
- };
- adapter.item(R.string.shared_string_show).listen(l).reg();
- // String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
- adapter.item(R.string.underlay_transparency).layout(R.layout.progress_list_item).reg();
- adapter.item(R.string.map_underlay).layout(R.layout.two_line_list_item).listen(l).reg();
- adapter.item(R.string.show_polygons).listen(l).reg();
-
-// .selected(overlayLayer != null && overlayLayer.getMap() != null ? 1 : 0)
-
-// if(underlayLayer.getMap() != null){
-// settings.MAP_UNDERLAY.set(null);
-// updateMapLayers(mapView, null, layers);
-// layers.getMapControlsLayer().hideTransparencyBar(settings.MAP_TRANSPARENCY);
-// } else {
-// selectMapOverlayLayer(mapView, settings.MAP_UNDERLAY,settings.MAP_TRANSPARENCY,
-// mapActivity);
-// }
- }
-}
diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java
index ec439323f0..a03ef5216d 100644
--- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java
@@ -3,6 +3,7 @@ package net.osmand.plus.rastermaps;
import android.app.Activity;
import android.content.DialogInterface;
import android.os.AsyncTask;
+import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.AdapterView;
@@ -31,7 +32,7 @@ import net.osmand.plus.Version;
import net.osmand.plus.activities.DownloadTilesDialog;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers;
-import net.osmand.plus.dashboard.DashboardOnMap;
+import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
@@ -144,7 +145,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
public void selectMapOverlayLayer(final OsmandMapTileView mapView,
- final CommonPreference mapPref, final CommonPreference transparencyPref,
+ final CommonPreference mapPref,
final MapActivity activity){
final OsmandSettings settings = app.getSettings();
final MapActivityLayers layers = activity.getMapLayers();
@@ -158,30 +159,30 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
items[i] = app.getString(R.string.install_more);
- builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener(){
+ builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- if (which == items.length - 1){
+ if (which == items.length - 1) {
installMapLayers(activity, new ResultMatcher() {
TileSourceTemplate template = null;
int count = 0;
+
@Override
public boolean publish(TileSourceTemplate object) {
- if(object == null){
- if(count == 1){
+ if (object == null) {
+ if (count == 1) {
mapPref.set(template.getName());
- layers.getMapControlsLayer().showTransparencyBar(transparencyPref);
updateMapLayers(mapView, mapPref, layers);
} else {
- selectMapOverlayLayer(mapView, mapPref, transparencyPref, activity);
+ selectMapOverlayLayer(mapView, mapPref, activity);
}
} else {
- count ++;
+ count++;
template = object;
}
return false;
}
-
+
@Override
public boolean isCancelled() {
return false;
@@ -189,18 +190,19 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
});
} else {
mapPref.set(keys.get(which));
- layers.getMapControlsLayer().showTransparencyBar(transparencyPref);
updateMapLayers(mapView, mapPref, layers);
}
dialog.dismiss();
}
-
+
});
builder.show();
}
@Override
- public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
+ public void registerLayerContextMenuActions(final OsmandMapTileView mapView,
+ ContextMenuAdapter adapter,
+ final MapActivity mapActivity) {
final MapActivityLayers layers = mapActivity.getMapLayers();
OnContextMenuClick listener = new OnContextMenuClick() {
@Override
@@ -208,22 +210,17 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
if (itemId == R.string.layer_map) {
layers.selectMapLayer(mapView);
} else if(itemId == R.string.layer_overlay){
- if(overlayLayer.getMap() != null){
- settings.MAP_OVERLAY.set(null);
- updateMapLayers(mapView, null, layers);
- layers.getMapControlsLayer().hideTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY);
- } else {
- selectMapOverlayLayer(mapView, settings.MAP_OVERLAY, settings.MAP_OVERLAY_TRANSPARENCY, mapActivity);
- }
+ mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.OVERLAY_MAP);
+ return false;
} else if(itemId == R.string.layer_underlay){
- mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.UNDERLAY_MAP);
+ mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.UNDERLAY_MAP);
return false;
}
return true;
}
};
- adapter.item(R.string.layer_overlay).selected(overlayLayer != null && overlayLayer.getMap() != null ? 1 : 0).
+ adapter.item(R.string.layer_overlay).
iconColor(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg();
adapter.item(R.string.layer_underlay)
.iconColor(R.drawable.ic_layer_bottom_dark).listen(listener).position(15).reg();
@@ -414,4 +411,39 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
ts.getUrlTemplate().replace("{$x}", "{1}").replace("{$y}", "{2}").replace("{$z}", "{0}"));
elliptic.setChecked(ts.isEllipticYTile());
}
+
+ public MapTileLayer getUnderlayLayer() {
+ return underlayLayer;
+ }
+
+ public MapTileLayer getOverlayLayer() {
+ return overlayLayer;
+ }
+
+ public void toggleUnderlayState(@NonNull MapActivity mapActivity, @NonNull RasterMapType type) {
+ OsmandMapTileView mapView = mapActivity.getMapView();
+ CommonPreference mapTypePreference;
+ ITileSource map;
+ if (type == RasterMapType.OVERLAY) {
+ mapTypePreference = settings.MAP_OVERLAY;
+ map = overlayLayer.getMap();
+ } else {
+ mapTypePreference = settings.MAP_UNDERLAY;
+ map = underlayLayer.getMap();
+ }
+
+ if (map != null) {
+ mapTypePreference.set(null);
+ MapActivityLayers mapLayers = mapActivity.getMapLayers();
+ updateMapLayers(mapView, null, mapLayers);
+ } else {
+ selectMapOverlayLayer(mapView, mapTypePreference,
+ mapActivity);
+ }
+ }
+
+ public enum RasterMapType {
+ OVERLAY,
+ UNDERLAY
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
index f383ca7527..42f5852aff 100644
--- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
@@ -17,10 +17,7 @@ import android.support.v7.app.AlertDialog;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
-import android.widget.ImageButton;
import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.SeekBar;
import android.widget.TextView;
import net.londatiga.android.ActionItem;
@@ -68,8 +65,6 @@ public class MapControlsLayer extends OsmandMapLayer {
// private RulerControl rulerControl;
// private List allControls = new ArrayList();
- private SeekBar transparencyBar;
- private LinearLayout transparencyBarLayout;
private static CommonPreference settingsToTransparency;
private OsmandSettings settings;
@@ -109,7 +104,6 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override
public void initLayer(final OsmandMapTileView view) {
initTopControls();
- initTransparencyBar();
initZooms();
initDasboardRelatedControls();
updateControls(view.getCurrentRotatedTileBox(), null);
@@ -193,6 +187,7 @@ public class MapControlsLayer extends OsmandMapLayer {
configureMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
}
});
@@ -335,6 +330,7 @@ public class MapControlsLayer extends OsmandMapLayer {
backToMenuButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ MapActivity.clearPrevActivityIntent();
if (dash) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
} else {
@@ -381,6 +377,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}
private void onNavigationClick() {
+ MapActivity.clearPrevActivityIntent();
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
@@ -589,58 +586,6 @@ public class MapControlsLayer extends OsmandMapLayer {
return false;
}
- // /////////////// Transparency bar /////////////////////////
- private void initTransparencyBar() {
- transparencyBarLayout = (LinearLayout) mapActivity.findViewById(R.id.map_transparency_layout);
- transparencyBar = (SeekBar) mapActivity.findViewById(R.id.map_transparency_seekbar);
- transparencyBar.setMax(255);
- if (settingsToTransparency != null) {
- transparencyBar.setProgress(settingsToTransparency.get());
- transparencyBarLayout.setVisibility(View.VISIBLE);
- } else {
- transparencyBarLayout.setVisibility(View.GONE);
- }
- transparencyBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
- }
-
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if (settingsToTransparency != null) {
- settingsToTransparency.set(progress);
- mapActivity.getMapView().refreshMap();
- }
- }
- });
- ImageButton imageButton = (ImageButton) mapActivity.findViewById(R.id.map_transparency_hide);
- imageButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- transparencyBarLayout.setVisibility(View.GONE);
- hideTransparencyBar(settingsToTransparency);
- }
- });
- }
-
- public void showTransparencyBar(CommonPreference transparenPreference) {
- MapControlsLayer.settingsToTransparency = transparenPreference;
- transparencyBarLayout.setVisibility(View.VISIBLE);
- transparencyBar.setProgress(transparenPreference.get());
- }
-
- public void hideTransparencyBar(CommonPreference transparentPreference) {
- if (settingsToTransparency == transparentPreference) {
- transparencyBarLayout.setVisibility(View.GONE);
- settingsToTransparency = null;
- }
- }
-
private class MapHudButton {
View iv;
int bgDark;