diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 627a714137..bca18bdfc0 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -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
-->
+ Download missing maps $1%s ($2%d MB)?
More...
Browse map
Car
diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java
index cf11404940..540649381f 100644
--- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java
+++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java
@@ -115,6 +115,7 @@ public class OsmAndAppCustomization {
}
public void preDownloadActivity(final DownloadIndexActivity da, final List downloadTypes, ActionBar actionBar ) {
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
ArrayAdapter spinnerAdapter = new ArrayAdapter(actionBar.getThemedContext(), R.layout.sherlock_spinner_item,
toString(downloadTypes)
);
diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java
index 7a03ea027b..d7ffea8939 100644
--- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java
@@ -40,7 +40,6 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
-import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
@@ -51,8 +50,6 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
-import com.actionbarsherlock.app.ActionBar;
-import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SubMenu;
@@ -111,7 +108,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
makeSureUserCancelDownload();
}
});
- getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setTitle(R.string.local_index_download);
// recreation upon rotation is pgetaprevented in manifest file
findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener(){
@@ -256,18 +252,37 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
}
public void showDialogToDownloadMaps(List maps) {
- DownloadIndexAdapter a = (DownloadIndexAdapter) getListAdapter();
- boolean e = true;
- for (IndexItem i : a.getIndexFiles()) {
+ int count = 0;
+ int sz = 0;
+ String s = "";
+ for (IndexItem i : downloadListIndexThread.getCachedIndexFiles()) {
for (String map : maps) {
- if (i.getFileName().equals(map + ".obf.zip")) {
- e = false;
- getEntriesToDownload().put(i, i.createDownloadEntry(getMyApplication(), type, new ArrayList(1)));
+ if (i.getFileName().equals(map + ".obf.zip") && i.getType() == DownloadActivityType.NORMAL_FILE) {
+ final List de = i.createDownloadEntry(getMyApplication(), i.getType(), new ArrayList(1));
+ for(DownloadEntry d : de ) {
+ count++;
+ sz += d.sizeMB;
+ }
+ if(s.length() > 0) {
+ s +=", ";
+ }
+ s += i.getVisibleName(getMyApplication(), getMyApplication().getResourceManager().getOsmandRegions());
+ getEntriesToDownload().put(i, de);
}
}
}
- if(!e){
- downloadFilesCheckInternet();
+ if(count > 0){
+ Builder builder = new AlertDialog.Builder(this);
+ builder.setMessage(MessageFormat.format(getString(R.string.download_additional_maps), s, sz));
+ builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ downloadFilesCheckInternet();
+ }
+ });
+ builder.setNegativeButton(R.string.default_buttons_no, null);
+ builder.show();
+
}
}
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
index 3b3cba8c90..e2596278be 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
@@ -277,14 +277,13 @@ public class DownloadIndexesThread {
private String reindexFiles(List filesToReindex) {
boolean vectorMapsToReindex = false;
+ // reindex vector maps all at one time
+ ResourceManager manager = app.getResourceManager();
for (File f : filesToReindex) {
if (f.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
vectorMapsToReindex = true;
- break;
}
}
- // reindex vector maps all at one time
- ResourceManager manager = app.getResourceManager();
List warnings = new ArrayList();
manager.indexVoiceFiles(this);
if (vectorMapsToReindex) {
diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java
index a4a0833c74..9476df0198 100644
--- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java
+++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java
@@ -197,7 +197,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
da.showDialogToDownloadMaps(suggestToDownloadMap);
}
- });
+ }, 2000);
}
}
return warns;
diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/TourDownloadType.java b/OsmAnd/src/net/osmand/plus/sherpafy/TourDownloadType.java
index 0867f24236..3d6d0b38b5 100644
--- a/OsmAnd/src/net/osmand/plus/sherpafy/TourDownloadType.java
+++ b/OsmAnd/src/net/osmand/plus/sherpafy/TourDownloadType.java
@@ -45,7 +45,7 @@ public class TourDownloadType extends DownloadActivityType {
}
public String getBaseUrl(OsmandApplication ctx, String fileName) {
- return "http://" + SherpafyCustomization.TOUR_SERVER + "/download?event=2&"
+ return "http://" + SherpafyCustomization.TOUR_SERVER + "/download_tour.php?event=2&"
+ Version.getVersionAsURLParam(ctx) + "&file=" + fileName;
}