Fix download
This commit is contained in:
parent
7bd5b49a88
commit
6ef86099af
2 changed files with 31 additions and 0 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="archive_wikipedia_data">You have old incompatible wikipedia data downloaded. Do you want to archive it?</string>
|
||||
<string name="download_wikipedia_files">Do you want to download additional Wikipedia data (%1$s MB) ?</string>
|
||||
<string name="gps_network_not_enabled">Location service is not enabled. Do you want to turn it on?</string>
|
||||
<string name="disable_recording_once_app_killed">Prevent standalone logging</string>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.download;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -350,6 +351,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
addToDownload(i);
|
||||
}
|
||||
updateDownloadButton();
|
||||
checkOldWikiFiles();
|
||||
}
|
||||
});
|
||||
bld.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
|
@ -359,6 +361,34 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
}
|
||||
}
|
||||
|
||||
protected void checkOldWikiFiles() {
|
||||
Map<String, String> fileNames = getMyApplication().getResourceManager().getIndexFileNames();
|
||||
final Set<String> wiki = new HashSet<String>();
|
||||
for(String s : fileNames.keySet()) {
|
||||
if(s.contains("_wiki")) {
|
||||
wiki.add(s);
|
||||
}
|
||||
}
|
||||
if(wiki.size() > 0) {
|
||||
Builder bld = new AlertDialog.Builder(this);
|
||||
bld.setMessage(R.string.archive_wikipedia_data);
|
||||
bld.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
for(String w : wiki) {
|
||||
File fl = new File(w);
|
||||
File nf = new File(fl.getParentFile() +"/" + IndexConstants.BACKUP_INDEX_DIR, fl.getName());
|
||||
fl.renameTo(nf);
|
||||
}
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateDownloadButton() {
|
||||
// View view = getView();
|
||||
|
|
Loading…
Reference in a new issue