time checks
This commit is contained in:
parent
d62a92b5e8
commit
1d3849ef4d
4 changed files with 12 additions and 4 deletions
|
@ -5,7 +5,9 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="32dp"
|
||||
android:gravity="center"
|
||||
android:background="@color/color_black">
|
||||
android:clickable="true"
|
||||
android:background="@color/color_black"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/server_status_textview"
|
||||
|
|
|
@ -34,8 +34,8 @@ public class ServerFragment extends BaseOsmAndFragment {
|
|||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
enableStrictMode();
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,6 +72,8 @@ public class ServerFragment extends BaseOsmAndFragment {
|
|||
.detectDiskReads()
|
||||
.detectDiskWrites()
|
||||
.detectNetwork()
|
||||
.permitDiskReads()
|
||||
.permitDiskWrites()
|
||||
.penaltyLog()
|
||||
.build());
|
||||
StrictMode.setVmPolicy(
|
||||
|
|
|
@ -24,6 +24,7 @@ public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint {
|
|||
private static final Log LOG = PlatformUtil.getLog(TileEndpoint.class);
|
||||
private final MapActivity mapActivity;
|
||||
private final MetaTileFileSystemCache cache;
|
||||
//TODO restore mapState on Exit
|
||||
private final RotatedTileBox mapTileBoxCopy;
|
||||
|
||||
public TileEndpoint(MapActivity mapActivity) {
|
||||
|
@ -31,12 +32,13 @@ public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint {
|
|||
this.cache = new MetaTileFileSystemCache(mapActivity.getMyApplication());
|
||||
this.mapTileBoxCopy = mapActivity.getMapView().getCurrentRotatedTileBox().copy();
|
||||
//for debug
|
||||
//this.cache.clearCache();
|
||||
this.cache.clearCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NanoHTTPD.Response process(NanoHTTPD.IHTTPSession session, String url) {
|
||||
// https://tile.osmand.net/hd/6/55/25.png
|
||||
LOG.debug("SERVER: STARTED REQUEST");
|
||||
int extInd = url.indexOf('.');
|
||||
if (extInd >= 0) {
|
||||
url = url.substring(0, extInd);
|
||||
|
@ -75,6 +77,7 @@ public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint {
|
|||
}
|
||||
|
||||
private synchronized MetaTileFileSystemCache.MetaTileCache requestMetatile(int x, int y, int zoom) {
|
||||
long time2 = System.currentTimeMillis();
|
||||
MetaTileFileSystemCache.MetaTileCache cacheTile = this.cache.get(zoom, x, y);
|
||||
if (cacheTile != null) {
|
||||
return cacheTile;
|
||||
|
@ -102,6 +105,7 @@ public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint {
|
|||
}
|
||||
res.bmp = tempBmp.copy(tempBmp.getConfig(), true);
|
||||
this.cache.put(res);
|
||||
LOG.debug("SERVER: TIME TO REQUEST TILE: " + (System.currentTimeMillis() - time2));
|
||||
return res;
|
||||
} catch (InterruptedException e) {
|
||||
LOG.error(e);
|
||||
|
|
|
@ -830,7 +830,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
|
||||
// this method could be called in non UI thread
|
||||
public void refreshMap(final boolean updateVectorRendering) {
|
||||
if (view != null && view.isShown()) {
|
||||
if ((view != null && view.isShown()) || isScreenViewDetached) {
|
||||
boolean nightMode = application.getDaynightHelper().isNightMode();
|
||||
Boolean currentNightMode = this.nightMode;
|
||||
boolean forceUpdateVectorDrawing = currentNightMode != null && currentNightMode != nightMode;
|
||||
|
|
Loading…
Reference in a new issue