commit
eb917ea601
8 changed files with 65 additions and 34 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="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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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<IndexItem> list){
|
||||
public void updateDownloadList(List<IndexItem> list) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -75,12 +78,12 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
|
|||
|
||||
}
|
||||
|
||||
public DownloadActivityType getDownloadType(){
|
||||
public DownloadActivityType getDownloadType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Map<IndexItem, List<DownloadEntry>> getEntriesToDownload() {
|
||||
if(downloadListIndexThread == null) {
|
||||
if (downloadListIndexThread == null) {
|
||||
return new LinkedHashMap<IndexItem, List<DownloadEntry>>();
|
||||
}
|
||||
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<IndexItem> filtered, List<IndexItemCategory> cats){
|
||||
public void categorizationFinished(List<IndexItem> filtered, List<IndexItemCategory> 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<DownloadEntry> 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();
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -165,6 +165,10 @@ public class DownloadOsmandIndexesHelper {
|
|||
res.add(new DownloadEntry(this, assetName, destFile, dateModified));
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getDestFile(){
|
||||
return destFile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue