UrlTileSource: use StringBuilder instead of String concatenation (#241)

This commit is contained in:
Izumi Kawashima 2016-11-21 01:50:14 +09:00 committed by Emux
parent 96be36edb8
commit bfa5a095f0

View File

@ -1,6 +1,7 @@
/* /*
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86 * Copyright 2016 devemux86
* Copyright 2016 Izumi Kawashima
* *
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
* *
@ -134,11 +135,12 @@ public abstract class UrlTileSource extends TileSource {
} }
public String getTileUrl(Tile tile) { public String getTileUrl(Tile tile) {
String tileUrl = mUrl + mTileUrlFormatter.formatTilePath(this, tile); StringBuilder sb = new StringBuilder();
sb.append(mUrl).append(mTileUrlFormatter.formatTilePath(this, tile));
if (mApiKey != null) { if (mApiKey != null) {
tileUrl += String.format("?api_key=%s", mApiKey); sb.append("?api_key=").append(mApiKey);
} }
return tileUrl; return sb.toString();
} }
public void setHttpEngine(HttpEngine.Factory httpFactory) { public void setHttpEngine(HttpEngine.Factory httpFactory) {