本文整理汇总了Java中com.google.samples.apps.iosched.util.MapUtils.getTileFile方法的典型用法代码示例。如果您正苦于以下问题:Java MapUtils.getTileFile方法的具体用法?Java MapUtils.getTileFile怎么用?Java MapUtils.getTileFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.util.MapUtils
的用法示例。
在下文中一共展示了MapUtils.getTileFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOverlayLoaderComplete
import com.google.samples.apps.iosched.util.MapUtils; //导入方法依赖的package包/类
private void onOverlayLoaderComplete(Cursor cursor) {
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
final int floor = cursor.getInt(OverlayQuery.TILE_FLOOR);
final String file = cursor.getString(OverlayQuery.TILE_FILE);
File f = MapUtils.getTileFile(getActivity().getApplicationContext(), file);
if (f != null) {
addTileProvider(floor, f);
}
cursor.moveToNext();
}
}
mOverlaysLoaded = true;
enableMapElements();
}
示例2: loadInBackground
import com.google.samples.apps.iosched.util.MapUtils; //导入方法依赖的package包/类
@Override
public List<TileEntry> loadInBackground() {
List<TileEntry> list = null;
// Create a URI to get a cursor for all map tile entries.
final Uri uri = ScheduleContract.MapTiles.buildUri();
Cursor cursor = getContext().getContentResolver().query(uri,
OverlayQuery.PROJECTION, null, null, null);
if (cursor != null) {
// Create a TileProvider for each entry in the cursor
final int count = cursor.getCount();
// Initialise the tile cache that is reused for all TileProviders.
// Note that the cache *MUST* be closed when the encapsulating Fragment is stopped.
DiskLruCache tileCache = MapUtils.openDiskCache(getContext());
list = new ArrayList<>(count);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
final int floor = cursor.getInt(OverlayQuery.TILE_FLOOR);
final String file = cursor.getString(OverlayQuery.TILE_FILE);
File f = MapUtils.getTileFile(getContext().getApplicationContext(), file);
if (f == null || !f.exists()) {
// Skip the file if it is invalid or does not exist.
break;
}
CachedTileProvider provider;
try {
SVGTileProvider svgProvider = new SVGTileProvider(f, mDPI);
// Wrap the SVGTileProvider in a CachedTileProvider for caching on disk.
provider = new CachedTileProvider(Integer.toString(floor), svgProvider,
tileCache);
} catch (IOException e) {
LOGD(TAG, "Could not create Tile Provider.");
break;
}
list.add(new TileEntry(floor, provider));
cursor.moveToNext();
}
cursor.close();
}
return list;
}
示例3: loadInBackground
import com.google.samples.apps.iosched.util.MapUtils; //导入方法依赖的package包/类
@Override
public List<TileEntry> loadInBackground() {
List<TileEntry> list;
// Create a TileProvider for each entry in the cursor
final int count = floorTileFileMapping.size();
// Initialise the tile cache that is reused for all TileProviders.
// Note that the cache *MUST* be closed when the encapsulating Fragment is stopped.
DiskLruCache tileCache = MapUtils.openDiskCache(getContext());
list = new ArrayList<>(count);
for (Map.Entry<Integer, String> entry : floorTileFileMapping.entrySet()) {
final int floor = entry.getKey();
final String file = entry.getValue();
File f = MapUtils.getTileFile(getContext().getApplicationContext(), file);
if (f == null || !f.exists()) {
if (MapUtils.hasTileAsset(getContext(), file)) {
MapUtils.copyTileAsset(getContext(), file);
} else {
break;
}
}
CachedTileProvider provider;
try {
SVGTileProvider svgProvider = new SVGTileProvider(f, mDPI);
// Wrap the SVGTileProvider in a CachedTileProvider for caching on disk.
provider = new CachedTileProvider(Integer.toString(floor), svgProvider,
tileCache);
} catch (IOException e) {
LOGD(TAG, "Could not create Tile Provider.");
break;
}
list.add(new TileEntry(floor, provider));
}
return list;
}
示例4: loadInBackground
import com.google.samples.apps.iosched.util.MapUtils; //导入方法依赖的package包/类
@Override
public List<TileEntry> loadInBackground() {
List<TileEntry> list = null;
// Create a URI to get a cursor for all map tile entries.
final Uri uri = ScheduleContract.MapTiles.buildUri();
Cursor cursor = getContext().getContentResolver().query(uri,
OverlayQuery.PROJECTION, null, null, null);
if (cursor != null) {
// Create a TileProvider for each entry in the cursor
final int count = cursor.getCount();
// Initialise the tile cache that is reused for all TileProviders.
// Note that the cache *MUST* be closed when the encapsulating Fragment is stopped.
DiskLruCache tileCache = MapUtils.openDiskCache(getContext());
list = new ArrayList<>(count);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
final int floor = cursor.getInt(OverlayQuery.TILE_FLOOR);
final String file = cursor.getString(OverlayQuery.TILE_FILE);
File f = MapUtils.getTileFile(getContext().getApplicationContext(), file);
if (f == null || !f.exists()) {
// Skip the file if it is invalid or does not exist.
LOGE(TAG, "Tile file not found for floor " + floor);
break;
}
CachedTileProvider provider;
try {
SVGTileProvider svgProvider = new SVGTileProvider(f, mDPI);
// Wrap the SVGTileProvider in a CachedTileProvider for caching on disk.
provider = new CachedTileProvider(Integer.toString(floor), svgProvider,
tileCache);
} catch (IOException e) {
LOGD(TAG, "Could not create Tile Provider.");
break;
}
list.add(new TileEntry(floor, provider));
cursor.moveToNext();
}
cursor.close();
}
return list;
}