Revert DownloadOsmandIndexesHelper changes + fix download regions

This commit is contained in:
Alexey Kulish 2015-10-02 21:18:27 +03:00
parent 8a123271c6
commit 8faa3b0aa8
5 changed files with 14 additions and 25 deletions

View file

@ -3,5 +3,5 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<include layout="@layout/free_version_banner"/><include layout="@layout/local_items_fragment"/>
<include layout="@layout/free_version_banner"/><include layout="@layout/download_items_list"/>
</LinearLayout>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/download_items_list"/>
</LinearLayout>

View file

@ -109,27 +109,9 @@ public class DownloadOsmandIndexesHelper {
log.info(strUrl);
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
File tmp = new File(ctx.getAppPath(IndexConstants.BACKUP_INDEX_DIR), "map_indexes.tmp");
if (!tmp.exists()) {
log.info(strUrl);
log.warn("111 - NO FILE");
URLConnection connection = NetworkUtils.getHttpURLConnection(strUrl);
InputStream in = connection.getInputStream();
FileOutputStream out = new FileOutputStream(tmp);
int read;
byte[] buffer = new byte[32256];
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
out.close();
} else {
log.warn("111 - READ BACKUP");
}
GZIPInputStream gzin = new GZIPInputStream(new FileInputStream(tmp));
GZIPInputStream gzin = new GZIPInputStream(in);
parser.setInput(gzin, "UTF-8"); //$NON-NLS-1$
int next;
while((next = parser.next()) != XmlPullParser.END_DOCUMENT) {
@ -148,7 +130,7 @@ public class DownloadOsmandIndexesHelper {
}
result.sort();
gzin.close();
//in.close();
in.close();
} catch (IOException e) {
log.error("Error while loading indexes from repository", e); //$NON-NLS-1$
return null;

View file

@ -65,7 +65,7 @@ public class RegionItemsFragment extends OsmandExpandableListFragment {
this.region = region;
View view = inflater.inflate(R.layout.local_items_fragment, container, false);
View view = inflater.inflate(R.layout.download_items_fragment, container, false);
builder = new ItemsListBuilder(getMyApplication(), this.region);