Downloads fixes

This commit is contained in:
Alexey Kulish 2015-10-06 12:11:21 +03:00
parent 363b24e3b3
commit 8863606fff
6 changed files with 16 additions and 16 deletions

View file

@ -105,7 +105,7 @@ public class WorldRegion implements Serializable {
}
public void initWorld() {
regionId = null;
regionId = "";
downloadsIdPrefix = "world_";
name = null;
superregion = null;
@ -284,11 +284,11 @@ public class WorldRegion implements Serializable {
}
public WorldRegion getRegionById(String regionId) {
if (regionId == null) {
if (regionId.length() == 0) {
return this;
} else {
for (WorldRegion region : flattenedSubregions) {
if (region.getRegionId().equals(regionId)) {
if (region != null && region.getRegionId().equals(regionId)) {
return region;
}
}

View file

@ -124,12 +124,7 @@ public class BaseDownloadActivity extends ActionBarProgressActivity {
}
public ItemsListBuilder getItemsBuilder() {
if (downloadListIndexThread.isDataPrepared()) {
return new ItemsListBuilder(getMyApplication(), null, downloadListIndexThread.getResourcesByRegions(),
downloadListIndexThread.getVoiceRecItems(), downloadListIndexThread.getVoiceTTSItems());
} else {
return null;
}
return getItemsBuilder("");
}
public ItemsListBuilder getItemsBuilder(String regionId) {

View file

@ -1,6 +1,8 @@
package net.osmand.plus.download.items;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.PlatformUtil;
import net.osmand.map.OsmandRegions;
@ -13,6 +15,7 @@ import net.osmand.plus.download.IndexItem;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.util.Algorithms;
import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
@ -91,8 +94,9 @@ public class ItemsListBuilder {
}
public enum VoicePromptsType {
NONE,
RECORDED,
TTS
TTS;
}
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(ItemsListBuilder.class);

View file

@ -45,6 +45,8 @@ public class RegionDialogFragment extends DialogFragment {
if (regionId == null) {
regionId = getArguments().getString(REGION_ID_DLG_KEY);
}
if (regionId == null)
regionId = "";
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
@ -55,7 +57,7 @@ public class RegionDialogFragment extends DialogFragment {
}
});
if (regionId != null) {
if (regionId.length() > 0) {
Fragment fragment = getChildFragmentManager().findFragmentById(R.id.fragmentContainer);
if (fragment == null) {
getChildFragmentManager().beginTransaction().add(R.id.fragmentContainer,

View file

@ -62,12 +62,15 @@ public class RegionItemsFragment extends OsmandExpandableListFragment {
regionId = getArguments().getString(REGION_ID_KEY);
}
if (regionId == null)
regionId = "";
ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list);
listAdapter = new RegionsItemsAdapter(getActivity());
listView.setAdapter(listAdapter);
setListView(listView);
if (regionId != null) {
if (regionId.length() > 0) {
ItemsListBuilder builder = getDownloadActivity().getItemsBuilder(regionId);
if (builder != null && builder.build()) {
fillRegionItemsAdapter(builder);

View file

@ -1,4 +0,0 @@
package net.osmand.plus.download.items;
public class VoiceItemsFragment {
}