use of com.odysee.app.tasks.ReadTextFileTask in project odysee-android by OdyseeTeam.
the class FileViewFragment method loadMarkdownFromFile.
private void loadMarkdownFromFile(String filePath) {
ReadTextFileTask task = new ReadTextFileTask(filePath, new ReadTextFileTask.ReadTextFileHandler() {
@Override
public void onSuccess(String text) {
if (webView != null) {
String html = buildMarkdownHtml(text);
webView.loadData(Base64.encodeToString(html.getBytes(), Base64.NO_PADDING), "text/html", "base64");
}
}
@Override
public void onError(Exception error) {
showError(error.getMessage());
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations