Fix exception

This commit is contained in:
Victor Shcherb 2013-02-08 19:53:56 +01:00
parent ceded9c1fa
commit 3cd5fac71c
6 changed files with 26 additions and 16 deletions

View file

@ -398,14 +398,17 @@ public class ResourceManager {
file.mkdirs();
List<String> warnings = new ArrayList<String>();
if (file.exists() && file.canRead()) {
for (File f : file.listFiles()) {
if(f.isDirectory()) {
File conf = new File(f, "_config.p");
if(!conf.exists()) {
conf = new File(f, "_ttsconfig.p");
}
if(conf.exists()) {
indexFileNames.put(f.getName(), MessageFormat.format("{0,date,dd.MM.yyyy}", new Date(conf.lastModified()))); //$NON-NLS-1$
File[] lf = file.listFiles();
if (lf != null) {
for (File f : lf) {
if (f.isDirectory()) {
File conf = new File(f, "_config.p");
if (!conf.exists()) {
conf = new File(f, "_ttsconfig.p");
}
if (conf.exists()) {
indexFileNames.put(f.getName(), MessageFormat.format("{0,date,dd.MM.yyyy}", new Date(conf.lastModified()))); //$NON-NLS-1$
}
}
}
}

View file

@ -411,9 +411,12 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
}
}
}
for (IndexItem file : downloadListIndexThread.getCachedIndexFiles()) {
if (file.getType() == type) {
filtered.add(file);
List<IndexItem> cachedIndexFiles = downloadListIndexThread.getCachedIndexFiles();
if (cachedIndexFiles != null) {
for (IndexItem file : cachedIndexFiles) {
if (file.getType() == type) {
filtered.add(file);
}
}
}
return filtered;

View file

@ -1238,7 +1238,9 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|| settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_COMPASS ? OsmandSettings.BOTTOM_CONSTANT :
OsmandSettings.CENTER_CONSTANT);
registerUnregisterSensor(getLastKnownLocation(), false);
mapLayers.getMapInfoLayer().recreateControls();
if (mapLayers.getMapInfoLayer() != null) {
mapLayers.getMapInfoLayer().recreateControls();
}
mapLayers.updateLayers(mapView);
getMyApplication().getDaynightHelper().setDayNightMode(settings.DAYNIGHT_MODE.get());

View file

@ -41,7 +41,7 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity<B
setLabelText(R.string.incremental_search_building);
progress.setVisibility(View.INVISIBLE);
finishInitializing(result);
if (result.isEmpty()) {
if (result == null || result.isEmpty()) {
Toast.makeText(SearchBuildingByNameActivity.this,
R.string.no_buildings_found, Toast.LENGTH_LONG).show();
}

View file

@ -587,8 +587,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
mediaRec.release();
mediaRec = null;
}
setRecordListener(recordControl, mapActivity);
app.getSettings().SHOW_RECORDINGS.set(true);
if (recordControl != null) {
setRecordListener(recordControl, mapActivity);
}
}
@ -739,6 +740,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
par.removeView(recordControl);
}
stopRecording(mapActivity);
app.getSettings().SHOW_RECORDINGS.set(true);
indexFile(f);
mapActivity.getMapView().refreshMap();
}

View file

@ -209,7 +209,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
}
public synchronized void removeLayer(OsmandMapLayer layer) {
layers.remove(layer);
while(layers.remove(layer));
zOrders.remove(layer);
layer.destroyLayer();
}