Skip to content

Instantly share code, notes, and snippets.

@alvinsj
Last active December 30, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alvinsj/7825331 to your computer and use it in GitHub Desktop.
Save alvinsj/7825331 to your computer and use it in GitHub Desktop.
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