diff --git a/LICENSE b/LICENSE index 70adfe40b0..61ae46b812 100644 --- a/LICENSE +++ b/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 \ No newline at end of file + - 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 \ No newline at end of file diff --git a/OsmAnd/res/values-da/phrases.xml b/OsmAnd/res/values-da/phrases.xml index bf07141d5a..6c2434a882 100644 --- a/OsmAnd/res/values-da/phrases.xml +++ b/OsmAnd/res/values-da/phrases.xml @@ -5,7 +5,7 @@ Nærbutik Butikscenter Drikkevarer - Kødmarked + Slagter Delikatesse Gårdbutik Grønthandler @@ -201,7 +201,7 @@ Kommunikationstårn Telefoncentral - Genbrugsplads + Genbrug Losseplads Affaldsbortskaffelse Skraldespand @@ -262,7 +262,7 @@ Forskning IT kontor Avisredaktion - Arkitekt + Arkitektkontor Reklamebureau Uddannelsesinstitution Lydstudio @@ -672,8 +672,8 @@ Børnetøj Lejlighed - Offentlig transport stopposition - Jernbane stop + Offentlig transport stoppested + Trinbræt Logi Internetadgang: wlan Internetadgang: terminal @@ -1842,23 +1842,48 @@ Internetadgang: tjeneste Internetadgang: ingen -Maksimale bredde +Max. bredde IATA kode ICAO kode FAA kode - Kunsttype: skulptur - Kunsttype: statue - Kunsttype: vægmaleri - Kunsttype: arkitektur - Kunsttype: maleri - Kunsttype: sten - Kunsttype: buste - Kunsttype: installation - Kunsttype: mosaik - Kunsttype: relief - Kunsttype: graffiti - Kunsttype: stele - Kunsttype: springvand + Kunstværk: skulptur + Kunstværk: statue + Kunstværk: vægmaleri + Kunstværk: arkitektur + Kunstværk: maleri + Kunstværk: sten + Kunstværk: buste + Kunstværk: installation + Kunstværk: mosaik + Kunstværk: relief + Kunstværk: graffiti + Kunstværk: stele + Kunstværk: springvand + +Bredde + + Arkitekt + + Arkitektur: moderne + Arkitektur: stalinistisk nyklassicisme + Arkitektur: eklecticisme + Arkitektur: nye objektivitet + Arkitektur: moderne + Arkitektur: konstruktivisme + Arkitektur: umgebinde + Arkitektur: træskelet + Arkitektur: jugendstil + Arkitektur: nyklassicisme + Arkitektur: victoriansk + Arkitektur: brutalisme + Arkitektur: klassicisme + Arkitektur: gotik + Arkitektur: oldrussian + Arkitektur: barok + Arkitektur: postkonstruktivisme + Arkitektur: wilheminsk stil + Arkitektur: renæssance + Arkitektur: romansk stil diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index ed430d47c0..05005a766f 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -1817,4 +1817,23 @@ Tipo de acceso a Internet: servicio Sin acceso a Internet +Ancho máximo + Código IATA + Código ICAO + Código FAA + + Tipo de obra: escultura + Tipo de obra: estatua + Tipo de obra: mural + Tipo de obra: arquitectura + Tipo de obra: pintura + Tipo de obra: piedra + Tipo de obra: busto + Tipo de obra: instalación + Tipo de obra: mosaico + Tipo de obra: relieve + Tipo de obra: graffiti + Tipo de obra: estela + Tipo de obra: fuente + diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml index 8199f67400..b0ab22aa5f 100644 --- a/OsmAnd/res/values-fr/phrases.xml +++ b/OsmAnd/res/values-fr/phrases.xml @@ -1423,4 +1423,12 @@ Palmier Cyprès Type d\'accès Internet : filaire + Type d\'accès Internet : public + Type d\'accès Internet : service + Type d\'accès Internet : aucun + + Avec livraison + Sans livraison + Livraison uniquement + diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index e79322318d..3784f829eb 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -514,7 +514,7 @@ distanza successiva fermate da passare Distanza itinerario - Trasporto pubblico + Trasporti pubblici Visualizza le fermate di trasporto pubblico sulla mappa Visualizza le fermate del trasporto pubblico Applicazione di navigazione OsmAnd @@ -1791,7 +1791,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Registrato come %1$s Percorsi Dettagli - Trasporto + Trasporti pubblici Altri attributi della mappa Pannello destro Pannello sinistro @@ -2214,4 +2214,5 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Attiva il componente aggiuntivo SRTM In seguito Acquista la versione completa - +Attiva il componente aggiuntivo Boe di segnalazione + diff --git a/OsmAnd/res/values-ku/strings.xml b/OsmAnd/res/values-ku/strings.xml index 32fe8db690..024ac82e3e 100644 --- a/OsmAnd/res/values-ku/strings.xml +++ b/OsmAnd/res/values-ku/strings.xml @@ -12,6 +12,7 @@ Vai vēlaties, lai OsmAnd kopē uz jauno vietu arī savus datu failus? Norādītajā direktorijā nevar veidot Kartes Nu Texe - Milla Bahra - Tomara Ger + Milla Bahre + Tomarkerê Ger + Agahdarî En Qu Mın diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index d99652d1ee..2031fec30f 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -1654,7 +1654,7 @@ Код FAA Тип: скульптура - Тип: statue + Тип: статуя Тип: фреска Тип: архитектура Тип: живопись @@ -1667,4 +1667,28 @@ Тип: стела Тип: фонтан + Ширина + Архитектор + + Архитектурный стиль: модернизм + Архитектурный стиль: сталинский неоклассицизм + Архитектурный стиль: эклектика + Архитектурный стиль: новая вещественность + Архитектурный стиль: современный + Архитектурный стиль: конструктивизм + Архитектурный стиль: umgebinde + Архитектурный стиль: фахверк + Архитектурный стиль: модерн + Архитектурный стиль: неоклассицизм + Архитектурный стиль: викторианский + Архитектурный стиль: брутализм + Архитектурный стиль: классицизм + Архитектурный стиль: готика + Архитектурный стиль: русский (средние века) + Архитектурный стиль: барокко + Архитектурный стиль: постконструктивизм + Архитектурный стиль: вильгельминский + Архитектурный стиль: ренессанс + Архитектурный стиль: романский + \ No newline at end of file diff --git a/OsmAnd/res/values-zh-rTW/phrases.xml b/OsmAnd/res/values-zh-rTW/phrases.xml index fe518d7feb..f43dee6a25 100644 --- a/OsmAnd/res/values-zh-rTW/phrases.xml +++ b/OsmAnd/res/values-zh-rTW/phrases.xml @@ -1643,4 +1643,26 @@ 自動化 無自動化 全方位服務 + 無刷 + 無刷:無 + 洗車:無 + + 飛機燃料站 + 公共浴室 + + 男性 + 禁止男性 + 女性 + 禁止女性 + 室內 + 戶外 + 附洗手間 + 未附洗手間 + 供輪椅進出洗手間:有 + 供輪椅進出洗手間:無 + 洗手間進出:客戶 + 洗手間進出:容許 + 洗手間進出:社區 + 洗手間進出:公共 + diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 6c9f841ff7..26f601b57f 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -1817,4 +1817,29 @@ Artwork type: stele Artwork type: fountain + Width + + Architect + + Architecture: modern + Architecture: stalinist neoclassicism + Architecture: eclectic + Architecture: new objectivity + Architecture: contemporary + Architecture: constructivism + Architecture: umgebinde + Architecture: timber frame + Architecture: art nouveau + Architecture: neoclassicism + Architecture: victorian + Architecture: brutalism + Architecture: classicism + Architecture: gothic + Architecture: oldrussian + Architecture: baroque + Architecture: postconstructivism + Architecture: wilhelminian style + Architecture: renaissance + Architecture: romanesque + diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index df0df1c69f..4e1a359cc5 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -512,6 +512,9 @@ public class DownloadActivity extends BaseDownloadActivity implements RegionDial return downloadListIndexThread != null ? downloadListIndexThread.getIndexFileNames() : null; } + public List getIndexFiles() { + return downloadListIndexThread != null ? downloadListIndexThread.getCachedIndexFiles() : null; + } public void showDialogToDownloadMaps(Collection maps) { int count = 0; diff --git a/OsmAnd/src/net/osmand/plus/download/items/SearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/items/SearchDialogFragment.java new file mode 100644 index 0000000000..99ea08cba6 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/download/items/SearchDialogFragment.java @@ -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; + } +} diff --git a/OsmAnd/src/net/osmand/plus/download/items/SearchItemsFragment.java b/OsmAnd/src/net/osmand/plus/download/items/SearchItemsFragment.java new file mode 100644 index 0000000000..fb17e1f890 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/download/items/SearchItemsFragment.java @@ -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 worldRegions = new LinkedList<>(); + private List indexItems = new LinkedList<>(); + private List 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 worldRegions) { + this.worldRegions.addAll(worldRegions); + } + + public void addIndexItems(List 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> conds = new ArrayList<>(); + for (String or : ors) { + final ArrayList 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 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> conditions, boolean matchByDefault, String text) { + boolean res = matchByDefault; + for (List 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 values = (List) results.values; + if (values != null && !values.isEmpty()) { + items.addAll(values); + } + notifyDataSetChanged(); + } + } + } +}