Last active
December 30, 2015 11:49
-
-
Save alvinsj/7825331 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
new APIRequest( new APIClient(HomeActivity.this), APP_SERVER+"/download_pdf", APIRequest.GET) | |
.withDefaultParams(defaultParamsHashMap()) | |
.addParam("format", "json") | |
.addParam("id", pdfId) | |
.addHeaderParam("Referer", APP_REFERER); | |
.startDownload(CACHE_ID, DOWNLOAD_FOLDER, new APIDataRequestHandler(){ | |
@Override | |
public void before(){ | |
showProgressBar(); | |
} | |
@Override | |
public void after(){ | |
showPDF(); | |
hideProgressBar(); | |
} | |
@Override | |
public void onException(Exception e) { | |
e.printStackTrace(); | |
} | |
@Override | |
public void onResponse(File data) { | |
mapFilePathToPage(data.getAbsolutePath(), PAGE_NUMBER) | |
} | |
@Override | |
public void onProgressUpdate(int changed){ | |
updateProgressBar(changed) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment