Merge master

This commit is contained in:
Alexey Kulish 2016-02-07 10:07:47 +03:00
commit 7dd73e69d6
18 changed files with 272 additions and 182 deletions

View file

@ -62,29 +62,6 @@
android:textSize="@dimen/map_button_text_size"/> android:textSize="@dimen/map_button_text_size"/>
</FrameLayout> </FrameLayout>
<LinearLayout
android:id="@+id/map_transparency_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="@dimen/map_button_size"
android:orientation="horizontal">
<SeekBar
android:id="@+id/map_transparency_seekbar"
android:layout_width="@dimen/map_trans_seek_size"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<ImageButton
android:id="@+id/map_transparency_hide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/btn_circle_transparent"
android:src="@drawable/headliner_close"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -22,10 +22,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView <ImageView
android:src="@drawable/ic_action_opacity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<SeekBar <SeekBar
android:id="@+id/seekbar"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:max="255"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources><string name="poi_palaeontological_site">Jaciment paleontològic</string> <resources><string name="poi_palaeontological_site">Jaciment paleontològic</string>
<string name="poi_bakery">Fleca</string> <string name="poi_bakery">Fleca</string>
@ -2095,4 +2095,15 @@
<string name="poi_nuclear_explosion_purpose_industrial_application_earth_moving">Motiu de l\'explosió: aplicació industrial, moviment de terres</string> <string name="poi_nuclear_explosion_purpose_industrial_application_earth_moving">Motiu de l\'explosió: aplicació industrial, moviment de terres</string>
<string name="poi_nuclear_explosion_time_utc">Hora de la explosió (UTC)</string> <string name="poi_nuclear_explosion_time_utc">Hora de la explosió (UTC)</string>
<string name="poi_nuclear_explosion_hole">Cràter de l\'explosió</string> <string name="poi_nuclear_explosion_hole">Cràter de l\'explosió</string>
<string name="poi_bridge_ref">Codi de referència del pont</string>
<string name="poi_tunnel_ref">Codi de referència del túnel</string>
<string name="poi_ref">Codi de referència</string>
<string name="poi_cargo_passengers">Càrrega: passatgers</string>
<string name="poi_cargo_vehicle">Càrrega: vehicles</string>
<string name="poi_cargo_bicycle">Càrrega: bicicletes</string>
<string name="poi_cargo_container">Càrrega: contenidors</string>
<string name="poi_cargo_hgv">Càrrega: vehicles pesants</string>
</resources> </resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="show_warnings_title">Mostra els missatges d\'avís…</string> <string name="show_warnings_title">Mostra els missatges d\'avís…</string>
@ -1929,4 +1929,7 @@ Per retornar a l\'estil habitual dels mapes d\'OsmAnd, només cal desactivar aqu
<string name="shared_string_save_changes">Desa els canvis</string> <string name="shared_string_save_changes">Desa els canvis</string>
<string name="shared_string_email_address">Adreça de correu electrònic</string> <string name="shared_string_email_address">Adreça de correu electrònic</string>
<string name="osmand_plus_extended_description_4000_chars_v2">" 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. "</string> <string name="osmand_plus_extended_description_4000_chars_v2">" 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. "</string>
<string name="show_polygons">Mostra els polígons</string>
<string name="underlay_transparency">Transparència de la capa inferior</string>
<string name="find_parking">Troba un aparcament</string>
</resources> </resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="poi_10pin">Bowling</string> <string name="poi_10pin">Bowling</string>
<string name="poi_9pin">Kegeln</string> <string name="poi_9pin">Kegeln</string>
@ -2586,4 +2586,11 @@
<string name="poi_protection_object_habitat">Geschütztes Objekt: Lebensraum</string> <string name="poi_protection_object_habitat">Geschütztes Objekt: Lebensraum</string>
<string name="poi_nuclear_explosion_country">Explosion: Land</string> <string name="poi_nuclear_explosion_country">Explosion: Land</string>
<string name="poi_addr_housename">Hausname</string> <string name="poi_addr_housename">Hausname</string>
<string name="poi_nuclear_explosion_site">Explosion: Seite</string>
<string name="poi_nuclear_explosion_type_underground_tunnel">Explosionsart: Untergrund, Tunnel</string>
<string name="poi_nuclear_explosion_type_atmospheric">Explosionsart: atmosphärische</string>
<string name="poi_nuclear_explosion_type_atmospheric_atmospheric_surface">Explosionsart: atmosphärische, Oberfläche</string>
<string name="poi_nuclear_explosion_type_underground">Explosionsart: Untergrund</string>
<string name="poi_nuclear_explosion_type_space">Explosionsart: Weltall (Höhe über 80km)</string>
<string name="poi_nuclear_explosion_type_underwater">Explosionsart: unter Wasser</string>
</resources> </resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="shared_string_remove">Entfernen</string> <string name="shared_string_remove">Entfernen</string>
<string name="item_removed">Eintrag entfernt</string> <string name="item_removed">Eintrag entfernt</string>
@ -2015,4 +2015,6 @@
<string name="shared_string_save_changes">Änderungen speichern</string> <string name="shared_string_save_changes">Änderungen speichern</string>
<string name="shared_string_email_address">E-Mail-Adresse speichern</string> <string name="shared_string_email_address">E-Mail-Adresse speichern</string>
<string name="find_parking">Parkplatz finden</string> <string name="find_parking">Parkplatz finden</string>
<string name="show_polygons">Polygone anzeigen</string>
<string name="underlay_transparency">Underlay-Karte Transparenz</string>
</resources> </resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="rendering_attr_hideHouseNumbers_name">Ocultar números de casa</string> <string name="rendering_attr_hideHouseNumbers_name">Ocultar números de casa</string>
@ -1720,7 +1720,7 @@
<string name="av_camera_focus_edof">Profundidad de campo extendido (EDOF)</string> <string name="av_camera_focus_edof">Profundidad de campo extendido (EDOF)</string>
<string name="av_camera_focus_infinity">Enfoque al infinito</string> <string name="av_camera_focus_infinity">Enfoque al infinito</string>
<string name="av_camera_focus_macro">Modo de enfoque macro (primer plano)</string> <string name="av_camera_focus_macro">Modo de enfoque macro (primer plano)</string>
<string name="av_camera_focus_continuous">La cámara intenta enfocar continuamente</string> <string name="av_camera_focus_continuous">Enfoque continuo</string>
<string name="av_photo_play_sound">Sonido al fotografiar</string> <string name="av_photo_play_sound">Sonido al fotografiar</string>
<string name="av_photo_play_sound_descr">Elige si reproducir sonido al fotografiar</string> <string name="av_photo_play_sound_descr">Elige si reproducir sonido al fotografiar</string>
<string name="av_camera_pic_size">Tamaño de foto</string> <string name="av_camera_pic_size">Tamaño de foto</string>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="layer_map_appearance">Configureer scherm</string> <string name="layer_map_appearance">Configureer scherm</string>
@ -2179,4 +2179,7 @@
<string name="shared_string_status">Status</string> <string name="shared_string_status">Status</string>
<string name="shared_string_save_changes">Wijzigingen opslaan</string> <string name="shared_string_save_changes">Wijzigingen opslaan</string>
<string name="shared_string_email_address">Emailadres</string> <string name="shared_string_email_address">Emailadres</string>
<string name="show_polygons">Toon polygonen</string>
<string name="underlay_transparency">Underlay transparantie</string>
<string name="find_parking">Zoek parkeerplaats</string>
</resources> </resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="recording_context_menu_show">Zobraziť</string> <string name="recording_context_menu_show">Zobraziť</string>
@ -1938,4 +1938,6 @@
<string name="rendering_attr_hideUnderground_name">Skryť podzemné objekty</string> <string name="rendering_attr_hideUnderground_name">Skryť podzemné objekty</string>
<string name="shared_string_read_more">Prečítať viac</string> <string name="shared_string_read_more">Prečítať viac</string>
<string name="find_parking">Nájsť parkovanie</string> <string name="find_parking">Nájsť parkovanie</string>
<string name="show_polygons">Zobraziť polygóny</string>
<string name="underlay_transparency">Priehľadnosť v podkladovej vrstve</string>
</resources> </resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources><string name="close_changeset">Değişiklik listesini kapat</string> <resources><string name="close_changeset">Değişiklik listesini kapat</string>
<string name="zxing_barcode_scanner_not_found">ZXing Barcode Scanner uygulaması kurulu değil. Uygulama marketinde aramak ister misiniz?</string> <string name="zxing_barcode_scanner_not_found">ZXing Barcode Scanner uygulaması kurulu değil. Uygulama marketinde aramak ister misiniz?</string>
<string name="rendering_attr_roadColors_description">Yol renk şemasını seç:</string> <string name="rendering_attr_roadColors_description">Yol renk şemasını seç:</string>
@ -2048,4 +2048,7 @@
<string name="rendering_attr_hideUnderground_name">Yeraltı nesneleri gizle</string> <string name="rendering_attr_hideUnderground_name">Yeraltı nesneleri gizle</string>
<string name="shared_string_read_more">Daha fazla bilgi edinin</string> <string name="shared_string_read_more">Daha fazla bilgi edinin</string>
<string name="osmand_plus_extended_description_4000_chars_v2">" 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. "</string> <string name="osmand_plus_extended_description_4000_chars_v2">" 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. "</string>
<string name="show_polygons">Çokgenleri göster</string>
<string name="underlay_transparency">Şeffaflık altına koymak</string>
<string name="find_parking">Bir park yeri bulmak</string>
</resources> </resources>

View file

@ -12,6 +12,7 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
@ -37,6 +38,10 @@ public class ContextMenuAdapter {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked); 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 static abstract class OnRowItemClick implements OnContextMenuClick {
public OnRowItemClick() { public OnRowItemClick() {
@ -73,8 +78,10 @@ public class ContextMenuAdapter {
final TIntArrayList items = new TIntArrayList(); final TIntArrayList items = new TIntArrayList();
final TIntArrayList isCategory = new TIntArrayList(); final TIntArrayList isCategory = new TIntArrayList();
final ArrayList<String> itemNames = new ArrayList<String>(); final ArrayList<String> itemNames = new ArrayList<String>();
final ArrayList<OnContextMenuClick> checkListeners = new ArrayList<ContextMenuAdapter.OnContextMenuClick>(); final ArrayList<OnContextMenuClick> checkListeners = new ArrayList<>();
final ArrayList<OnIntegerValueChangedListener> integerListeners = new ArrayList<>();
final TIntArrayList selectedList = new TIntArrayList(); final TIntArrayList selectedList = new TIntArrayList();
final TIntArrayList progressList = new TIntArrayList();
final TIntArrayList loadingList = new TIntArrayList(); final TIntArrayList loadingList = new TIntArrayList();
final TIntArrayList layoutIds = new TIntArrayList(); final TIntArrayList layoutIds = new TIntArrayList();
final TIntArrayList iconList = new TIntArrayList(); final TIntArrayList iconList = new TIntArrayList();
@ -114,6 +121,10 @@ public class ContextMenuAdapter {
return checkListeners.get(i); return checkListeners.get(i);
} }
public OnIntegerValueChangedListener getIntegerLister(int i) {
return integerListeners.get(i);
}
public String getItemName(int pos) { public String getItemName(int pos) {
return itemNames.get(pos); return itemNames.get(pos);
} }
@ -134,6 +145,10 @@ public class ContextMenuAdapter {
return selectedList.get(pos); return selectedList.get(pos);
} }
public int getProgress(int pos) {
return progressList.get(pos);
}
public int getLoading(int pos) { public int getLoading(int pos) {
return loadingList.get(pos); return loadingList.get(pos);
} }
@ -142,6 +157,10 @@ public class ContextMenuAdapter {
selectedList.set(pos, s); selectedList.set(pos, s);
} }
public void setProgress(int pos, int s) {
progressList.set(pos, s);
}
public Drawable getImage(OsmandApplication ctx, int pos, boolean light) { public Drawable getImage(OsmandApplication ctx, int pos, boolean light) {
int lst = iconList.get(pos); int lst = iconList.get(pos);
@ -189,12 +208,14 @@ public class ContextMenuAdapter {
int id; int id;
String name; String name;
int selected = -1; int selected = -1;
int progress = -1;
int layout = -1; int layout = -1;
int loading = -1; int loading = -1;
boolean cat; boolean cat;
int pos = -1; int pos = -1;
String description = ""; String description = "";
private OnContextMenuClick checkBoxListener; private OnContextMenuClick checkBoxListener;
private OnIntegerValueChangedListener integerListener;
private Item() { private Item() {
} }
@ -220,6 +241,11 @@ public class ContextMenuAdapter {
return this; return this;
} }
public Item progress(int progress) {
this.progress = progress;
return this;
}
public Item loading(int loading) { public Item loading(int loading) {
this.loading = loading; this.loading = loading;
return this; return this;
@ -240,6 +266,11 @@ public class ContextMenuAdapter {
return this; return this;
} }
public Item listenInteger(OnIntegerValueChangedListener l) {
this.integerListener = l;
return this;
}
public void reg() { public void reg() {
if (pos >= items.size() || pos < 0) { if (pos >= items.size() || pos < 0) {
pos = items.size(); pos = items.size();
@ -248,11 +279,13 @@ public class ContextMenuAdapter {
itemNames.add(pos, name); itemNames.add(pos, name);
itemDescription.add(pos, description); itemDescription.add(pos, description);
selectedList.insert(pos, selected); selectedList.insert(pos, selected);
progressList.insert(pos, progress);
loadingList.insert(pos, loading); loadingList.insert(pos, loading);
layoutIds.insert(pos, layout); layoutIds.insert(pos, layout);
iconList.insert(pos, icon); iconList.insert(pos, icon);
iconListLight.insert(pos, lightIcon); iconListLight.insert(pos, lightIcon);
checkListeners.add(pos, checkBoxListener); checkListeners.add(pos, checkBoxListener);
integerListeners.add(pos, integerListener);
isCategory.insert(pos, cat ? 1 : 0); isCategory.insert(pos, cat ? 1 : 0);
} }
@ -276,9 +309,11 @@ public class ContextMenuAdapter {
items.removeAt(pos); items.removeAt(pos);
itemNames.remove(pos); itemNames.remove(pos);
selectedList.removeAt(pos); selectedList.removeAt(pos);
progressList.removeAt(pos);
iconList.removeAt(pos); iconList.removeAt(pos);
iconListLight.removeAt(pos); iconListLight.removeAt(pos);
checkListeners.remove(pos); checkListeners.remove(pos);
integerListeners.remove(pos);
isCategory.removeAt(pos); isCategory.removeAt(pos);
layoutIds.removeAt(pos); layoutIds.removeAt(pos);
loadingList.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) { if (convertView.findViewById(R.id.ProgressBar) != null) {
ProgressBar bar = (ProgressBar) convertView.findViewById(R.id.ProgressBar); ProgressBar bar = (ProgressBar) convertView.findViewById(R.id.ProgressBar);
if (loadingList.get(position) == 1) { if (loadingList.get(position) == 1) {

View file

@ -113,6 +113,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
private static MapViewTrackingUtilities mapViewTrackingUtilities; private static MapViewTrackingUtilities mapViewTrackingUtilities;
private static MapContextMenu mapContextMenu = new MapContextMenu(); private static MapContextMenu mapContextMenu = new MapContextMenu();
private static Intent prevActivityIntent = null;
private BroadcastReceiver screenOffReceiver; private BroadcastReceiver screenOffReceiver;
@ -408,7 +409,11 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
setIntent(intent); setIntent(intent);
} }
private static Intent prevActivityIntent = null; @Override
public void startActivity(Intent intent) {
clearPrevActivityIntent();
super.startActivity(intent);
}
@Override @Override
public void onBackPressed() { public void onBackPressed() {
@ -1036,7 +1041,9 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
} }
} }
public static void clearPrevActivityIntent() {
prevActivityIntent = null;
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {

View file

@ -559,6 +559,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
mapActivity.closeDrawer(); mapActivity.closeDrawer();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
return true; return true;
@ -568,17 +569,16 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization() MapActivity.clearPrevActivityIntent();
.getMapMarkersActivity()); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); return false;
mapActivity.startActivity(newIntent);
return true;
} }
}).reg(); }).reg();
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark) optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
enterRoutePlanningMode(null, null); enterRoutePlanningMode(null, null);
} else { } else {
@ -625,6 +625,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
mapActivity.getMapLayers().getContextMenuLayer().showContextMenu(mapView.getLatitude(), mapView.getLongitude(), true); mapActivity.getMapLayers().getContextMenuLayer().showContextMenu(mapView.getLatitude(), mapView.getLongitude(), true);
return true; return true;
} }
@ -634,6 +635,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
return false; return false;
} }
@ -643,6 +645,7 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN);
return false; return false;
} }
@ -661,7 +664,7 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization() Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadActivity()); .getDownloadActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent); mapActivity.startActivity(newIntent);
return true; return true;
} }
@ -672,6 +675,7 @@ public class MapActivityActions implements DialogProvider {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent intent = new Intent(mapActivity, OsmLiveActivity.class); Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(intent); mapActivity.startActivity(intent);
return false; return false;
} }
@ -683,7 +687,7 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization() Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getPluginsActivity()); .getPluginsActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent); mapActivity.startActivity(newIntent);
return true; return true;
} }
@ -696,6 +700,7 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization() final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
.getSettingsActivity()); .getSettingsActivity());
settings.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(settings); mapActivity.startActivity(settings);
return true; return true;
} }
@ -704,7 +709,9 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { 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; return true;
} }
}).reg(); }).reg();

View file

@ -51,7 +51,7 @@ import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment; import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
import net.osmand.plus.dashboard.tools.TransactionBuilder; import net.osmand.plus.dashboard.tools.TransactionBuilder;
import net.osmand.plus.dialogs.ConfigureMapMenu; 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.download.DownloadActivity;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.WaypointDialogHelper; 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.helpers.WaypointHelper.LocationPointWrapper;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu; import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter; 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;
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener; import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
import net.osmand.plus.views.DownloadedRegionsLayer; import net.osmand.plus.views.DownloadedRegionsLayer;
@ -157,6 +158,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
LIST_MENU, LIST_MENU,
ROUTE_PREFERENCES, ROUTE_PREFERENCES,
DASHBOARD, DASHBOARD,
OVERLAY_MAP,
UNDERLAY_MAP UNDERLAY_MAP
} }
@ -354,6 +356,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
tv.setText(R.string.shared_string_settings); tv.setText(R.string.shared_string_settings);
} else if (visibleType == DashboardType.UNDERLAY_MAP) { } else if (visibleType == DashboardType.UNDERLAY_MAP) {
tv.setText(R.string.map_underlay); 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); ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit);
edit.setVisibility(View.GONE); edit.setVisibility(View.GONE);
@ -723,7 +727,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
OnItemClickListener listener = routePreferencesMenu.getItemClickListener(listAdapter); OnItemClickListener listener = routePreferencesMenu.getItemClickListener(listAdapter);
updateListAdapter(listAdapter, listener); updateListAdapter(listAdapter, listener);
} else if (DashboardType.UNDERLAY_MAP == visibleType) { } 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) { if (cm != null) {
updateListAdapter(cm); updateListAdapter(cm);

View file

@ -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<Integer> 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();
}
}

View file

@ -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);
// }
}
}

View file

@ -3,6 +3,7 @@ package net.osmand.plus.rastermaps;
import android.app.Activity; import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
@ -31,7 +32,7 @@ import net.osmand.plus.Version;
import net.osmand.plus.activities.DownloadTilesDialog; import net.osmand.plus.activities.DownloadTilesDialog;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers; 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.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -144,7 +145,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
} }
public void selectMapOverlayLayer(final OsmandMapTileView mapView, public void selectMapOverlayLayer(final OsmandMapTileView mapView,
final CommonPreference<String> mapPref, final CommonPreference<Integer> transparencyPref, final CommonPreference<String> mapPref,
final MapActivity activity){ final MapActivity activity){
final OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
final MapActivityLayers layers = activity.getMapLayers(); final MapActivityLayers layers = activity.getMapLayers();
@ -158,25 +159,25 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
} }
items[i] = app.getString(R.string.install_more); items[i] = app.getString(R.string.install_more);
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener(){ builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (which == items.length - 1){ if (which == items.length - 1) {
installMapLayers(activity, new ResultMatcher<TileSourceTemplate>() { installMapLayers(activity, new ResultMatcher<TileSourceTemplate>() {
TileSourceTemplate template = null; TileSourceTemplate template = null;
int count = 0; int count = 0;
@Override @Override
public boolean publish(TileSourceTemplate object) { public boolean publish(TileSourceTemplate object) {
if(object == null){ if (object == null) {
if(count == 1){ if (count == 1) {
mapPref.set(template.getName()); mapPref.set(template.getName());
layers.getMapControlsLayer().showTransparencyBar(transparencyPref);
updateMapLayers(mapView, mapPref, layers); updateMapLayers(mapView, mapPref, layers);
} else { } else {
selectMapOverlayLayer(mapView, mapPref, transparencyPref, activity); selectMapOverlayLayer(mapView, mapPref, activity);
} }
} else { } else {
count ++; count++;
template = object; template = object;
} }
return false; return false;
@ -189,7 +190,6 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}); });
} else { } else {
mapPref.set(keys.get(which)); mapPref.set(keys.get(which));
layers.getMapControlsLayer().showTransparencyBar(transparencyPref);
updateMapLayers(mapView, mapPref, layers); updateMapLayers(mapView, mapPref, layers);
} }
dialog.dismiss(); dialog.dismiss();
@ -200,7 +200,9 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
} }
@Override @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(); final MapActivityLayers layers = mapActivity.getMapLayers();
OnContextMenuClick listener = new OnContextMenuClick() { OnContextMenuClick listener = new OnContextMenuClick() {
@Override @Override
@ -208,22 +210,17 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
if (itemId == R.string.layer_map) { if (itemId == R.string.layer_map) {
layers.selectMapLayer(mapView); layers.selectMapLayer(mapView);
} else if(itemId == R.string.layer_overlay){ } else if(itemId == R.string.layer_overlay){
if(overlayLayer.getMap() != null){ mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.OVERLAY_MAP);
settings.MAP_OVERLAY.set(null); return false;
updateMapLayers(mapView, null, layers);
layers.getMapControlsLayer().hideTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY);
} else {
selectMapOverlayLayer(mapView, settings.MAP_OVERLAY, settings.MAP_OVERLAY_TRANSPARENCY, mapActivity);
}
} else if(itemId == R.string.layer_underlay){ } 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 false;
} }
return true; 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(); iconColor(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg();
adapter.item(R.string.layer_underlay) adapter.item(R.string.layer_underlay)
.iconColor(R.drawable.ic_layer_bottom_dark).listen(listener).position(15).reg(); .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}")); ts.getUrlTemplate().replace("{$x}", "{1}").replace("{$y}", "{2}").replace("{$z}", "{0}"));
elliptic.setChecked(ts.isEllipticYTile()); 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<String> 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
}
} }

View file

@ -17,10 +17,7 @@ import android.support.v7.app.AlertDialog;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import net.londatiga.android.ActionItem; import net.londatiga.android.ActionItem;
@ -68,8 +65,6 @@ public class MapControlsLayer extends OsmandMapLayer {
// private RulerControl rulerControl; // private RulerControl rulerControl;
// private List<MapControls> allControls = new ArrayList<MapControls>(); // private List<MapControls> allControls = new ArrayList<MapControls>();
private SeekBar transparencyBar;
private LinearLayout transparencyBarLayout;
private static CommonPreference<Integer> settingsToTransparency; private static CommonPreference<Integer> settingsToTransparency;
private OsmandSettings settings; private OsmandSettings settings;
@ -109,7 +104,6 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override @Override
public void initLayer(final OsmandMapTileView view) { public void initLayer(final OsmandMapTileView view) {
initTopControls(); initTopControls();
initTransparencyBar();
initZooms(); initZooms();
initDasboardRelatedControls(); initDasboardRelatedControls();
updateControls(view.getCurrentRotatedTileBox(), null); updateControls(view.getCurrentRotatedTileBox(), null);
@ -193,6 +187,7 @@ public class MapControlsLayer extends OsmandMapLayer {
configureMap.setOnClickListener(new View.OnClickListener() { configureMap.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
} }
}); });
@ -335,6 +330,7 @@ public class MapControlsLayer extends OsmandMapLayer {
backToMenuButton.setOnClickListener(new View.OnClickListener() { backToMenuButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
MapActivity.clearPrevActivityIntent();
if (dash) { if (dash) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
} else { } else {
@ -381,6 +377,7 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
private void onNavigationClick() { private void onNavigationClick() {
MapActivity.clearPrevActivityIntent();
RoutingHelper routingHelper = mapActivity.getRoutingHelper(); RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
mapActivity.getMapActions().enterRoutePlanningMode(null, null); mapActivity.getMapActions().enterRoutePlanningMode(null, null);
@ -589,58 +586,6 @@ public class MapControlsLayer extends OsmandMapLayer {
return false; 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<Integer> transparenPreference) {
MapControlsLayer.settingsToTransparency = transparenPreference;
transparencyBarLayout.setVisibility(View.VISIBLE);
transparencyBar.setProgress(transparenPreference.get());
}
public void hideTransparencyBar(CommonPreference<Integer> transparentPreference) {
if (settingsToTransparency == transparentPreference) {
transparencyBarLayout.setVisibility(View.GONE);
settingsToTransparency = null;
}
}
private class MapHudButton { private class MapHudButton {
View iv; View iv;
int bgDark; int bgDark;