Exemple #1
0
 /**
  * Load an image from primary or secondary storage.
  *
  * @param url the image URL
  * @param pseudoGeocode the geocode or the shared name
  * @param forceKeep keep the image if it is there, without checking its freshness
  * @return <code>true</code> if the image was there and is fresh enough, <code>false</code>
  *     otherwise
  */
 @NonNull
 private Pair<Bitmap, Boolean> loadImageFromStorage(
     final String url, final String pseudoGeocode, final boolean forceKeep) {
   try {
     final File file = LocalStorage.getStorageFile(pseudoGeocode, url, true, false);
     final Pair<Bitmap, Boolean> image = loadCachedImage(file, forceKeep);
     if (image.getRight() || image.getLeft() != null) {
       return image;
     }
     final File fileSec = LocalStorage.getStorageSecFile(pseudoGeocode, url, true);
     return loadCachedImage(fileSec, forceKeep);
   } catch (Exception e) {
     Log.w("HtmlImage.loadImageFromStorage", e);
   }
   return new ImmutablePair<Bitmap, Boolean>(null, false);
 }