Fix exceptions

This commit is contained in:
Victor Shcherb 2015-04-24 23:36:26 +02:00
parent 5dae3f749b
commit f47c371c32
2 changed files with 16 additions and 6 deletions

View file

@ -20,6 +20,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.activities.TransportRouteHelper;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.corenative.NativeCoreContext;
import gnu.trove.list.array.TIntArrayList;
@ -429,13 +430,13 @@ public class ConfigureMapMenu {
protected String getDescription(final List<OsmandSettings.CommonPreference<Boolean>> prefs) {
int count = 0;
int enabled = 0;
for(OsmandSettings.CommonPreference<Boolean> p : prefs) {
count ++;
if(p.get()) {
for (OsmandSettings.CommonPreference<Boolean> p : prefs) {
count++;
if (p.get()) {
enabled++;
}
}
final String descr = enabled +"/"+count;
final String descr = enabled + "/" + count;
return descr;
}
@ -487,7 +488,12 @@ public class ConfigureMapMenu {
}
protected String getRenderDescr(final MapActivity activity) {
return activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer().getName();
RendererRegistry rr = activity.getMyApplication().getRendererRegistry();
RenderingRulesStorage storage = rr.getCurrentSelectedRenderer();
if (storage == null) {
return "";
}
return storage.getName();
}
protected String getDayNightDescr(final MapActivity activity) {

View file

@ -154,7 +154,11 @@ public class SelectedGPXFragment extends ListFragment {
protected void updateContent() {
adapter.clear();
List<GpxSelectionHelper.GpxDisplayGroup> groups = filterGroups(filterType());
adapter.addAll(flatten(groups));
adapter.setNotifyOnChange(false);
for(GpxDisplayItem i: flatten(groups)) {
adapter.add(i);
}
adapter.setNotifyOnChange(true);
adapter.notifyDataSetChanged();
}