Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
3110862202
12 changed files with 545 additions and 26 deletions
5
LICENSE
5
LICENSE
|
@ -142,4 +142,7 @@
|
|||
- Rio de Janeiro: "Metrorioicon" by Metrô Rio - http://www.metrorio.com.br/. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:Metrorioicon.png#/media/File:Metrorioicon.png
|
||||
- Montreal: "Montreal Metro" by STM - http://www.stm.info/en-bref/pictometro.htm. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:Montreal_Metro.svg#/media/File:Montreal_Metro.svg
|
||||
- Toronto: "TTC" by Source. Licensed under Fair use via Wikipedia - https://en.wikipedia.org/wiki/File:TTC.svg#/media/File:TTC.svg
|
||||
- Bangkok: "MRT (Bangkok) logo" by Bangkok_Metro_logo.png: Paul_012.Original uploader was Paul 012 at en.wikipediaderivative work: Nevetsjc (talk)Revision traced from http://si0.twimg.com/profile_images/975897559/logo.jpg - Bangkok_Metro_logo.png. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:MRT_(Bangkok)_logo.svg#/media/File:MRT_(Bangkok)_logo.svg
|
||||
- Bangkok: "MRT (Bangkok) logo" by Bangkok_Metro_logo.png: Paul_012.Original uploader was Paul 012 at en.wikipediaderivative work: Nevetsjc (talk)Revision traced from http://si0.twimg.com/profile_images/975897559/logo.jpg - Bangkok_Metro_logo.png. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:MRT_(Bangkok)_logo.svg#/media/File:MRT_(Bangkok)_logo.svg
|
||||
- Rotterdam: "RET metro logo" by Sebastiaan1997 - Own work. Licensed under CC BY-SA 3.0 via Commons - https://commons.wikimedia.org/wiki/File:RET_metro_logo.svg#/media/File:RET_metro_logo.svg
|
||||
- Amsterdam: "Amsterdam metro" by Peeperman - Own work. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:Amsterdam_metro.svg#/media/File:Amsterdam_metro.svg
|
||||
- Brussels: "Brussels Metro logo" by Source. Licensed under Fair use via Wikipedia - https://en.wikipedia.org/wiki/File:Brussels_Metro_logo.svg#/media/File:Brussels_Metro_logo.svg
|
|
@ -5,7 +5,7 @@
|
|||
<string name="poi_convenience">Nærbutik</string>
|
||||
<string name="poi_mall">Butikscenter</string>
|
||||
<string name="poi_beverages">Drikkevarer</string>
|
||||
<string name="poi_butcher">Kødmarked</string>
|
||||
<string name="poi_butcher">Slagter</string>
|
||||
<string name="poi_deli">Delikatesse</string>
|
||||
<string name="poi_farm">Gårdbutik</string>
|
||||
<string name="poi_greengrocer">Grønthandler</string>
|
||||
|
@ -201,7 +201,7 @@
|
|||
<string name="poi_communication_tower">Kommunikationstårn</string>
|
||||
<string name="poi_telephone_exchange">Telefoncentral</string>
|
||||
|
||||
<string name="poi_recycling">Genbrugsplads</string>
|
||||
<string name="poi_recycling">Genbrug</string>
|
||||
<string name="poi_landfill">Losseplads</string>
|
||||
<string name="poi_waste_disposal">Affaldsbortskaffelse</string>
|
||||
<string name="poi_waste_basket">Skraldespand</string>
|
||||
|
@ -262,7 +262,7 @@
|
|||
<string name="poi_research">Forskning</string>
|
||||
<string name="poi_it">IT kontor</string>
|
||||
<string name="poi_newspaper">Avisredaktion</string>
|
||||
<string name="poi_architect">Arkitekt</string>
|
||||
<string name="poi_architect">Arkitektkontor</string>
|
||||
<string name="poi_advertising_agency">Reklamebureau</string>
|
||||
<string name="poi_educational_institution">Uddannelsesinstitution</string>
|
||||
<string name="poi_studio">Lydstudio</string>
|
||||
|
@ -672,8 +672,8 @@
|
|||
<string name="poi_child_clothes">Børnetøj</string>
|
||||
<string name="poi_apartment">Lejlighed</string>
|
||||
|
||||
<string name="poi_public_transport_stop_position">Offentlig transport stopposition</string>
|
||||
<string name="poi_halt">Jernbane stop</string>
|
||||
<string name="poi_public_transport_stop_position">Offentlig transport stoppested</string>
|
||||
<string name="poi_halt">Trinbræt</string>
|
||||
<string name="poi_lodging">Logi</string>
|
||||
<string name="poi_internet_access_wlan">Internetadgang: wlan</string>
|
||||
<string name="poi_internet_access_terminal">Internetadgang: terminal</string>
|
||||
|
@ -1842,23 +1842,48 @@
|
|||
<string name="poi_internet_access_type_service">Internetadgang: tjeneste</string>
|
||||
<string name="poi_internet_access_type_no">Internetadgang: ingen</string>
|
||||
|
||||
<string name="poi_maxwidth">Maksimale bredde</string>
|
||||
<string name="poi_maxwidth">Max. bredde</string>
|
||||
<string name="poi_iata">IATA kode</string>
|
||||
<string name="poi_icao">ICAO kode</string>
|
||||
<string name="poi_faa">FAA kode</string>
|
||||
|
||||
<string name="poi_artwork_type_sculpture">Kunsttype: skulptur</string>
|
||||
<string name="poi_artwork_type_statue">Kunsttype: statue</string>
|
||||
<string name="poi_artwork_type_mural">Kunsttype: vægmaleri</string>
|
||||
<string name="poi_artwork_type_architecture">Kunsttype: arkitektur</string>
|
||||
<string name="poi_artwork_type_painting">Kunsttype: maleri</string>
|
||||
<string name="poi_artwork_type_stone">Kunsttype: sten</string>
|
||||
<string name="poi_artwork_type_bust">Kunsttype: buste</string>
|
||||
<string name="poi_artwork_type_installation">Kunsttype: installation</string>
|
||||
<string name="poi_artwork_type_mosaic">Kunsttype: mosaik</string>
|
||||
<string name="poi_artwork_type_relief">Kunsttype: relief</string>
|
||||
<string name="poi_artwork_type_graffiti">Kunsttype: graffiti</string>
|
||||
<string name="poi_artwork_type_stele">Kunsttype: stele</string>
|
||||
<string name="poi_artwork_type_fountain">Kunsttype: springvand</string>
|
||||
<string name="poi_artwork_type_sculpture">Kunstværk: skulptur</string>
|
||||
<string name="poi_artwork_type_statue">Kunstværk: statue</string>
|
||||
<string name="poi_artwork_type_mural">Kunstværk: vægmaleri</string>
|
||||
<string name="poi_artwork_type_architecture">Kunstværk: arkitektur</string>
|
||||
<string name="poi_artwork_type_painting">Kunstværk: maleri</string>
|
||||
<string name="poi_artwork_type_stone">Kunstværk: sten</string>
|
||||
<string name="poi_artwork_type_bust">Kunstværk: buste</string>
|
||||
<string name="poi_artwork_type_installation">Kunstværk: installation</string>
|
||||
<string name="poi_artwork_type_mosaic">Kunstværk: mosaik</string>
|
||||
<string name="poi_artwork_type_relief">Kunstværk: relief</string>
|
||||
<string name="poi_artwork_type_graffiti">Kunstværk: graffiti</string>
|
||||
<string name="poi_artwork_type_stele">Kunstværk: stele</string>
|
||||
<string name="poi_artwork_type_fountain">Kunstværk: springvand</string>
|
||||
|
||||
<string name="poi_width">Bredde</string>
|
||||
|
||||
<string name="poi_architect_name">Arkitekt</string>
|
||||
|
||||
<string name="poi_architecture_modern">Arkitektur: moderne</string>
|
||||
<string name="poi_architecture_stalinist_neoclassicism">Arkitektur: stalinistisk nyklassicisme</string>
|
||||
<string name="poi_architecture_eclectic">Arkitektur: eklecticisme</string>
|
||||
<string name="poi_architecture_new_objectivity">Arkitektur: nye objektivitet</string>
|
||||
<string name="poi_architecture_contemporary">Arkitektur: moderne</string>
|
||||
<string name="poi_architecture_constructivism">Arkitektur: konstruktivisme</string>
|
||||
<string name="poi_architecture_umgebinde">Arkitektur: umgebinde</string>
|
||||
<string name="poi_architecture_timber_frame">Arkitektur: træskelet</string>
|
||||
<string name="poi_architecture_art_nouveau">Arkitektur: jugendstil</string>
|
||||
<string name="poi_architecture_neoclassicism">Arkitektur: nyklassicisme</string>
|
||||
<string name="poi_architecture_victorian">Arkitektur: victoriansk</string>
|
||||
<string name="poi_architecture_brutalism">Arkitektur: brutalisme</string>
|
||||
<string name="poi_architecture_classicism">Arkitektur: klassicisme</string>
|
||||
<string name="poi_architecture_gothic">Arkitektur: gotik</string>
|
||||
<string name="poi_architecture_oldrussian">Arkitektur: oldrussian</string>
|
||||
<string name="poi_architecture_baroque">Arkitektur: barok</string>
|
||||
<string name="poi_architecture_postconstructivism">Arkitektur: postkonstruktivisme</string>
|
||||
<string name="poi_architecture_wilhelminian_style">Arkitektur: wilheminsk stil</string>
|
||||
<string name="poi_architecture_renaissance">Arkitektur: renæssance</string>
|
||||
<string name="poi_architecture_romanesque">Arkitektur: romansk stil</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1817,4 +1817,23 @@
|
|||
<string name="poi_internet_access_type_service">Tipo de acceso a Internet: servicio</string>
|
||||
<string name="poi_internet_access_type_no">Sin acceso a Internet</string>
|
||||
|
||||
<string name="poi_maxwidth">Ancho máximo</string>
|
||||
<string name="poi_iata">Código IATA</string>
|
||||
<string name="poi_icao">Código ICAO</string>
|
||||
<string name="poi_faa">Código FAA</string>
|
||||
|
||||
<string name="poi_artwork_type_sculpture">Tipo de obra: escultura</string>
|
||||
<string name="poi_artwork_type_statue">Tipo de obra: estatua</string>
|
||||
<string name="poi_artwork_type_mural">Tipo de obra: mural</string>
|
||||
<string name="poi_artwork_type_architecture">Tipo de obra: arquitectura</string>
|
||||
<string name="poi_artwork_type_painting">Tipo de obra: pintura</string>
|
||||
<string name="poi_artwork_type_stone">Tipo de obra: piedra</string>
|
||||
<string name="poi_artwork_type_bust">Tipo de obra: busto</string>
|
||||
<string name="poi_artwork_type_installation">Tipo de obra: instalación</string>
|
||||
<string name="poi_artwork_type_mosaic">Tipo de obra: mosaico</string>
|
||||
<string name="poi_artwork_type_relief">Tipo de obra: relieve</string>
|
||||
<string name="poi_artwork_type_graffiti">Tipo de obra: graffiti</string>
|
||||
<string name="poi_artwork_type_stele">Tipo de obra: estela</string>
|
||||
<string name="poi_artwork_type_fountain">Tipo de obra: fuente</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1423,4 +1423,12 @@
|
|||
<string name="poi_palm">Palmier</string>
|
||||
<string name="poi_cypress">Cyprès</string>
|
||||
<string name="poi_internet_access_type_wired">Type d\'accès Internet : filaire</string>
|
||||
<string name="poi_internet_access_type_public">Type d\'accès Internet : public</string>
|
||||
<string name="poi_internet_access_type_service">Type d\'accès Internet : service</string>
|
||||
<string name="poi_internet_access_type_no">Type d\'accès Internet : aucun</string>
|
||||
|
||||
<string name="poi_delivery_yes">Avec livraison</string>
|
||||
<string name="poi_delivery_no">Sans livraison</string>
|
||||
<string name="poi_delivery_only">Livraison uniquement</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -514,7 +514,7 @@
|
|||
<string name="transport_to_go_before">distanza successiva</string>
|
||||
<string name="transport_stops_to_pass">fermate da passare</string>
|
||||
<string name="transport_route_distance">Distanza itinerario</string>
|
||||
<string name="transport">Trasporto pubblico</string>
|
||||
<string name="transport">Trasporti pubblici</string>
|
||||
<string name="show_transport_over_map_description">Visualizza le fermate di trasporto pubblico sulla mappa</string>
|
||||
<string name="show_transport_over_map">Visualizza le fermate del trasporto pubblico</string>
|
||||
<string name="hello">Applicazione di navigazione OsmAnd</string>
|
||||
|
@ -1791,7 +1791,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="logged_as">Registrato come %1$s</string>
|
||||
<string name="rendering_category_routes">Percorsi</string>
|
||||
<string name="rendering_category_details">Dettagli</string>
|
||||
<string name="rendering_category_transport">Trasporto</string>
|
||||
<string name="rendering_category_transport">Trasporti pubblici</string>
|
||||
<string name="rendering_category_others">Altri attributi della mappa</string>
|
||||
<string name="map_widget_right">Pannello destro</string>
|
||||
<string name="map_widget_left">Pannello sinistro</string>
|
||||
|
@ -2214,4 +2214,5 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="activate_srtm_plugin">Attiva il componente aggiuntivo SRTM</string>
|
||||
<string name="later">In seguito</string>
|
||||
<string name="get_full_version">Acquista la versione completa</string>
|
||||
</resources>
|
||||
<string name="activate_seamarks_plugin">Attiva il componente aggiuntivo Boe di segnalazione</string>
|
||||
</resources>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<string name="application_dir_change_warning3">Vai vēlaties, lai OsmAnd kopē uz jauno vietu arī savus datu failus?</string>
|
||||
<string name="specified_directiory_not_writeable">Norādītajā direktorijā nevar veidot Kartes</string>
|
||||
<string name="favorite_category_add_new">Nu Texe</string>
|
||||
<string name="si_nm">Milla Bahra</string>
|
||||
<string name="shared_string_trip_recording">Tomara Ger</string>
|
||||
<string name="si_nm">Milla Bahre</string>
|
||||
<string name="shared_string_trip_recording">Tomarkerê Ger</string>
|
||||
<string name="favourites_edit_dialog_title">Agahdarî En Qu Mın</string>
|
||||
</resources>
|
||||
|
|
|
@ -1654,7 +1654,7 @@
|
|||
<string name="poi_faa">Код FAA</string>
|
||||
|
||||
<string name="poi_artwork_type_sculpture">Тип: скульптура</string>
|
||||
<string name="poi_artwork_type_statue">Тип: statue</string>
|
||||
<string name="poi_artwork_type_statue">Тип: статуя</string>
|
||||
<string name="poi_artwork_type_mural">Тип: фреска</string>
|
||||
<string name="poi_artwork_type_architecture">Тип: архитектура</string>
|
||||
<string name="poi_artwork_type_painting">Тип: живопись</string>
|
||||
|
@ -1667,4 +1667,28 @@
|
|||
<string name="poi_artwork_type_stele">Тип: стела</string>
|
||||
<string name="poi_artwork_type_fountain">Тип: фонтан</string>
|
||||
|
||||
<string name="poi_width">Ширина</string>
|
||||
<string name="poi_architect_name">Архитектор</string>
|
||||
|
||||
<string name="poi_architecture_modern">Архитектурный стиль: модернизм</string>
|
||||
<string name="poi_architecture_stalinist_neoclassicism">Архитектурный стиль: сталинский неоклассицизм</string>
|
||||
<string name="poi_architecture_eclectic">Архитектурный стиль: эклектика</string>
|
||||
<string name="poi_architecture_new_objectivity">Архитектурный стиль: новая вещественность</string>
|
||||
<string name="poi_architecture_contemporary">Архитектурный стиль: современный</string>
|
||||
<string name="poi_architecture_constructivism">Архитектурный стиль: конструктивизм</string>
|
||||
<string name="poi_architecture_umgebinde">Архитектурный стиль: umgebinde</string>
|
||||
<string name="poi_architecture_timber_frame">Архитектурный стиль: фахверк</string>
|
||||
<string name="poi_architecture_art_nouveau">Архитектурный стиль: модерн</string>
|
||||
<string name="poi_architecture_neoclassicism">Архитектурный стиль: неоклассицизм</string>
|
||||
<string name="poi_architecture_victorian">Архитектурный стиль: викторианский</string>
|
||||
<string name="poi_architecture_brutalism">Архитектурный стиль: брутализм</string>
|
||||
<string name="poi_architecture_classicism">Архитектурный стиль: классицизм</string>
|
||||
<string name="poi_architecture_gothic">Архитектурный стиль: готика</string>
|
||||
<string name="poi_architecture_oldrussian">Архитектурный стиль: русский (средние века)</string>
|
||||
<string name="poi_architecture_baroque">Архитектурный стиль: барокко</string>
|
||||
<string name="poi_architecture_postconstructivism">Архитектурный стиль: постконструктивизм</string>
|
||||
<string name="poi_architecture_wilhelminian_style">Архитектурный стиль: вильгельминский</string>
|
||||
<string name="poi_architecture_renaissance">Архитектурный стиль: ренессанс</string>
|
||||
<string name="poi_architecture_romanesque">Архитектурный стиль: романский</string>
|
||||
|
||||
</resources>
|
|
@ -1643,4 +1643,26 @@
|
|||
<string name="poi_automated_yes">自動化</string>
|
||||
<string name="poi_automated_no">無自動化</string>
|
||||
<string name="poi_full_service_yes">全方位服務</string>
|
||||
<string name="poi_brushless_yes">無刷</string>
|
||||
<string name="poi_brushless_no">無刷:無</string>
|
||||
<string name="poi_car_wash_no">洗車:無</string>
|
||||
|
||||
<string name="poi_aeroway_fuel">飛機燃料站</string>
|
||||
<string name="poi_public_bath">公共浴室</string>
|
||||
|
||||
<string name="poi_male_yes">男性</string>
|
||||
<string name="poi_male_no">禁止男性</string>
|
||||
<string name="poi_female_yes">女性</string>
|
||||
<string name="poi_female_no">禁止女性</string>
|
||||
<string name="poi_indoor_yes">室內</string>
|
||||
<string name="poi_indoor_no">戶外</string>
|
||||
<string name="poi_toilets_yes">附洗手間</string>
|
||||
<string name="poi_toilets_no">未附洗手間</string>
|
||||
<string name="poi_toilets_wheelchair_yes">供輪椅進出洗手間:有</string>
|
||||
<string name="poi_toilets_wheelchair_no">供輪椅進出洗手間:無</string>
|
||||
<string name="poi_toilets_access_customers">洗手間進出:客戶</string>
|
||||
<string name="poi_toilets_access_permissive">洗手間進出:容許</string>
|
||||
<string name="poi_toilets_access_community">洗手間進出:社區</string>
|
||||
<string name="poi_toilets_access_public">洗手間進出:公共</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1817,4 +1817,29 @@
|
|||
<string name="poi_artwork_type_stele">Artwork type: stele</string>
|
||||
<string name="poi_artwork_type_fountain">Artwork type: fountain</string>
|
||||
|
||||
<string name="poi_width">Width</string>
|
||||
|
||||
<string name="poi_architect_name">Architect</string>
|
||||
|
||||
<string name="poi_architecture_modern">Architecture: modern</string>
|
||||
<string name="poi_architecture_stalinist_neoclassicism">Architecture: stalinist neoclassicism</string>
|
||||
<string name="poi_architecture_eclectic">Architecture: eclectic</string>
|
||||
<string name="poi_architecture_new_objectivity">Architecture: new objectivity</string>
|
||||
<string name="poi_architecture_contemporary">Architecture: contemporary</string>
|
||||
<string name="poi_architecture_constructivism">Architecture: constructivism</string>
|
||||
<string name="poi_architecture_umgebinde">Architecture: umgebinde</string>
|
||||
<string name="poi_architecture_timber_frame">Architecture: timber frame</string>
|
||||
<string name="poi_architecture_art_nouveau">Architecture: art nouveau</string>
|
||||
<string name="poi_architecture_neoclassicism">Architecture: neoclassicism</string>
|
||||
<string name="poi_architecture_victorian">Architecture: victorian</string>
|
||||
<string name="poi_architecture_brutalism">Architecture: brutalism</string>
|
||||
<string name="poi_architecture_classicism">Architecture: classicism</string>
|
||||
<string name="poi_architecture_gothic">Architecture: gothic</string>
|
||||
<string name="poi_architecture_oldrussian">Architecture: oldrussian</string>
|
||||
<string name="poi_architecture_baroque">Architecture: baroque</string>
|
||||
<string name="poi_architecture_postconstructivism">Architecture: postconstructivism</string>
|
||||
<string name="poi_architecture_wilhelminian_style">Architecture: wilhelminian style</string>
|
||||
<string name="poi_architecture_renaissance">Architecture: renaissance</string>
|
||||
<string name="poi_architecture_romanesque">Architecture: romanesque</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -512,6 +512,9 @@ public class DownloadActivity extends BaseDownloadActivity implements RegionDial
|
|||
return downloadListIndexThread != null ? downloadListIndexThread.getIndexFileNames() : null;
|
||||
}
|
||||
|
||||
public List<IndexItem> getIndexFiles() {
|
||||
return downloadListIndexThread != null ? downloadListIndexThread.getCachedIndexFiles() : null;
|
||||
}
|
||||
|
||||
public void showDialogToDownloadMaps(Collection<String> maps) {
|
||||
int count = 0;
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package net.osmand.plus.download.items;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
|
||||
public class SearchDialogFragment extends DialogFragment {
|
||||
|
||||
public static final String TAG = "SearchDialogFragment";
|
||||
private static final String SEARCH_TEXT_DLG_KEY = "search_text_dlg_key";
|
||||
private String searchText;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
boolean isLightTheme = ((OsmandApplication) getActivity().getApplication())
|
||||
.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||
setStyle(STYLE_NO_FRAME, themeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.maps_in_category_fragment, container, false);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
searchText = savedInstanceState.getString(SEARCH_TEXT_DLG_KEY);
|
||||
}
|
||||
if (searchText == null) {
|
||||
searchText = getArguments().getString(SEARCH_TEXT_DLG_KEY);
|
||||
}
|
||||
if (searchText == null)
|
||||
searchText = "";
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
Fragment fragment = getChildFragmentManager().findFragmentById(R.id.fragmentContainer);
|
||||
if (fragment == null) {
|
||||
getChildFragmentManager().beginTransaction().add(R.id.fragmentContainer,
|
||||
SearchItemsFragment.createInstance(searchText)).commit();
|
||||
}
|
||||
|
||||
((DownloadActivity) getActivity()).initFreeVersionBanner(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
outState.putString(SEARCH_TEXT_DLG_KEY, searchText);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
public static SearchDialogFragment createInstance(String searchText) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(SEARCH_TEXT_DLG_KEY, searchText);
|
||||
SearchDialogFragment fragment = new SearchDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,307 @@
|
|||
package net.osmand.plus.download.items;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ListView;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.WorldRegion;
|
||||
import net.osmand.plus.download.BaseDownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class SearchItemsFragment extends Fragment {
|
||||
public static final String TAG = "SearchItemsFragment";
|
||||
private static final Log LOG = PlatformUtil.getLog(SearchItemsFragment.class);
|
||||
|
||||
private SearchItemsAdapter listAdapter;
|
||||
|
||||
private static final String SEARCH_TEXT_KEY = "world_region_id_key";
|
||||
private String searchText;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.download_items_fragment, container, false);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
searchText = savedInstanceState.getString(SEARCH_TEXT_KEY);
|
||||
}
|
||||
if (searchText == null) {
|
||||
searchText = getArguments().getString(SEARCH_TEXT_KEY);
|
||||
}
|
||||
|
||||
if (searchText == null)
|
||||
searchText = "";
|
||||
|
||||
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
||||
listAdapter = new SearchItemsAdapter(getActivity());
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
doItemClick(view, position);
|
||||
}
|
||||
});
|
||||
|
||||
fillSearchItemsAdapter();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
outState.putString(SEARCH_TEXT_KEY, searchText);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
public boolean doItemClick(View view, int position) {
|
||||
Object obj = listAdapter.getItem(position);
|
||||
if (obj instanceof WorldRegion) {
|
||||
WorldRegion region = (WorldRegion) obj;
|
||||
getDownloadActivity().showDialog(getActivity(), RegionDialogFragment.createInstance(region.getRegionId()));
|
||||
return true;
|
||||
} else if (obj instanceof ItemsListBuilder.ResourceItem) {
|
||||
if (((ItemViewHolder) view.getTag()).isItemAvailable()) {
|
||||
IndexItem indexItem = ((ItemsListBuilder.ResourceItem) obj).getIndexItem();
|
||||
((BaseDownloadActivity) getActivity()).startDownload(indexItem);
|
||||
return true;
|
||||
}
|
||||
} else if (obj instanceof IndexItem) {
|
||||
if (((ItemViewHolder) view.getTag()).isItemAvailable()) {
|
||||
IndexItem indexItem = (IndexItem) obj;
|
||||
((BaseDownloadActivity) getActivity()).startDownload(indexItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
private void fillSearchItemsAdapter() {
|
||||
if (listAdapter != null) {
|
||||
listAdapter.clear();
|
||||
listAdapter.addWorldRegions(getMyApplication().getWorldRegion().getFlattenedSubregions());
|
||||
listAdapter.addIndexItems(getDownloadActivity().getIndexFiles());
|
||||
}
|
||||
}
|
||||
|
||||
private DownloadActivity getDownloadActivity() {
|
||||
return (DownloadActivity) getActivity();
|
||||
}
|
||||
|
||||
public static SearchItemsFragment createInstance(String regionId) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(SEARCH_TEXT_KEY, regionId);
|
||||
SearchItemsFragment fragment = new SearchItemsFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
private class SearchItemsAdapter extends BaseAdapter implements Filterable {
|
||||
|
||||
private SearchIndexFilter mFilter;
|
||||
|
||||
private List<WorldRegion> worldRegions = new LinkedList<>();
|
||||
private List<IndexItem> indexItems = new LinkedList<>();
|
||||
private List<Object> items = new LinkedList<>();
|
||||
|
||||
private OsmandRegions osmandRegions;
|
||||
|
||||
private boolean srtmDisabled;
|
||||
private boolean nauticalPluginDisabled;
|
||||
private boolean freeVersion;
|
||||
|
||||
public SearchItemsAdapter(Context ctx) {
|
||||
osmandRegions = getMyApplication().getResourceManager().getOsmandRegions();
|
||||
srtmDisabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) == null;
|
||||
nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
|
||||
freeVersion = Version.isFreeVersion(getMyApplication());
|
||||
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
||||
ta.recycle();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
worldRegions.clear();
|
||||
indexItems.clear();
|
||||
items.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addWorldRegions(List<WorldRegion> worldRegions) {
|
||||
this.worldRegions.addAll(worldRegions);
|
||||
}
|
||||
|
||||
public void addIndexItems(List<IndexItem> indexItems) {
|
||||
this.indexItems.addAll(indexItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return items.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
final Object item = getItem(position);
|
||||
|
||||
ItemViewHolder viewHolder;
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.two_line_with_images_list_item, parent, false);
|
||||
viewHolder = new ItemViewHolder(convertView);
|
||||
convertView.setTag(viewHolder);
|
||||
} else {
|
||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||
}
|
||||
viewHolder.setSrtmDisabled(srtmDisabled);
|
||||
viewHolder.setNauticalPluginDisabled(nauticalPluginDisabled);
|
||||
viewHolder.setFreeVersion(freeVersion);
|
||||
|
||||
if (item instanceof WorldRegion) {
|
||||
viewHolder.bindRegion((WorldRegion) item, getDownloadActivity());
|
||||
} else if (item instanceof IndexItem) {
|
||||
viewHolder.bindIndexItem((IndexItem) item, getDownloadActivity(), false, true);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Item must be of type WorldRegion or " +
|
||||
"IndexItem but is of type:" + item.getClass());
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
if (mFilter == null) {
|
||||
mFilter = new SearchIndexFilter();
|
||||
}
|
||||
return mFilter;
|
||||
}
|
||||
|
||||
private final class SearchIndexFilter extends Filter {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
FilterResults results = new FilterResults();
|
||||
if (constraint == null || constraint.length() == 0) {
|
||||
results.values = new ArrayList<>();
|
||||
results.count = 0;
|
||||
} else {
|
||||
String[] ors = constraint.toString().split(",");
|
||||
List<List<String>> conds = new ArrayList<>();
|
||||
for (String or : ors) {
|
||||
final ArrayList<String> cond = new ArrayList<>();
|
||||
for (String term : or.split("\\s")) {
|
||||
final String t = term.trim().toLowerCase();
|
||||
if (t.length() > 0) {
|
||||
cond.add(t);
|
||||
}
|
||||
}
|
||||
if (cond.size() > 0) {
|
||||
conds.add(cond);
|
||||
}
|
||||
}
|
||||
List<Object> filter = new ArrayList<>();
|
||||
Context c = getDownloadActivity();
|
||||
|
||||
for (WorldRegion region : worldRegions) {
|
||||
String indexLC = region.getName();
|
||||
if (isMatch(conds, false, indexLC)) {
|
||||
filter.add(region);
|
||||
}
|
||||
}
|
||||
|
||||
for (IndexItem item : indexItems) {
|
||||
String indexLC = osmandRegions.getDownloadNameIndexLowercase(item.getBasename());
|
||||
if (indexLC == null) {
|
||||
indexLC = item.getVisibleName(c, osmandRegions).toLowerCase();
|
||||
}
|
||||
if (isMatch(conds, false, indexLC)) {
|
||||
filter.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
results.values = filter;
|
||||
results.count = filter.size();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private boolean isMatch(List<List<String>> conditions, boolean matchByDefault, String text) {
|
||||
boolean res = matchByDefault;
|
||||
for (List<String> or : conditions) {
|
||||
boolean tadd = true;
|
||||
for (String var : or) {
|
||||
if (!text.contains(var)) {
|
||||
tadd = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tadd) {
|
||||
res = false;
|
||||
} else {
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
List<Object> values = (List<Object>) results.values;
|
||||
if (values != null && !values.isEmpty()) {
|
||||
items.addAll(values);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue