diff --git a/OsmAnd/src/net/osmand/plus/WorldRegion.java b/OsmAnd/src/net/osmand/plus/WorldRegion.java index fc78b63f54..b39d6aa8b1 100644 --- a/OsmAnd/src/net/osmand/plus/WorldRegion.java +++ b/OsmAnd/src/net/osmand/plus/WorldRegion.java @@ -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; } } diff --git a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java index 16c30103ec..4ecfe26895 100644 --- a/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java @@ -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) { diff --git a/OsmAnd/src/net/osmand/plus/download/items/ItemsListBuilder.java b/OsmAnd/src/net/osmand/plus/download/items/ItemsListBuilder.java index b99478d549..f0bcb7a0e2 100644 --- a/OsmAnd/src/net/osmand/plus/download/items/ItemsListBuilder.java +++ b/OsmAnd/src/net/osmand/plus/download/items/ItemsListBuilder.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/download/items/RegionDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/items/RegionDialogFragment.java index 60d9e43c5b..aeca03d443 100644 --- a/OsmAnd/src/net/osmand/plus/download/items/RegionDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/items/RegionDialogFragment.java @@ -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, diff --git a/OsmAnd/src/net/osmand/plus/download/items/RegionItemsFragment.java b/OsmAnd/src/net/osmand/plus/download/items/RegionItemsFragment.java index 70e315f4b4..067109eb49 100644 --- a/OsmAnd/src/net/osmand/plus/download/items/RegionItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/items/RegionItemsFragment.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/download/items/VoiceItemsFragment.java b/OsmAnd/src/net/osmand/plus/download/items/VoiceItemsFragment.java deleted file mode 100644 index 5c185271aa..0000000000 --- a/OsmAnd/src/net/osmand/plus/download/items/VoiceItemsFragment.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.osmand.plus.download.items; - -public class VoiceItemsFragment { -}