Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ca5586b41d
5 changed files with 47 additions and 21 deletions
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="hillshade_layer_disabled">Hillshade layer disabled</string>
|
||||
<string name="srtm_plugin_disabled">Contour lines disabled</string>
|
||||
<string name="favorite_category_add_new">Add new</string>
|
||||
<string name="favorite_category_select">Select category</string>
|
||||
|
|
|
@ -30,35 +30,41 @@ public class DownloadActivityType implements Parcelable {
|
|||
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
private static Map<String, DownloadActivityType> byTag = new HashMap<>();
|
||||
|
||||
public static final DownloadActivityType NORMAL_FILE = new DownloadActivityType(R.string.download_regular_maps, "map");
|
||||
public static final DownloadActivityType NORMAL_FILE =
|
||||
new DownloadActivityType(R.string.download_regular_maps, "map", 10);
|
||||
public static final DownloadActivityType VOICE_FILE =
|
||||
new DownloadActivityType(R.string.voices, R.drawable.ic_action_volume_up, "voice");
|
||||
public static final DownloadActivityType ROADS_FILE = new DownloadActivityType(R.string.download_roads_only_maps, "road_map");
|
||||
new DownloadActivityType(R.string.voices, R.drawable.ic_action_volume_up, "voice", 20);
|
||||
public static final DownloadActivityType ROADS_FILE =
|
||||
new DownloadActivityType(R.string.download_roads_only_maps, "road_map", 30);
|
||||
public static final DownloadActivityType SRTM_COUNTRY_FILE =
|
||||
new DownloadActivityType(R.string.download_srtm_maps,
|
||||
R.drawable.ic_plugin_srtm, "srtm_map");
|
||||
R.drawable.ic_plugin_srtm, "srtm_map", 40);
|
||||
public static final DownloadActivityType HILLSHADE_FILE =
|
||||
new DownloadActivityType(R.string.download_hillshade_maps,
|
||||
R.drawable.ic_action_hillshade_dark, "hillshade");
|
||||
R.drawable.ic_action_hillshade_dark, "hillshade", 50);
|
||||
public static final DownloadActivityType WIKIPEDIA_FILE =
|
||||
new DownloadActivityType(R.string.download_wikipedia_maps,
|
||||
R.drawable.ic_world_globe_dark, "wikimap");
|
||||
public static final DownloadActivityType LIVE_UPDATES_FILE = new DownloadActivityType(R.string.download_live_updates, "live_updates");
|
||||
R.drawable.ic_world_globe_dark, "wikimap", 60);
|
||||
public static final DownloadActivityType LIVE_UPDATES_FILE =
|
||||
new DownloadActivityType(R.string.download_live_updates, "live_updates", 70);
|
||||
private final int stringResource;
|
||||
private final int iconResource;
|
||||
|
||||
private String tag;
|
||||
private int orderIndex;
|
||||
|
||||
public DownloadActivityType(int stringResource, int iconResource, String tag) {
|
||||
public DownloadActivityType(int stringResource, int iconResource, String tag, int orderIndex) {
|
||||
this.stringResource = stringResource;
|
||||
this.tag = tag;
|
||||
this.orderIndex = orderIndex;
|
||||
byTag.put(tag, this);
|
||||
this.iconResource = iconResource;
|
||||
}
|
||||
|
||||
public DownloadActivityType(int stringResource, String tag) {
|
||||
public DownloadActivityType(int stringResource, String tag, int orderIndex) {
|
||||
this.stringResource = stringResource;
|
||||
this.tag = tag;
|
||||
this.orderIndex = orderIndex;
|
||||
byTag.put(tag, this);
|
||||
iconResource = R.drawable.ic_map;
|
||||
}
|
||||
|
@ -74,7 +80,10 @@ public class DownloadActivityType implements Parcelable {
|
|||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
public int getOrderIndex() {
|
||||
return orderIndex;
|
||||
}
|
||||
|
||||
public static boolean isCountedInDownloads(IndexItem es) {
|
||||
DownloadActivityType tp = es.getType();
|
||||
|
|
|
@ -38,7 +38,7 @@ public class IndexItem implements Comparable<IndexItem>, HasName, Parcelable {
|
|||
public IndexItem(String fileName, String description, long timestamp, String size, long contentSize,
|
||||
long containerSize, DownloadActivityType tp) {
|
||||
this.fileName = fileName;
|
||||
this.simplifiedFileName = fileName.toLowerCase().replace("_2.", ".");
|
||||
this.simplifiedFileName = fileName.toLowerCase().replace("_2.", ".").replace("hillshade_", "");
|
||||
this.description = description;
|
||||
this.timestamp = timestamp;
|
||||
this.size = size;
|
||||
|
|
|
@ -85,8 +85,13 @@ public class ItemViewHolder {
|
|||
rightButtonAction = RightButtonAction.ASK_FOR_SEAMARKS_PLUGIN;
|
||||
disabled = true;
|
||||
}
|
||||
if (indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE && srtmDisabled) {
|
||||
nameTextView.setText(context.getString(R.string.srtm_plugin_disabled));
|
||||
if ((indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE ||
|
||||
indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) && srtmDisabled) {
|
||||
if (indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
||||
nameTextView.setText(context.getString(R.string.srtm_plugin_disabled));
|
||||
} else {
|
||||
nameTextView.setText(context.getString(R.string.hillshade_layer_disabled));
|
||||
}
|
||||
OsmandPlugin srtmPlugin = OsmandPlugin.getPlugin(SRTMPlugin.class);
|
||||
if (srtmPlugin == null || srtmPlugin.needsInstallation()) {
|
||||
rightButtonAction = RightButtonAction.ASK_FOR_SRTM_PLUGIN_PURCHASE;
|
||||
|
@ -105,7 +110,8 @@ public class ItemViewHolder {
|
|||
}
|
||||
}
|
||||
|
||||
if (!showTypeInTitle && indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE && srtmDisabled) {
|
||||
if (!showTypeInTitle && (indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE ||
|
||||
indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) && srtmDisabled) {
|
||||
descrTextView.setText(indexItem.getType().getString(context));
|
||||
} else if (showTypeInDesc) {
|
||||
descrTextView.setText(indexItem.getType().getString(context) + " • " + indexItem.getSizeDescription(context));
|
||||
|
|
|
@ -79,14 +79,14 @@ public class ItemsListBuilder {
|
|||
str1 = ((WorldRegion) obj1).getName();
|
||||
} else {
|
||||
ResourceItem item = (ResourceItem) obj1;
|
||||
str1 = item.title + item.getIndexItem().getType().getTag();
|
||||
str1 = item.title + item.getIndexItem().getType().getOrderIndex();
|
||||
}
|
||||
|
||||
if (obj2 instanceof WorldRegion) {
|
||||
str2 = ((WorldRegion) obj2).getName();
|
||||
} else {
|
||||
ResourceItem item = (ResourceItem) obj2;
|
||||
str2 = item.title + item.getIndexItem().getType().getTag();
|
||||
str2 = item.title + item.getIndexItem().getType().getOrderIndex();
|
||||
}
|
||||
|
||||
return str1.compareTo(str2);
|
||||
|
@ -110,6 +110,7 @@ public class ItemsListBuilder {
|
|||
|
||||
private boolean srtmDisabled;
|
||||
private boolean hasSrtm;
|
||||
private boolean hasHillshade;
|
||||
|
||||
public List<ResourceItem> getRegionMapItems() {
|
||||
return regionMapItems;
|
||||
|
@ -194,6 +195,7 @@ public class ItemsListBuilder {
|
|||
private void collectSubregionsDataAndItems() {
|
||||
srtmDisabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) == null;
|
||||
hasSrtm = false;
|
||||
hasHillshade = false;
|
||||
|
||||
// Collect all regions (and their parents) that have at least one
|
||||
// resource available in repository or locally.
|
||||
|
@ -234,11 +236,19 @@ public class ItemsListBuilder {
|
|||
resItem.setTitle(name);
|
||||
|
||||
if (region != this.region && srtmDisabled) {
|
||||
if (hasSrtm && indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE)
|
||||
continue;
|
||||
|
||||
if (!hasSrtm && indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE)
|
||||
hasSrtm = true;
|
||||
if (indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
||||
if (hasSrtm) {
|
||||
continue;
|
||||
} else {
|
||||
hasSrtm = true;
|
||||
}
|
||||
} else if (indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) {
|
||||
if (hasHillshade) {
|
||||
continue;
|
||||
} else {
|
||||
hasHillshade = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue