diff --git a/OsmAnd/res/layout/download.xml b/OsmAnd/res/layout/download.xml
index 38b87c4128..0ff5197066 100644
--- a/OsmAnd/res/layout/download.xml
+++ b/OsmAnd/res/layout/download.xml
@@ -110,7 +110,7 @@
android:gravity="center"/>
Дом
Сябры
Месцы
- Іншае
+ Іншае
Назва
Катэгорыя
Не, дзякуй
diff --git a/OsmAnd/res/values-bg/strings.xml b/OsmAnd/res/values-bg/strings.xml
index 0dded3f643..8240906810 100644
--- a/OsmAnd/res/values-bg/strings.xml
+++ b/OsmAnd/res/values-bg/strings.xml
@@ -947,7 +947,7 @@ OsmAnd е с отворен код и активно да се развива.
Дом
Приятели
Места
- Други
+ Други
Име
Категория
Не, благодаря
diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml
index 506f2f868a..f8e5ae0120 100644
--- a/OsmAnd/res/values-ca/strings.xml
+++ b/OsmAnd/res/values-ca/strings.xml
@@ -302,7 +302,7 @@
S\'ha suprimit amb èxit el(s) punt(s) preferit(s).
Amics
Llocs
-Altres
+Altres
Nom
Categoria
diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml
index af3bd0b5ea..6de4bdc6b2 100644
--- a/OsmAnd/res/values-cs/strings.xml
+++ b/OsmAnd/res/values-cs/strings.xml
@@ -253,7 +253,7 @@
Doma
Přátelé
Místa
- Ostatní
+ Ostatní
Není potřeba
Chybí základní mapa světa. Prosím stáhněte ji pro správnou funkci programu.
Na SD kartě nejsou uložena žádná offline data. Prosím stáhněte je pro použití map v offline módu.
diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml
index 63fe99a01c..e42411059f 100644
--- a/OsmAnd/res/values-da/strings.xml
+++ b/OsmAnd/res/values-da/strings.xml
@@ -554,7 +554,7 @@
Hjem
Venner
Steder
- Andre
+ Andre
Navn
Kategori
Nej tak
diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml
index fc07a9138f..1be506b3ac 100644
--- a/OsmAnd/res/values-de/strings.xml
+++ b/OsmAnd/res/values-de/strings.xml
@@ -619,7 +619,7 @@
Zu Hause
Freunde
Sehenswertes
- Andere
+ Andere
Name
Kategorie
Nicht verwendet
diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml
index 5607cbeb6b..98e0060242 100644
--- a/OsmAnd/res/values-es-rAR/strings.xml
+++ b/OsmAnd/res/values-es-rAR/strings.xml
@@ -1434,7 +1434,7 @@
Inicio
Amigos
Lugares
- Otros
+ Otros
Nombre
Categoría
No, gracias
diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml
index 617a51d714..20c867ec2d 100644
--- a/OsmAnd/res/values-es/strings.xml
+++ b/OsmAnd/res/values-es/strings.xml
@@ -183,7 +183,7 @@
Inicio
Amigos
Lugares
- Otros
+ Otros
Nombre
Categoría
No, gracias
diff --git a/OsmAnd/res/values-fi/strings.xml b/OsmAnd/res/values-fi/strings.xml
index ba1d4774bb..3626287218 100644
--- a/OsmAnd/res/values-fi/strings.xml
+++ b/OsmAnd/res/values-fi/strings.xml
@@ -217,7 +217,7 @@
Koti
Ystävät
Paikat
- Muut
+ Muut
Nimi
Kategoria
Ei kiitos
diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml
index 5be06bb172..7115a58147 100644
--- a/OsmAnd/res/values-fr/strings.xml
+++ b/OsmAnd/res/values-fr/strings.xml
@@ -178,7 +178,7 @@
Domicile
Amis
Lieux
- Autres
+ Autres
Pas nécessaire
La carte mondiale de base est absente (couvrant le monde entier à faible zoom). Pensez à télécharger World_basemap_x.obf pour avoir un environnement complet.
Il n\'y a pas de cartes (\'hors-ligne\') sur la carte SD. Pensez à en télécharger pour utiliser OsmAnd hors-ligne.
diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml
index c598ad3e44..b276ea5fc9 100644
--- a/OsmAnd/res/values-hu/strings.xml
+++ b/OsmAnd/res/values-hu/strings.xml
@@ -232,7 +232,7 @@
Család
Barátok
Helyek
- Egyéb
+ Egyéb
Név
Kategória
Nem szükséges
diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml
index f622e4254a..508e6474be 100644
--- a/OsmAnd/res/values-it/strings.xml
+++ b/OsmAnd/res/values-it/strings.xml
@@ -168,7 +168,7 @@
Casa
Amici
Luoghi
- Altro
+ Altro
No, grazie
La mappa di base del mondo (ricopre l\'intero mondo per zoom bassi) è mancante. Puoi scaricare World_basemap_x.obf per un sistema completo.
Mancano i dati (\'offline\') nella scheda SD. Ti consigliamo di scaricarli per poter usare le mappe offline.
diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml
index 058a93e04e..ac81612133 100644
--- a/OsmAnd/res/values-ja/strings.xml
+++ b/OsmAnd/res/values-ja/strings.xml
@@ -1236,7 +1236,7 @@ POIの更新は利用できません
自宅
友人宅
場所
- その他
+ その他
名前
カテゴリー
必要ありません
diff --git a/OsmAnd/res/values-ko/strings.xml b/OsmAnd/res/values-ko/strings.xml
index 12cad25f38..ae64712f13 100644
--- a/OsmAnd/res/values-ko/strings.xml
+++ b/OsmAnd/res/values-ko/strings.xml
@@ -262,7 +262,7 @@
집
친구
장소
- 기타
+ 기타
이름
카테고리
diff --git a/OsmAnd/res/values-lt/strings.xml b/OsmAnd/res/values-lt/strings.xml
index c02b534ee8..8201777320 100644
--- a/OsmAnd/res/values-lt/strings.xml
+++ b/OsmAnd/res/values-lt/strings.xml
@@ -369,7 +369,7 @@
Namai
Draugai
Vietos
- Kitos
+ Kitos
Pavadinimas
Kategorija
Ačiū, ne
diff --git a/OsmAnd/res/values-lv/strings.xml b/OsmAnd/res/values-lv/strings.xml
index 20fcaf7bcf..509e89d151 100644
--- a/OsmAnd/res/values-lv/strings.xml
+++ b/OsmAnd/res/values-lv/strings.xml
@@ -239,7 +239,7 @@
Mājas
Draugi
Vietas
- Pārējais
+ Pārējais
Nosaukums
Kategorija
Nē, paldies
diff --git a/OsmAnd/res/values-mr/strings.xml b/OsmAnd/res/values-mr/strings.xml
index 4f33a941ec..cfb1b7960f 100644
--- a/OsmAnd/res/values-mr/strings.xml
+++ b/OsmAnd/res/values-mr/strings.xml
@@ -125,7 +125,7 @@
घर
मित्र
ठिकाणे
- इतर
+ इतर
नाव
वर्गीकरण
नाही, धन्यवाद
diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml
index d5f5ab30dc..883a1d033d 100644
--- a/OsmAnd/res/values-pl/strings.xml
+++ b/OsmAnd/res/values-pl/strings.xml
@@ -72,7 +72,7 @@
Dom
Znajomi
Miejsca
- Inne
+ Inne
Niepotrzebne
Podstawowa mapa świata jest niezainstalowana. Pobierz plik World_basemap_x.obf.
Brak danych (\'offline\') w urządzeniu na karcie SD. Musisz je najpierw pobrać, by używać map offline.
diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml
index 8728b311b9..c26fb99011 100644
--- a/OsmAnd/res/values-pt-rBR/strings.xml
+++ b/OsmAnd/res/values-pt-rBR/strings.xml
@@ -1263,7 +1263,7 @@
Você apagará %1$d favorito(s) e %2$d grupo(s) favorito(s). Continuar?
Amigos
Lugares
- Outros
+ Outros
Nome
Categoria
Não, obrigado
diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index d63e622c17..8d11f33b0b 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -301,7 +301,7 @@
Дом
Друзья
Места
- Другое
+ Другое
Не нужно
Отсутствует базовая карта, покрывающая весь мир на мелком масштабе. Пожалуйста загрузите World_basemap_x.obf для полноценный работы приложения.
Локальные данные отсутствуют на SD-карте. Пожалуйста, загрузите их для того, чтобы использовать приложение без Интернета.
diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml
index 4068d34caa..fa26a46e7c 100644
--- a/OsmAnd/res/values-sc/strings.xml
+++ b/OsmAnd/res/values-sc/strings.xml
@@ -1151,7 +1151,7 @@
Domo
Amigos
Logos
- Àteru
+ Àteru
Nùmene
Categoria
No, gràtzias
diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml
index 98921cd6b5..2fcb8c752c 100644
--- a/OsmAnd/res/values-sk/strings.xml
+++ b/OsmAnd/res/values-sk/strings.xml
@@ -347,7 +347,7 @@
Doma
Priatelia
Miesta
- Iné
+ Iné
Netreba
Chýba základná mapa sveta(World Basemap). Prosím, zvážte jej stiahnutie pre správnu funkčnosť.
Na SD karte chýbajú offline údaje. Prosím, zvážte ich stiahnutie pre použitie máp bez internetu.
diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml
index f3b86869db..047fbf9b17 100644
--- a/OsmAnd/res/values-sl/strings.xml
+++ b/OsmAnd/res/values-sl/strings.xml
@@ -508,7 +508,7 @@
Naslovi prijateljev
Naziv
Skupina
- Druge točke
+ Druge točke
Domači naslovi
Priljubljeni kraji
Izbrisane bodo priljubljene točke (%1$d) in skupine (%2$d). Ali ste prepričani, da želite nadaljevati?
diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml
index f915c81c29..b6101f8c33 100644
--- a/OsmAnd/res/values-sr/strings.xml
+++ b/OsmAnd/res/values-sr/strings.xml
@@ -273,7 +273,7 @@
Омиљена тачка(е) је успешно избрисана.
Пријатељи
Места
- Остало
+ Остало
Име
Врста
Не, хвала
diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml
index fdb4a438a1..f8834fdb8f 100644
--- a/OsmAnd/res/values-sv/strings.xml
+++ b/OsmAnd/res/values-sv/strings.xml
@@ -434,7 +434,7 @@
Hem
Vänner
Platser
-Annat
+Annat
Namn
Kategori
Nej, tack
diff --git a/OsmAnd/res/values-vi/strings.xml b/OsmAnd/res/values-vi/strings.xml
index c0f91803d7..4ed69d08a8 100644
--- a/OsmAnd/res/values-vi/strings.xml
+++ b/OsmAnd/res/values-vi/strings.xml
@@ -66,7 +66,7 @@ Translator: Le Viet Thanh; email: lethanhx2k@gmail.com -->
Nhà
Bạn bè
Địa điểm
- Khác
+ Khác
Không cần
Bản đồ nền (bao phủ toàn bộ thế giới ở tỉ lệ xem nhỏ) bị thiếu. Hãy tải về tập tin World_basemap_x.obf để bổ sung đầy đủ.
diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml
index 62724510f5..ad6bfbedc5 100644
--- a/OsmAnd/res/values-zh-rTW/strings.xml
+++ b/OsmAnd/res/values-zh-rTW/strings.xml
@@ -427,7 +427,7 @@
住家
朋友
地點
- 其它
+ 其它
名稱
類別
不需要,謝謝
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 092d47e26d..7bb36f80d2 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -1468,7 +1468,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
Home
Friends
Places
- Others
+ Others
Name
Category
No, thanks
diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
index 7f1e176208..0b396b7ff2 100644
--- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
+++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
@@ -559,7 +559,7 @@ public class FavouritesDbHelper {
addEmptyCategory(context.getString(R.string.favorite_home_category));
addEmptyCategory(context.getString(R.string.favorite_friends_category));
addEmptyCategory(context.getString(R.string.favorite_places_category));
- addEmptyCategory(context.getString(R.string.favorite_default_category));
+ addEmptyCategory(context.getString(R.string.shared_string_others));
}
private FavoriteGroup getOrCreateGroup(FavouritePoint p, int defColor) {
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
index c2b410041a..f607aff73d 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
@@ -142,7 +142,7 @@ public class DownloadActivity extends BaseDownloadActivity {
}
});
- findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener() {
+ findViewById(R.id.downloadButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -150,7 +150,7 @@ public class DownloadActivity extends BaseDownloadActivity {
}
});
- findViewById(R.id.WikiButton).setOnClickListener(new View.OnClickListener() {
+ findViewById(R.id.wikiButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -423,7 +423,7 @@ public class DownloadActivity extends BaseDownloadActivity {
} else {
BasicProgressAsyncTask, ?, ?> task = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
boolean running = task instanceof DownloadIndexesThread.DownloadIndexesAsyncTask;
- ((Button) findViewById(R.id.DownloadButton)).setEnabled(!running);
+ ((Button) findViewById(R.id.downloadButton)).setEnabled(!running);
String text;
int downloads = DownloadActivity.downloadListIndexThread.getDownloads();
if (!running) {
@@ -441,9 +441,9 @@ public class DownloadActivity extends BaseDownloadActivity {
text += " (" + (excessLimit ? "! " : "") + getString(R.string.files_limit, left).toLowerCase() + ")";
}
}
- ((Button) findViewById(R.id.DownloadButton)).setText(text);
+ ((Button) findViewById(R.id.downloadButton)).setText(text);
List wikipediaItems = getWikipediaItems();
- findViewById(R.id.WikiButton).setVisibility(wikipediaItems.size() == 0 ? View.GONE : View.VISIBLE);
+ findViewById(R.id.wikiButton).setVisibility(wikipediaItems.size() == 0 ? View.GONE : View.VISIBLE);
}
for (WeakReference ref : fragList) {
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java
index c3d4cb5add..0f2775d967 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java
@@ -251,9 +251,8 @@ public class DownloadActivityType implements Parcelable {
}
public String getVisibleName(IndexItem indexItem, Context ctx, OsmandRegions osmandRegions) {
- String fileName = indexItem.fileName;
-
if (this == VOICE_FILE) {
+ String fileName = indexItem.fileName;
if (fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP)) {
return FileNameTranslationHelper.getVoiceName(ctx, getBasename(indexItem));
} else if (fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) {
@@ -265,9 +264,9 @@ public class DownloadActivityType implements Parcelable {
if (bn.endsWith(FileNameTranslationHelper.WIKI_NAME)){
return FileNameTranslationHelper.getWikiName(ctx,bn);
}
- if (bn.startsWith(FileNameTranslationHelper.HILL_SHADE)){
- return FileNameTranslationHelper.getHillShadeName(ctx, osmandRegions, bn);
- }
+// if (this == HILLSHADE_FILE){
+// return FileNameTranslationHelper.getHillShadeName(ctx, osmandRegions, bn);
+// }
final String lc = bn.toLowerCase();
String std = FileNameTranslationHelper.getStandardMapName(ctx, lc);
if (std != null) {
@@ -334,8 +333,12 @@ public class DownloadActivityType implements Parcelable {
if (fileName.endsWith(IndexConstants.EXTRA_ZIP_EXT)) {
return fileName.substring(0, fileName.length() - IndexConstants.EXTRA_ZIP_EXT.length());
}
+ if (this == HILLSHADE_FILE) {
+ return fileName.substring(0, fileName.length() - IndexConstants.SQLITE_EXT.length())
+ .replace(FileNameTranslationHelper.HILL_SHADE, "");
+ }
if (fileName.endsWith(IndexConstants.SQLITE_EXT)) {
- return fileName.substring(0, fileName.length() - IndexConstants.SQLITE_EXT.length()).replace('_', ' ');
+ return fileName.substring(0, fileName.length() - IndexConstants.SQLITE_EXT.length());
}
if (this == VOICE_FILE) {
int l = fileName.lastIndexOf('_');
@@ -359,7 +362,6 @@ public class DownloadActivityType implements Parcelable {
return fileName;
}
-
@Override
public int describeContents() {
return 0;
diff --git a/OsmAnd/src/net/osmand/plus/download/newimplementation/IndexItemCategoryWithSubcat.java b/OsmAnd/src/net/osmand/plus/download/newimplementation/IndexItemCategoryWithSubcat.java
index 1b7610fd34..66851bfa55 100644
--- a/OsmAnd/src/net/osmand/plus/download/newimplementation/IndexItemCategoryWithSubcat.java
+++ b/OsmAnd/src/net/osmand/plus/download/newimplementation/IndexItemCategoryWithSubcat.java
@@ -132,10 +132,7 @@ public class IndexItemCategoryWithSubcat implements Comparable() {
- @Override
- public int compare(IndexItem lhs, IndexItem rhs) {
- return collator.compare(lhs.getVisibleName(ctx, osmandRegions),
- rhs.getVisibleName(ctx, osmandRegions));
- }
- });
+ sortIndexItemCategoryWithSybcat(category, ctx, osmandRegions, collator);
}
Collections.sort(mainList);
return mainList;
}
+ private static void sortIndexItemCategoryWithSybcat(final IndexItemCategoryWithSubcat category,
+ final OsmandApplication context,
+ final OsmandRegions osmandRegions,
+ final Collator collator) {
+ if (category.subcats.size() > 0) {
+ Collections.sort(category.subcats, new Comparator() {
+ @Override
+ public int compare(IndexItemCategoryWithSubcat lhs, IndexItemCategoryWithSubcat rhs) {
+ return collator.compare(lhs.getName(), rhs.getName());
+ }
+ });
+ for (IndexItemCategoryWithSubcat subcat : category.subcats) {
+ sortIndexItemCategoryWithSybcat(subcat, context, osmandRegions, collator);
+ }
+ }
+ Collections.sort(category.items, new Comparator() {
+ @Override
+ public int compare(IndexItem lhs, IndexItem rhs) {
+ return collator.compare(lhs.getVisibleName(context, osmandRegions),
+ rhs.getVisibleName(context, osmandRegions));
+ }
+ });
+ }
+
@Override
public String getName() {
return categoryStaticData.getName();
diff --git a/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java b/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java
index 505b45807f..343e1f23de 100644
--- a/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java
@@ -12,6 +12,7 @@ import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.HasName;
@@ -62,6 +63,7 @@ public class MapsInCategoryFragment extends DialogFragment {
public void onIndexItemSelected(@NonNull IndexItem indexItem) {
LOG.debug("onIndexItemSelected()");
+ ((DownloadActivity) getActivity()).startDownload(indexItem);
}
public static MapsInCategoryFragment createInstance(
diff --git a/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java b/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java
index 145cb42e59..84a326305d 100644
--- a/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java
@@ -16,18 +16,16 @@ import android.widget.ListView;
import android.widget.TextView;
import net.osmand.PlatformUtil;
-import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.HasName;
import org.apache.commons.logging.Log;
-import java.util.Comparator;
-
public class SubcategoriesFragment extends Fragment {
private static final Log LOG = PlatformUtil.getLog(SubcategoriesFragment.class);
private static final String CATEGORY = "category";
@@ -40,17 +38,10 @@ public class SubcategoriesFragment extends Fragment {
ListView listView = new ListView(getActivity());
final OsmandApplication application = (OsmandApplication) getActivity().getApplication();
- final MapFilesAdapter mAdapter = new MapFilesAdapter(getActivity(),
- application.getIconsCache(), application);
+ final MapFilesAdapter mAdapter = new MapFilesAdapter(getActivity());
listView.setAdapter(mAdapter);
mAdapter.addAll(category.items);
mAdapter.addAll(category.subcats);
- mAdapter.sort(new Comparator() {
- @Override
- public int compare(HasName lhs, HasName rhs) {
- return lhs.getName().compareTo(rhs.getName());
- }
- });
View freeVersionBanner = inflater.inflate(R.layout.free_version_banner, listView, false);
final OsmandSettings settings = application.getSettings();
@@ -84,14 +75,8 @@ public class SubcategoriesFragment extends Fragment {
private static class MapFilesAdapter extends ArrayAdapter {
-
- private final IconsCache iconsCache;
- private final OsmandApplication application;
-
- public MapFilesAdapter(Context context, IconsCache iconsCache, OsmandApplication application) {
+ public MapFilesAdapter(Context context) {
super(context, R.layout.two_line_with_images_list_item);
- this.iconsCache = iconsCache;
- this.application = application;
}
@Override
@@ -100,44 +85,17 @@ public class SubcategoriesFragment extends Fragment {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.two_line_with_images_list_item, parent, false);
- viewHolder = new ViewHolder();
- viewHolder.nameTextView = (TextView) convertView.findViewById(R.id.name);
- viewHolder.descrTextView = (TextView) convertView.findViewById(R.id.description);
- viewHolder.leftImageView = (ImageView) convertView.findViewById(R.id.leftIcon);
- viewHolder.rightImageView = (ImageView) convertView.findViewById(R.id.rightIcon);
+ viewHolder = new ViewHolder(convertView);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
HasName item = getItem(position);
if (item instanceof IndexItemCategoryWithSubcat) {
- IndexItemCategoryWithSubcat category = (IndexItemCategoryWithSubcat) item;
- viewHolder.nameTextView.setText(category.getName());
- if (category.types.size() > 0) {
- StringBuilder stringBuilder = new StringBuilder();
- Resources resources = getContext().getResources();
- for (Integer mapType : category.types) {
- stringBuilder.append(resources.getString(mapType));
- stringBuilder.append(", ");
- }
- stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.capacity());
- viewHolder.descrTextView.setText(stringBuilder.toString());
- } else {
- // TODO replace with string constant
- viewHolder.descrTextView.setText("Others");
- }
- viewHolder.leftImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_map));
- LOG.debug("category.types=" + category.types);
+ viewHolder.bindCategory((IndexItemCategoryWithSubcat) item,
+ (DownloadActivity)getContext());
} else if (item instanceof IndexItem) {
- IndexItem indexItem = (IndexItem) item;
- if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
- viewHolder.nameTextView.setText(indexItem.getVisibleName(getContext(),
- application.getRegions()));
- } else {
- viewHolder.nameTextView.setText(indexItem.getType().getString(getContext()));
- }
- viewHolder.descrTextView.setText(indexItem.getSizeDescription(getContext()));
- viewHolder.leftImageView.setImageResource(indexItem.getType().getIconResource());
+ viewHolder.bindIndexItem((IndexItem) item, (DownloadActivity) getContext());
} else {
throw new IllegalArgumentException("Item must be of type IndexItem or " +
"IndexItemCategory but is of type:" + item.getClass());
@@ -149,7 +107,45 @@ public class SubcategoriesFragment extends Fragment {
TextView nameTextView;
TextView descrTextView;
ImageView leftImageView;
- ImageView rightImageView;
+ ImageView rightImageButton;
+
+ public ViewHolder(View convertView) {
+ nameTextView = (TextView) convertView.findViewById(R.id.name);
+ descrTextView = (TextView) convertView.findViewById(R.id.description);
+ leftImageView = (ImageView) convertView.findViewById(R.id.leftImageView);
+ rightImageButton = (ImageView) convertView.findViewById(R.id.rightImageButton);
+ }
+
+ public void bindIndexItem(IndexItem indexItem, DownloadActivity context) {
+ if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
+ nameTextView.setText(indexItem.getVisibleName(context,
+ context.getMyApplication().getRegions()));
+ } else {
+ nameTextView.setText(indexItem.getType().getString(context));
+ }
+ descrTextView.setText(indexItem.getSizeDescription(context));
+ leftImageView.setImageDrawable(context.getMyApplication()
+ .getIconsCache().getContentIcon(indexItem.getType().getIconResource()));
+ }
+
+ public void bindCategory(IndexItemCategoryWithSubcat category,
+ DownloadActivity context) {
+ nameTextView.setText(category.getName());
+ if (category.types.size() > 0) {
+ StringBuilder stringBuilder = new StringBuilder();
+ Resources resources = context.getResources();
+ for (Integer mapType : category.types) {
+ stringBuilder.append(resources.getString(mapType));
+ stringBuilder.append(", ");
+ }
+ stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.capacity());
+ descrTextView.setText(stringBuilder.toString());
+ } else {
+ descrTextView.setText(R.string.shared_string_others);
+ }
+ leftImageView.setImageDrawable(context.getMyApplication()
+ .getIconsCache().getContentIcon(R.drawable.ic_map));
+ }
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java b/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java
index 4bb492f2bf..b672691dd6 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/FileNameTranslationHelper.java
@@ -1,10 +1,14 @@
package net.osmand.plus.helpers;
import android.content.Context;
+
import net.osmand.IndexConstants;
+import net.osmand.PlatformUtil;
import net.osmand.map.OsmandRegions;
import net.osmand.plus.R;
+import org.apache.commons.logging.Log;
+
import java.lang.reflect.Field;
/**
@@ -12,9 +16,9 @@ import java.lang.reflect.Field;
* on 07.07.2014.
*/
public class FileNameTranslationHelper {
-
+ private static final Log LOG = PlatformUtil.getLog(FileNameTranslationHelper.class);
public static final String WIKI_NAME = "_wiki";
- public static final String HILL_SHADE = "Hillshade";
+ public static final String HILL_SHADE = "Hillshade_";
public static String getFileName(Context ctx, OsmandRegions regions, String fileName) {
String basename = getBasename(fileName);
@@ -51,10 +55,8 @@ public class FileNameTranslationHelper {
}
public static String getHillShadeName(Context ctx, OsmandRegions regions, String basename) {
- String intermName = basename.replace(HILL_SHADE,"");
String hillsh = ctx.getString(R.string.download_hillshade_item) + " ";
-
- String locName = regions.getLocaleName(intermName.trim().replace(" ", "_"));
+ String locName = regions.getLocaleName(basename.trim());
return hillsh + locName;
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/HasName.java b/OsmAnd/src/net/osmand/plus/helpers/HasName.java
index 8f58c96568..20d018d6db 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/HasName.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/HasName.java
@@ -1,5 +1,6 @@
package net.osmand.plus.helpers;
public interface HasName {
+ @Deprecated
String getName();
}