Skip to content

Commit ff2faad

Browse files
authored
Merge pull request #9 from Vizzuality/feature/local-image-extension
Local tiles as pattern test png and jpg
2 parents e72b332 + 4755c06 commit ff2faad

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTile.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,21 @@ public Tile getTile(int x, int y, int zoom) {
4545
File myFile = new File(dir + "/" + pathUrl);
4646

4747
try {
48-
image = BitmapFactory.decodeFile(myFile.getAbsolutePath(), options);
48+
image = BitmapFactory.decodeFile(myFile.getAbsolutePath() + ".png", options);
4949
} catch (Exception e) {
5050
e.printStackTrace();
5151
return NO_TILE;
5252
}
5353

54+
if (image == null) {
55+
try {
56+
image = BitmapFactory.decodeFile(myFile.getAbsolutePath() + ".jpg", options);
57+
} catch (Exception e) {
58+
e.printStackTrace();
59+
return NO_TILE;
60+
}
61+
}
62+
5463
if (image != null) {
5564
Bitmap finalBitmap = Bitmap.createBitmap(image , 0 , 0, this.width, this.height);
5665
stream = new ByteArrayOutputStream();

0 commit comments

Comments
 (0)