This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render test using the node render test suite
- Loading branch information
Showing
23 changed files
with
604 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
.../android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/LocalRequestTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.mapbox.mapboxsdk.http; | ||
|
||
import android.content.res.AssetManager; | ||
import android.os.AsyncTask; | ||
import com.mapbox.mapboxsdk.Mapbox; | ||
import timber.log.Timber; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
class LocalRequestTask extends AsyncTask<String, Void, byte[]> { | ||
|
||
private OnLocalRequestResponse requestResponse; | ||
|
||
LocalRequestTask(OnLocalRequestResponse requestResponse) { | ||
this.requestResponse = requestResponse; | ||
} | ||
|
||
@Override | ||
protected byte[] doInBackground(String... strings) { | ||
try { | ||
return loadFile(Mapbox.getApplicationContext().getAssets(), | ||
"integration/" + strings[0] | ||
.substring(8) | ||
.replaceAll("%20", " ") | ||
.replaceAll("%2c", ",")); | ||
} catch (IOException exception) { | ||
Timber.e(exception); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void onPostExecute(byte[] bytes) { | ||
super.onPostExecute(bytes); | ||
if (bytes != null && requestResponse != null) { | ||
requestResponse.onResponse(bytes); | ||
} | ||
} | ||
|
||
private static byte[] loadFile(AssetManager assets, String path) throws IOException { | ||
InputStream input = assets.open(path); | ||
int size = input.available(); | ||
byte[] buffer = new byte[size]; | ||
input.read(buffer); | ||
input.close(); | ||
return buffer; | ||
} | ||
|
||
public interface OnLocalRequestResponse { | ||
void onResponse(byte[] bytes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.