Small refactoring and do not clear bitmap cache often
This commit is contained in:
parent
d79ffb1580
commit
129bdce53c
3 changed files with 62 additions and 55 deletions
|
@ -393,7 +393,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
return dialog;
|
||||
}
|
||||
}
|
||||
if(id == OsmandApplication.PROGRESS_DIALOG){
|
||||
if (id == OsmandApplication.PROGRESS_DIALOG) {
|
||||
return startProgressDialog;
|
||||
}
|
||||
return null;
|
||||
|
@ -533,6 +533,12 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
public void setMapLocation(double lat, double lon){
|
||||
mapView.setLatLon(lat, lon);
|
||||
locationChanged(lat, lon, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTrackballEvent(MotionEvent event) {
|
||||
if(event.getAction() == MotionEvent.ACTION_MOVE && settings.USE_TRACKBALL_FOR_MOVEMENTS.get()){
|
||||
|
@ -965,11 +971,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
}
|
||||
}
|
||||
|
||||
public void setMapLocation(double lat, double lon){
|
||||
mapView.setLatLon(lat, lon);
|
||||
locationChanged(lat, lon, this);
|
||||
}
|
||||
|
||||
public OsmandMapTileView getMapView() {
|
||||
return mapView;
|
||||
}
|
||||
|
|
|
@ -291,16 +291,25 @@ public class OsmandApplication extends Application {
|
|||
|
||||
|
||||
public synchronized void startApplication() {
|
||||
if(applicationInitializing){
|
||||
if (applicationInitializing) {
|
||||
return;
|
||||
}
|
||||
applicationInitializing = true;
|
||||
startDialog = new ProgressDialogImplementation(this, null, false);
|
||||
|
||||
startDialog.setRunnable("Initializing app", new Runnable() { //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
startApplicationBackground();
|
||||
}
|
||||
});
|
||||
startDialog.run();
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
|
||||
|
||||
}
|
||||
|
||||
private void startApplicationBackground() {
|
||||
List<String> warnings = null;
|
||||
try {
|
||||
if (osmandSettings.NATIVE_RENDERING.get()) {
|
||||
|
@ -319,8 +328,6 @@ public class OsmandApplication extends Application {
|
|||
warnings.addAll(helper.saveDataToGpx());
|
||||
}
|
||||
helper.close();
|
||||
// NativeOsmandLibrary.loadLibrary();
|
||||
|
||||
} finally {
|
||||
synchronized (OsmandApplication.this) {
|
||||
final ProgressDialog toDismiss;
|
||||
|
@ -347,12 +354,6 @@ public class OsmandApplication extends Application {
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
startDialog.run();
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
|
||||
|
||||
}
|
||||
|
||||
protected void showWarnings(List<String> warnings, final Context uiContext) {
|
||||
if (warnings != null && !warnings.isEmpty()) {
|
||||
|
|
|
@ -172,6 +172,8 @@ public class MapRenderRepositories {
|
|||
|
||||
public void clearAllResources() {
|
||||
clearCache();
|
||||
bmp = null;
|
||||
bmpLocation = null;
|
||||
for (String f : new ArrayList<String>(files.keySet())) {
|
||||
closeConnection(files.get(f), f);
|
||||
}
|
||||
|
@ -607,8 +609,11 @@ public class MapRenderRepositories {
|
|||
public synchronized void clearCache() {
|
||||
cObjects = new ArrayList<BinaryMapDataObject>();
|
||||
cObjectsBox = new RectF();
|
||||
prevBmp = bmp = null;
|
||||
requestedBox = prevBmpLocation = bmpLocation = null;
|
||||
prevBmp = null;
|
||||
requestedBox = prevBmpLocation = null;
|
||||
// Do not clear main bitmap to not cause a screen refresh
|
||||
// bmp = null;
|
||||
// bmpLocation = null;
|
||||
}
|
||||
|
||||
// / Manipulating with multipolygons
|
||||
|
|
Loading…
Reference in a new issue