diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index b73b5bb5eb..1eca00e7d5 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
-->
+ Not possible to download. Please connect to Wi-Fi to proceed.
Dismiss
Everything up to date
Use OpenGL rendering
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index 87988648ff..e114f65003 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -338,8 +338,7 @@ public class MapActivityActions implements DialogProvider {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mapActivity.startActivity(intent);
} else if (standardId == R.string.context_menu_item_directions_to) {
- String name = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectName();
- targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, name);
+ targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, "");
enterRoutePlanningMode(null, null, false);
} else if (standardId == R.string.context_menu_item_directions_from) {
String name = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectName();
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
index 5ae42a8d04..bcb67527c4 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
@@ -80,7 +80,10 @@ public class DashUpdatesFragment extends DashBaseFragment {
updates.removeAllViews();
if (list.size() < 1) {
+ mainView.findViewById(R.id.maps).setVisibility(View.GONE);
return;
+ } else {
+ mainView.findViewById(R.id.maps).setVisibility(View.VISIBLE);
}
for (int i = 0; i < list.size(); i++) {
diff --git a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
index 1db2821318..9e9d791120 100644
--- a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
@@ -9,11 +9,14 @@ import java.util.List;
import java.util.Map;
import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
+import android.telephony.TelephonyManager;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleAlertBuilder;
+import net.osmand.access.AccessibleToast;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@@ -45,7 +48,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settings = ((OsmandApplication) getApplication()).getSettings();
- if(downloadListIndexThread == null) {
+ if (downloadListIndexThread == null) {
downloadListIndexThread = new DownloadIndexesThread(this);
}
prepareDownloadDirectory();
@@ -67,7 +70,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
- public void updateDownloadList(List list){
+ public void updateDownloadList(List list) {
}
@@ -75,12 +78,12 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
- public DownloadActivityType getDownloadType(){
+ public DownloadActivityType getDownloadType() {
return type;
}
public Map> getEntriesToDownload() {
- if(downloadListIndexThread == null) {
+ if (downloadListIndexThread == null) {
return new LinkedHashMap>();
}
return downloadListIndexThread.getEntriesToDownload();
@@ -94,20 +97,20 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
- public void downloadListUpdated(){
+ public void downloadListUpdated() {
}
- public OsmandApplication getMyApplication(){
- return (OsmandApplication)getApplication();
+ public OsmandApplication getMyApplication() {
+ return (OsmandApplication) getApplication();
}
- public void categorizationFinished(List filtered, List cats){
+ public void categorizationFinished(List filtered, List cats) {
}
- public void startDownload(IndexItem item){
- if (downloadListIndexThread.getCurrentRunningTask() != null){
+ public void startDownload(IndexItem item) {
+ if (downloadListIndexThread.getCurrentRunningTask() != null) {
Toast.makeText(this, "Please wait before previous download is finished", Toast.LENGTH_SHORT).show();
return;
}
@@ -119,7 +122,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
public void downloadFilesPreCheckSpace() {
double sz = 0;
List list = downloadListIndexThread.flattenDownloadEntries();
- for (DownloadEntry es : list) {
+ for (DownloadEntry es : list) {
sz += es.sizeMB;
}
// get availabile space
@@ -141,7 +144,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
protected void downloadFilesCheckFreeVersion() {
- if (Version.isFreeVersion(getMyApplication()) ) {
+ if (Version.isFreeVersion(getMyApplication())) {
int total = settings.NUMBER_OF_FREE_DOWNLOADS.get();
boolean wiki = false;
for (IndexItem es : DownloadActivity.downloadListIndexThread.getEntriesToDownload().keySet()) {
@@ -168,17 +171,21 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
protected void downloadFilesCheckInternet() {
- if(!getMyApplication().getSettings().isWifiConnected()) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage(getString(R.string.download_using_mobile_internet));
- builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- downloadFilesPreCheckSpace();
- }
- });
- builder.setNegativeButton(R.string.default_buttons_no, null);
- builder.show();
+ if (!getMyApplication().getSettings().isWifiConnected()) {
+ if (getMyApplication().getSettings().isInternetConnectionAvailable()) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setMessage(getString(R.string.download_using_mobile_internet));
+ builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ downloadFilesPreCheckSpace();
+ }
+ });
+ builder.setNegativeButton(R.string.default_buttons_no, null);
+ builder.show();
+ } else {
+ AccessibleToast.makeText(this, R.string.no_internet_connection, Toast.LENGTH_LONG).show();
+ }
} else {
downloadFilesPreCheckSpace();
}
@@ -212,12 +219,12 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
}
private void prepareDownloadDirectory() {
- if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
+ if (getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
boolean showedDialog = false;
- if(Build.VERSION.SDK_INT < OsmandSettings.VERSION_DEFAULTLOCATION_CHANGED) {
+ if (Build.VERSION.SDK_INT < OsmandSettings.VERSION_DEFAULTLOCATION_CHANGED) {
SuggestExternalDirectoryDialog.showDialog(this, null, null);
}
- if(!showedDialog) {
+ if (!showedDialog) {
showDialogOfFreeDownloadsIfNeeded();
}
} else {
@@ -291,13 +298,15 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
new File(newLoc, IndexConstants.APP_DIR)) {
protected Boolean doInBackground(Void[] params) {
Boolean result = super.doInBackground(params);
- if(result) {
+ if (result) {
settings.setExternalStorageDirectory(newLoc);
getMyApplication().getResourceManager().resetStoreDirectory();
- getMyApplication().getResourceManager().reloadIndexes(progress) ;
+ getMyApplication().getResourceManager().reloadIndexes(progress);
}
return result;
- };
+ }
+
+ ;
};
task.execute();
}
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java
index 71d7cdcc3f..da3cb1f23a 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java
@@ -256,7 +256,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
}
return files;
}
-
+
public static File findFileInDir(File file) {
if(file.isDirectory()) {
File[] lf = file.listFiles();
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
index 08b4419952..383a3a7129 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
@@ -551,7 +551,19 @@ public class DownloadIndexesThread {
!date.equals(indexactivateddate) &&
!date.equals(indexfilesdate) &&
indexActivatedFileNames.containsKey(sfName)) {
- itemsToUpdate.add(item);
+ if (item.getType() == DownloadActivityType.NORMAL_FILE ||
+ item.getType() == DownloadActivityType.ROADS_FILE ||
+ item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE){
+ itemsToUpdate.add(item);
+ } else {
+ long itemSize = item.getSize();
+ File file = new File(((DownloadOsmandIndexesHelper.AssetIndexItem) item).getDestFile());
+ long oldItemSize = file.length();
+ if (itemSize != oldItemSize){
+ itemsToUpdate.add(item);
+ }
+ }
+
}
}
if (uiActivity != null){
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java
index d22efa7d4f..650660de05 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java
@@ -165,6 +165,10 @@ public class DownloadOsmandIndexesHelper {
res.add(new DownloadEntry(this, assetName, destFile, dateModified));
return res;
}
+
+ public String getDestFile(){
+ return destFile;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItem.java b/OsmAnd/src/net/osmand/plus/download/IndexItem.java
index 312dbc65dc..df440f3c4a 100644
--- a/OsmAnd/src/net/osmand/plus/download/IndexItem.java
+++ b/OsmAnd/src/net/osmand/plus/download/IndexItem.java
@@ -57,7 +57,10 @@ public class IndexItem implements Comparable {
return timestamp;
}
-
+ public long getSize(){
+ return containerSize;
+ }
+
public String getSizeDescription(Context ctx) {
return size + " MB";
}