本文整理汇总了Java中org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.DEBUGMODE属性的典型用法代码示例。如果您正苦于以下问题:Java OpenStreetMapTileProviderConstants.DEBUGMODE属性的具体用法?Java OpenStreetMapTileProviderConstants.DEBUGMODE怎么用?Java OpenStreetMapTileProviderConstants.DEBUGMODE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
的用法示例。
在下文中一共展示了OpenStreetMapTileProviderConstants.DEBUGMODE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFolderAndCheckIfExists
private boolean createFolderAndCheckIfExists(final File pFile) {
if (pFile.mkdirs()) {
return true;
}
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"Failed to create " + pFile + " - wait and check again");
}
// if create failed, wait a bit in case another thread created it
try {
Thread.sleep(500);
} catch (final InterruptedException ignore) {
}
// and then check again
if (pFile.exists()) {
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"Seems like another thread created " + pFile);
}
return true;
} else {
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"File still doesn't exist: " + pFile);
}
return false;
}
}
示例2: SafeTileWriter
public SafeTileWriter(Context context) {
if (context.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
safeTilePathBase = OpenStreetMapTileProviderConstants.TILE_PATH_BASE;
} else {
safeTilePathBase = new File(context.getExternalCacheDir(), "tiles");
}
// do this in the background because it takes a long time
final Thread t = new Thread() {
@Override
public void run() {
mUsedCacheSpace = 0; // because it's static
calculateDirectorySize(safeTilePathBase);
if (mUsedCacheSpace > OpenStreetMapTileProviderConstants.TILE_MAX_CACHE_SIZE_BYTES) {
cutCurrentCache();
}
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"Finished init thread");
}
}
};
t.setPriority(Thread.MIN_PRIORITY);
t.start();
}
示例3: loadTile
@Override
public Drawable loadTile(final MapTileRequestState pState) throws CantContinueException {
ITileSource tileSource = mTileSource.get();
if (tileSource == null) {
return null;
}
final MapTile tile = pState.getMapTile();
// if there's no sdcard then don't do anything
if (!getSdCardAvailable()) {
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"No sdcard - do nothing for tile: " + tile);
}
return null;
}
// Check the tile source to see if its file is available and if so, then render the
// drawable and return the tile
final File file = new File(safeTilePathBase,
tileSource.getTileRelativeFilenameString(tile) + OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION);
if (file.exists()) {
try {
final Drawable drawable = tileSource.getDrawable(file.getPath());
// Check to see if file has expired
final long now = System.currentTimeMillis();
final long lastModified = file.lastModified();
final boolean fileExpired = lastModified < now - mMaximumCachedFileAge;
if (fileExpired && drawable != null) {
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"Tile expired: " + tile);
}
ExpirableBitmapDrawable.setDrawableExpired(drawable);
}
return drawable;
} catch (final LowMemoryException e) {
// low memory so empty the queue
Log.w(IMapView.LOGTAG,"LowMemoryException downloading MapTile: " + tile + " : " + e);
throw new CantContinueException(e);
}
}
// If we get here then there is no file in the file cache
return null;
}