Esri / Esri/mapbook-android

Determine strategy for using string resources in presenters

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Type - Enhancement
Dominant language
Java
Stars
12
Forks
11
PR merge metrics
No merged PRs in 30d

Description

```java
@Override final public void checkForMapbook() {

mPath = mFileManager.fileExists();
if (mPath != null){

loadMapbook(new DataManagerCallbacks.MapbookCallback() {
/**
* If successfully loaded, populate view
* @param mobileMapPackage - MobileMapPackage
*/
@Override final public void onMapbookLoaded(final MobileMapPackage mobileMapPackage) {
final List maps = mobileMapPackage.getMaps();
mView.setMaps(maps);
final Item item = mobileMapPackage.getItem();
mView.populateMapbookLayout(item);

// Get the file size and date
final long mapbookSize = mFileManager.getSize();
final long mapbookModified = mFileManager.getModifiedDate();

mView.setMapbookMetatdata(mapbookSize, mapbookModified, maps.size());

final byte[] thumbnailData = item.getThumbnailData();
if (thumbnailData != null && thumbnailData.length > 0) {
mView.setThumbnailBitmap(thumbnailData);
}else{
final ListenableFuture futureThumbnail = item.fetchThumbnailAsync();
futureThumbnail.addDoneListener(new Runnable() {
@Override public void run() {
try {
final byte[] itemThumbnailData = futureThumbnail.get();
mView.setThumbnailBitmap(itemThumbnailData);
} catch (final Exception e) {
Log.e(TAG,e.getMessage());
mView.showMessage("There were problems obtaining thumbnail images for maps in mapbook.");
}
}
});
}
}

/**
* If the mapbook fails to load, show a message
* @param error - Throwable
*/
@Override final public void onMapbookNotLoaded(final Throwable error) {
Log.e(TAG, "Problem loading map book " + error.getMessage());
mView.showMapbookNotFound();
mView.showMessage("There was a problem loading the mapbook");
}
});
```
Was thinking the presenter can determine which string resource to provide and the view handles loading the resource. Have to think about this a bit more so we can handle this through a separate issue if we want to dig deeper.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.