|
|
@@ -56,15 +56,15 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
|
|
|
}
|
|
|
break;
|
|
|
case Constants.CONSTANT.DOWNLOAD_SUCCESS:
|
|
|
- mStateTextView.setText("报表文件下载成功!");
|
|
|
+ mStateTextView.setText("报表文件下载成功!\n正在加载....");
|
|
|
mDownloadProgressBar.setProgress(100);
|
|
|
mRemainTextView.setText("0");
|
|
|
- mDownloadRelativeLayout.postDelayed(new Runnable() {
|
|
|
+ /*mDownloadRelativeLayout.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
mDownloadRelativeLayout.setVisibility(View.GONE);
|
|
|
}
|
|
|
- }, 1000);
|
|
|
+ }, 1000);*/
|
|
|
displayFromFile(new File(Constants.CONSTANT.PDF_FILE_PATH, Constants.CONSTANT.PDF_FILE_NAME));
|
|
|
break;
|
|
|
case Constants.CONSTANT.PDF_OVERLOAD:
|
|
|
@@ -88,28 +88,35 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
|
|
|
};
|
|
|
|
|
|
private void displayFromFile(File fileName) {
|
|
|
- mPDFView.fromFile(fileName)
|
|
|
+ try {
|
|
|
+ mPDFView.fromFile(fileName)
|
|
|
// .pages(0, 2, 1, 3, 3, 3) // all pages are displayed by default
|
|
|
- .enableSwipe(true) // allows to block changing pages using swipe
|
|
|
+ .enableSwipe(true) // allows to block changing pages using swipe
|
|
|
// .swipeHorizontal(true)
|
|
|
- .enableDoubletap(true)
|
|
|
- .defaultPage(0)
|
|
|
- // allows to draw something on the current page, usually visible in the middle of the screen
|
|
|
- .onDraw(this)
|
|
|
- // allows to draw something on all pages, separately for every page. Called only for visible pages
|
|
|
- .onDrawAll(this)
|
|
|
- .onLoad(this) // called after document is loaded and starts to be rendered
|
|
|
- .onPageChange(this)
|
|
|
- .onPageScroll(this)
|
|
|
- .onError(this)
|
|
|
- .onRender(this) // called after document is rendered for the first time
|
|
|
- .enableAnnotationRendering(false) // render annotations (such as comments, colors or forms)
|
|
|
- .password(null)
|
|
|
- .scrollHandle(null)
|
|
|
- .enableAntialiasing(true) // improve rendering a little bit on low-res screens
|
|
|
- // spacing between pages in dp. To define spacing color, set view background
|
|
|
- .spacing(10)
|
|
|
- .load();
|
|
|
+ .enableDoubletap(true)
|
|
|
+ .defaultPage(0)
|
|
|
+ // allows to draw something on the current page, usually visible in the middle of the screen
|
|
|
+ .onDraw(this)
|
|
|
+ // allows to draw something on all pages, separately for every page. Called only for visible pages
|
|
|
+ .onDrawAll(this)
|
|
|
+ .onLoad(this) // called after document is loaded and starts to be rendered
|
|
|
+ .onPageChange(this)
|
|
|
+ .onPageScroll(this)
|
|
|
+ .onError(this)
|
|
|
+ .onRender(this) // called after document is rendered for the first time
|
|
|
+ .enableAnnotationRendering(false) // render annotations (such as comments, colors or forms)
|
|
|
+ .password(null)
|
|
|
+ .scrollHandle(null)
|
|
|
+ .enableAntialiasing(true) // improve rendering a little bit on low-res screens
|
|
|
+ // spacing between pages in dp. To define spacing color, set view background
|
|
|
+ .spacing(10)
|
|
|
+ .load();
|
|
|
+ } catch (Exception e) {
|
|
|
+ mErrorLinearLayout.setVisibility(View.VISIBLE);
|
|
|
+ mStateTextView.setText("报表文件加载失败!");
|
|
|
+ mDownloadProgressBar.setProgress(0);
|
|
|
+ mRemainTextView.setText(100 + "");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -186,7 +193,13 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
|
|
|
|
|
|
@Override
|
|
|
public void loadComplete(int nbPages) {
|
|
|
-
|
|
|
+ mStateTextView.setText("报表文件加载成功");
|
|
|
+ mDownloadRelativeLayout.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mDownloadRelativeLayout.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
|
|
|
@Override
|