Merge pull request #988 from Bars107/master

Bugfixes and improvements.
This commit is contained in:
Alexey Pelykh 2014-12-04 17:56:43 +02:00
commit eb917ea601
8 changed files with 65 additions and 34 deletions

View file

@ -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="no_internet_connection">Not possible to download. Please connect to Wi-Fi to proceed.</string>
<string name="dismiss">Dismiss</string>
<string name="everything_up_to_date">Everything up to date</string>
<string name="use_opengl_render">Use OpenGL rendering</string>

View file

@ -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();

View file

@ -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++) {

View file

@ -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;
@ -169,6 +172,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
protected void downloadFilesCheckInternet() {
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() {
@ -179,6 +183,9 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
});
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();
}
@ -297,7 +304,9 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
getMyApplication().getResourceManager().reloadIndexes(progress);
}
return result;
};
}
;
};
task.execute();
}

View file

@ -551,7 +551,19 @@ public class DownloadIndexesThread {
!date.equals(indexactivateddate) &&
!date.equals(indexfilesdate) &&
indexActivatedFileNames.containsKey(sfName)) {
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){

View file

@ -165,6 +165,10 @@ public class DownloadOsmandIndexesHelper {
res.add(new DownloadEntry(this, assetName, destFile, dateModified));
return res;
}
public String getDestFile(){
return destFile;
}
}

View file

@ -57,6 +57,9 @@ public class IndexItem implements Comparable<IndexItem> {
return timestamp;
}
public long getSize(){
return containerSize;
}
public String getSizeDescription(Context ctx) {
return size + " MB";